private void Construct(PlayerModel playerModel, GameOverModel gameOverModel, RoadModel roadModel, QuadTools quadTools) { _roadModel = roadModel; _playerModel = playerModel; _gameOverModel = gameOverModel; _quadTools = quadTools; }
public GameOverController(GameOverModel model, GameOverView view) { _model = model; _view = view; RegisterController(); }
public GameOverState(StateMachine stateMachine) : base(stateMachine) { _spriteBatch = new SpriteBatch(StateMachine.Game.GraphicsDevice); _view = new GameOverView(StateMachine.Game.Content, _spriteBatch); _model = new GameOverModel(); _controller = new GameOverController(_model); }
public GameOverState(StateMachine stateMachine) : base(stateMachine) { _spriteBatch = new SpriteBatch(StateMachine.Game.GraphicsDevice); _model = new GameOverModel(); _view = new GameOverView(StateMachine.Game.Content, _spriteBatch, _model); _controller = new GameOverController(_model, stateMachine); _music = StateMachine.Game.Content.Load <Song>("mainmenu"); }
private async Task CreateGameOverMVCAsync() { GameOverModel gameOverModel = GameOverFactory.Instance.CreateGameOverModel(); GameOverView gameOverView = await GameOverFactory.Instance.CreateGameOverView(_view.GameAreaView); _gameOverController = GameOverFactory.Instance.CreateGameOverController(gameOverModel, gameOverView); _gameOverController.Initialize(); TimeFinish += _gameOverController.OnTimeFinish; }
public GameOverController() : base(ControllerNames.GameOver) { var gameOverModel = new GameOverModel(); gameOverButton = new GameOverButton(); gameOverModel.GameOverDialog = new GameOverDialogModel(); gameOverModel.GameOverButton = gameOverButton; renderer = new GameOverRenderer(gameOverModel); }
public async Task <GameOverModel> IsGameOver() { GameOverModel result = new GameOverModel { IsGameOver = false }; if (Players.Any(x => x.HasPlayerWon())) { result.IsGameOver = true; result.Player = Players.Where(x => x.HasPlayerWon()).First(); } return(await Task.FromResult(result)); }
public async Task IsGameOver_retrunsFalse() { //Arrange var expected = new GameOverModel { IsGameOver = false, }; //Act var actual = await _state.IsGameOver(); //Assert actual.IsGameOver.Should().BeFalse(); actual.Player.Should().BeNull(); }
public async Task IsGameOver_retrunsTrue() { //Arrange _skilled.Setup(x => x.HasPlayerWon()).Returns(true); var expected = new GameOverModel { IsGameOver = false, Player = _skilled.Object }; //Act var actual = await _state.IsGameOver(); //Assert actual.IsGameOver.Should().BeTrue(); actual.Player.Should().Be(expected.Player); }
void CheckForEnemyHits() { List <GameModelBase> enemyItems = GameModels.Where(x => x.ModelType == GameModelType.Enemy || x.ModelType == GameModelType.EnemyBomb).ToList(); //List all current enemy items. Rectangle playerRect = player.CollisionRectangle; //Copy the player rectangle. var killer = enemyItems.FirstOrDefault(x => playerRect.IntersectsWith(x.CollisionRectangle)); //check if any enemy item rectanles intersects with player rectangle. if (killer != null) { CreateExplosion(player); GameModels.Remove(killer); GameModels.Remove(player); GameInfo.Lives--; if (GameInfo.Lives == 0) { GameState = GameState.GameOverInProgress; GameOverModel gameOverModel = new GameOverModel(); gameOverModel.GameOverTime = DateTime.Now; GameInfo.EndTime = gameOverModel.GameOverTime; gameOverModel.Height = 200; gameOverModel.Width = 200; gameOverModel.X = WindowWidth / 2 - gameOverModel.Width / 2; gameOverModel.Y = WindowHeight / 2 - gameOverModel.Height / 2; audioController.PlayGameOver(); GameModels.Add(gameOverModel); } else { GameState = GameState.LifeLost; LifeLostModel lifeLostModel = new LifeLostModel(); lifeLostModel.LifeLostTime = DateTime.Now; lifeLostModel.Height = 200; lifeLostModel.Width = 200; lifeLostModel.X = WindowWidth / 2 - lifeLostModel.Width / 2; lifeLostModel.Y = WindowHeight / 2 - lifeLostModel.Height / 2; GameModels.Add(lifeLostModel); } } }
public GameOverRenderer(GameOverModel model) { goModel = model; tHelper = TextureHelper.GetInstance(); }
private void Construct(GameOverModel gameOverModel) { _gameOverModel = gameOverModel; }
public GameOverView(ContentManager contentManager, SpriteBatch spriteBatch, GameOverModel gameOverModel) : base(contentManager, spriteBatch) { _gameFont = contentManager.Load <SpriteFont>("File"); _spriteBatch = spriteBatch; _gameOverModel = gameOverModel; }
public GameOverController CreateGameOverController(GameOverModel gameOverModel, GameOverView gameOverView) { return(new GameOverController(gameOverModel, gameOverView)); }
public GameOverController(GameOverModel gameOverModel, StateMachine stateMachine) { _gameOverModel = gameOverModel; _stateMachine = stateMachine; }
public GameOverController(GameOverModel model) { _model = model; }