public bool MoveNpcLeft(NonPlayableCharacter npc) { var npcPosition = _positionFinder.GetPosition(_gameModel.GetMap, npc); if (_gameModel.GetMap[npcPosition[0], npcPosition[1] - 1].BlowingElement is Flame) { npc.IsAlive = false; return(true); } switch (_gameModel.GetMap[npcPosition[0], npcPosition[1] - 1].MapElement) { case EmptyField _: _gameModel.GetMap[npcPosition[0], npcPosition[1] - 1] = new MapElementContainer(npcPosition[0], npcPosition[1] - 1, npc); _gameModel.GetMap[npcPosition[0], npcPosition[1]] = new MapElementContainer(npcPosition[0], npcPosition[1], new EmptyField()); return(true); case PlayerDto player: player.GotHit(); npc.IsAlive = false; break; } _npcTurner.TurnNpc(npc); return(false); }
public void DropBomb(PlayerDto player) { var playerPos = _positionFinder.GetPosition(_gameModel.GetMap, player); _gameModel.GetMap[playerPos[0], playerPos[1]].BlowingElement = new Bomb(playerPos[0], playerPos[1], player); player.DroppedBomb = (Bomb)_gameModel.GetMap[playerPos[0], playerPos[1]].BlowingElement; }
public void GivenTestMapAndTestPlayer_WhenGetPlayerPosition_ThenReturnsTheCoordinateOfThePlayer() { // Act var result = _positionFinder.GetPosition(_testMap, _testPlayer); // Arrange Check.That(result).ContainsExactly(1, 1); }
public void MoveUp(PlayerDto player) { var playerPos = _positionFinder.GetPosition(_gameModel.GetMap, player); if (!(_gameModel.GetMap[playerPos[0] + 1, playerPos[1]].MapElement is EmptyField)) { return; } _gameModel.GetMap[playerPos[0] + 1, playerPos[1]] = new MapElementContainer(playerPos[0] + 1, playerPos[1], player, _positionFinder.GetBlowingElementFromPosition(_gameModel.GetMap, playerPos[0] + 1, playerPos[1])); _gameModel.GetMap[playerPos[0], playerPos[1]] = new MapElementContainer(playerPos[0], playerPos[1], new EmptyField(), _positionFinder.GetBlowingElementFromPosition(_gameModel.GetMap, playerPos[0], playerPos[1])); }
public Vector2 GetNextPosition() { return(_positionFinder.GetPosition(_positionNumber++)); }
public void DeleteKilledNpc(NonPlayableCharacter npc) { var npcPosition = _positionFinder.GetPosition(_gameModel.GetMap, npc); _gameModel.GetMap[npcPosition[0], npcPosition[1]] = new MapElementContainer(npcPosition[0], npcPosition[1], new EmptyField()); }