Пример #1
0
 /**
  * @brief Stops transferring data along a specific bus route.
  * @param route - The route to stop transferring data along.
  */
 public void StopTransferringData(BUS_ROUTE route)
 {
     //Only take the route if it is valid.
     if (!route.Equals(BUS_ROUTE.NONE))
     {
         ToggleAnimations(route, false);
     }
 }
Пример #2
0
 /**
  * @brief Toogles the animation of a given route.
  * @param route - The route who's animation will be toggled.
  * @param active - If 'true' the animation will be played,
  *                 otherwise stop playing it.
  */
 private void ToggleAnimations(BUS_ROUTE route, bool active)
 {
     //Loop through every bus object in the route.
     for (int i = 0; i < routes[(int)route].Length; i++)
     {
         if (active)
         {
             //Add the animation.
             busPaths[routes[(int)route][i]].GetComponent <Image>().sprite = animatedSprite;
         }
         else
         {
             //Remove the animation.
             busPaths[routes[(int)route][i]].GetComponent <Image>().sprite = staticSprite;
         }
         //Play/Stop the animation.
         busPaths[routes[(int)route][i]].GetComponent <Animator>().enabled = active;
     }
 }