public void Update() { if (!this.IsAlive) { return; } this.current = Keyboard.GetState(); if (Serve.CheckKeyBoard(this.current, this.previous, Keys.Space) && !this.IsSpacePressed) { PacmanGame.GameState = GameState.Game; this.IsSpacePressed = true; this.Ready.IsAlive = true; } if (this.IsSpacePressed) { this.Ready.Update(); if (this.Ready.Timer.IsFinished) { Items.Pacman.IsReady = true; this.Ready.Timer.Reset(); this.IsAlive = false; } } this.previous = this.current; }
public override void Update(GameTime gameTime) { if (!this.IsAlive) { return; } this.timer.Update(); if (this.timer.Count <= this.timer.Value) { Items.Pacman.DisableGhosts(); } if (this.timer.Count == 100) { this.draw = true; } if (!this.timer.IsFinished) { return; } PacmanGame.GameState = GameState.End; this.current = Keyboard.GetState(); if (Serve.CheckKeyBoard(this.current, this.previous, Keys.Space)) { PacmanGame.GameState = GameState.Game; Items.Player.Score = 0; Items.Player.Lives = 3; Items.Pacman.IsGameOver = false; Level.Count = 0; Items.Pacman.GhostModeTimer.Reset(); Items.Pacman.ResetLevel(); this.draw = false; this.timer.Reset(); this.IsAlive = false; } this.previous = this.current; }