public void Update() { if (GameUtilities.Game.State.Type == GameStates.GameOver) { count--; if (count == 0) { Game1 game = (Game1)GameUtilities.Game; game.Reset(); game.State.Proceed(); MarioAttributes.MarioLife[GameUtilities.Player1] = GameUtilities.MarioInitalLife; MarioAttributes.UpdateHighestScore(); CoinSystem.Instance.ResetCoin(); ScoringSystem.Player1Score.ResetScore(); MarioAttributes.ClearTimer(); } } }
public void Update() { if (State != AnimationState.IsPlaying) { return; } switch (stage) { case stage1: if (!mario_.IsInAir) { mario_.Velocity = new Vector2(GameUtilities.StationaryVelocity, GameUtilities.StationaryVelocity); mario_.Acceleration = new Vector2(GameUtilities.StationaryAcceleration, GameUtilities.Gravity); } if (flag_.Location.Y >= GameUtilities.VictoryAnimationGround * GameUtilities.BlockSize) { flag_.Velocity = new Vector2(GameUtilities.StationaryVelocity, GameUtilities.StationaryVelocity); flag_.Location = new Vector2(flag_.Location.X, GameUtilities.VictoryAnimationGround * GameUtilities.BlockSize); } if (!mario_.IsInAir && flag_.Location.Y == GameUtilities.VictoryAnimationGround * GameUtilities.BlockSize) { stage++; } break; case stage2: mario_.State.ChangeToRight(); if (mario_.Destination.X >= GameUtilities.castleGate * GameUtilities.BlockSize) { mario_.State.ChangeToLeft(); mario_.State.StateSprite = BlockSpriteFactory.Instance.CreateHiddenBlockSprite(); stage++; } break; case stage3: if (MarioAttributes.Time == minTime) { stage++; } else { counter++; if (counter == maxCount) { ScoringSystem.Player1Score.AddPointsForRestTime(); MarioAttributes.Time--; counter = minCount; } } break; default: Game1 game = (Game1)GameUtilities.Game; game.Reset(); game.State.Proceed(); MarioAttributes.MarioLife[mario_.Player] = GameUtilities.MarioInitalLife; MarioAttributes.UpdateHighestScore(); CoinSystem.Instance.ResetCoin(); ScoringSystem.Player1Score.ResetScore(); MarioAttributes.ClearTimer(); break; } }