public Coral(Vector2 position) { StateMachine = new CoralState(); BlockPhysics = new BlockPhysics(position); Collided = false; Broken = false; }
public static string GetCoralString(CoralState coralState) { switch (coralState) { case CoralState.good: return("good"); case CoralState.bad: return("bad"); case CoralState.worse: return("worse"); default: return("good"); } }
/* Coral */ private void UpdateCoralTimedData(object sender, ElapsedEventArgs e) { TimeSpan timeCoralElapsed = e.SignalTime - timeKeeperCoral.StartTime; CoralState newCoralState = corals.CurrentCoralState; if (timeCoralElapsed.TotalSeconds < 20) { fish.FadeTo(1, 500, Easing.Linear); fish2.FadeTo(1, 500, Easing.Linear); } /* Timer statement to display state */ if (timeCoralElapsed.TotalSeconds < 30) { newCoralState = CoralState.good; fish.FadeTo(1, 500, Easing.Linear); } else if (timeCoralElapsed.TotalSeconds < 40) { newCoralState = CoralState.bad; fish.FadeTo(0, 500, Easing.Linear); } else if (timeCoralElapsed.TotalSeconds >= 60) { newCoralState = CoralState.worse; fish2.FadeTo(0, 500, Easing.Linear); } /* Update state */ if (newCoralState != corals.CurrentCoralState) { corals.CurrentCoralState = newCoralState; updateCoralUI(); } }