// Use this for initialization void Start() { ship = GetComponentInChildren <StarshipController>(); gui = GetComponent <GUIController>(); frontMessage = GetComponentInChildren <FrontMessage>(); mainTimer = GetComponentInChildren <MainTimer>(); bar = GetComponentInChildren <Bar>(); speedCounter = GetComponentInChildren <SpeedCounter>(); oobAudio = GetComponentInChildren <OutOfBoundsAudio>(); fuelAlarm = GetComponentInChildren <FuelAlarm>(); lowFuelText = GetComponentInChildren <LowFuelText>(); timeLeft = 10f; //!!!! currentSpeed = minimumSpeed; fuel = 100f; theLevel = GetComponent <TheLevel>(); foreach (Transform child in transform) { if (child.name == "StarsNear") { starsNear = child.GetComponent <Stars>(); } else if (child.name == "StarsMedium") { starsMedium = child.GetComponent <Stars>(); } else if (child.name == "StarsFar") { starsFar = child.GetComponent <Stars>(); } } }
public void Measure() { Action action = () => Thread.Sleep(5000); Func <int> func = () => { Thread.Sleep(6000); return(666); }; var counter = new SpeedCounter(); counter.Measure("Action", action); var res = counter.Measure("Func", func); // Warning!!! Be aware of such hacks. I totaly know that there are no minutes and hours. Assert.AreEqual(5, counter.Statistics["Action"].Total().Seconds); Assert.AreEqual(6, counter.Statistics["Func"].Total().Seconds); Assert.AreEqual(666, res); }