public void Update() { if (State != AnimationState.IsPlaying) { return; } switch (stage) { case stage1: if (!mario_.IsInAir) { mario_.Velocity = new Vector2(0, 0); mario_.Acceleration = new Vector2(0, GameData.Gravity); } if (flag_.Location.Y >= GameData.flagPoleBottomY) { flag_.Velocity = new Vector2(0, 0); flag_.Location = new Vector2(flag_.Location.X, GameData.flagPoleBottomY); } if (!mario_.IsInAir && flag_.Location.Y == GameData.flagPoleBottomY) { stage++; } break; case stage2: mario_.State.RunRight(); if (mario_.Destination.X >= 215 * 16) { mario_.State.RunLeft(); mario_.State.StateSprite = ItemSpriteFactory.Instance.CreateDisappearedSprite(); stage++; } break; case stage3: if (MarioInfo.Time == minTime) { stage++; } else { counter++; if (counter == maxCount) { ScoringSystem.AddPointsForRestTime(); MarioInfo.Time--; counter = minCount; } } break; default: if (Game1.State.Type == GameStates.LevelComplete) { Game1.State.Proceed(); } break; } }