public void Update() { if (GameUtilities.Game.State.Type == GameStates.CompetitiveEnding) { String winner = ""; if (setWinner) { if (GameUtilities.GameObjectManager.MarioPlayer1.State.MarioShape == MarioState.MarioShapeEnums.Dead && GameUtilities.GameObjectManager.MarioPlayer2.State.MarioShape != MarioState.MarioShapeEnums.Dead) { winner = "PLAYER 2 WINS"; } else if (GameUtilities.GameObjectManager.MarioPlayer1.State.MarioShape != MarioState.MarioShapeEnums.Dead && GameUtilities.GameObjectManager.MarioPlayer2.State.MarioShape == MarioState.MarioShapeEnums.Dead) { winner = "PLAYER 1 WINS"; } else { if (ScoringSystem.Player1Score.Score > ScoringSystem.Player2Score.Score) { winner = "PLAYER 1 WINS"; } else if (ScoringSystem.Player1Score.Score < ScoringSystem.Player2Score.Score) { winner = "PLAYER 2 WINS"; } else { winner = "DRAW"; } } gameOverTextSprite.Text = winner; setWinner = false; } count--; if (count == 0) { Game1 game = (Game1)GameUtilities.Game; game.Reset(); game.State.Proceed(); MarioAttributes.MarioLife[GameUtilities.Player1] = GameUtilities.MarioInitalLife; CoinSystem.Instance.ResetCoin(); ScoringSystem.Player1Score.ResetScore(); ScoringSystem.Player2Score.ResetScore(); MarioAttributes.ClearTimer(); } } }
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; } }