public override void Update(DeltaTime deltaTime) { /* * ticks++; * if(timer.ElapsedMilliseconds >= 1000) * { * Console.WriteLine("{0} tps", ticks); * ticks = 0; * timer.Restart(); * } */ if (freezeTime > 0) { SetFlagLocations(); freezeTime -= deltaTime.Seconds; if (freezeTime <= 0) { foreach (QuizButton b in buttons) { b.Selectable = true; b.Hoverable = true; } freezeTime = 0; NextFlag(); } } foreach (QuizButton b in buttons) { b.Update(deltaTime); } tracker.Update(deltaTime); scoreAddLabel.Update(deltaTime); Draw(); }
public override void Update(DeltaTime deltaTime) { if (IsCurrentState && spawnCountdown > 0) { spawnCountdown -= deltaTime.Seconds; if (spawnCountdown <= 0 && boats.Count < maxBoats) { AddBoat(); } } water.Update(deltaTime); scoreAddLabel.Update(deltaTime); if (IsCurrentState) { Time -= deltaTime.Milliseconds; } if (Time <= 0) { Time = 0; if (!ending) { EndQuiz(); } } SetTimeLabel(); foreach (Boat boat in boats) { boat.Update(deltaTime, water, boatSpeed); if (boat.OutOfBounds) { deadBoats.Add(boat); } } foreach (Boat dead in deadBoats) { if (dead.CurrentBlock != null) { dead.CurrentBlock.Disable(); } if (!dead.Answered) { ScoreBoat(dead); } boats.Remove(dead); if (spawnCountdown <= 0) { spawnCountdown = maxBoatSpawnDelay; } } deadBoats.Clear(); foreach (AnswerBlock block in blocks) { block.Update(deltaTime); } Draw(); }