protected override void AddUnbreakableWall(Point position) { var unbreakableWall = new UnbreakableWall(position); _unbreakableWallList.Add(unbreakableWall); base.AddUnbreakableWall(unbreakableWall); }
public void UnbreakableWall_GetImageFileName_RightImageName() { var wall = new UnbreakableWall(); wall.GetImageFileName().Should().Be("UnbreakableWall.png"); }
public void Update(GameTime gameTime) { _timer += gameTime.ElapsedGameTime; if (!_hasStarted && _timer >= GameConfiguration.SuddenDeathTimer) { MediaPlayer.Play(_gameRef.GamePlayScreen.MapSongHurry); _hasStarted = true; _timer = TimeSpan.Zero; } if (_hasStarted) { #region Walls // We change sudden death's wall position if (_timer >= _moveTime) { if (!AllVisited()) { _visited[_currentPosition.X, _currentPosition.Y] = true; IEntity entity = _gameRef.GamePlayScreen.World.Levels[_gameRef.GamePlayScreen.World.CurrentLevel]. Board[_currentPosition.X, _currentPosition.Y]; if (entity != null) { if (entity is Player) { entity.Destroy(); List <Player> pl = _gameRef.GamePlayScreen.PlayerList.FindAll( p => p.CellPosition == _currentPosition); foreach (Player p in pl) { p.Destroy(); } } else if (entity is Teleporter || entity is Arrow || entity is Bomb) { List <Player> pl = _gameRef.GamePlayScreen.PlayerList.FindAll( p => p.CellPosition == _currentPosition); foreach (Player p in pl) { p.Destroy(); } List <Bomb> bl = _gameRef.GamePlayScreen.BombList.FindAll( b => b.CellPosition == _currentPosition); foreach (Bomb b in bl) { b.Remove(); } entity.Remove(); } else { entity.Remove(); } } _gameRef.GamePlayScreen.World.Levels[_gameRef.GamePlayScreen.World.CurrentLevel].CollisionLayer[ _currentPosition.X, _currentPosition.Y] = true; var u = new UnbreakableWall(_currentPosition); _gameRef.GamePlayScreen.World.Levels[_gameRef.GamePlayScreen.World.CurrentLevel].Board[ _currentPosition.X, _currentPosition.Y] = u; _gameRef.GamePlayScreen.UnbreakableWallList.Add(u); _timer = TimeSpan.Zero; _previousPosition = _currentPosition; switch (_lookDirection) { case LookDirection.Up: _currentPosition.Y--; if (!_visited[_currentPosition.X, _currentPosition.Y] && _gameRef.GamePlayScreen.World.Levels[_gameRef.GamePlayScreen.World.CurrentLevel]. Board[_currentPosition.X, _currentPosition.Y] is UnbreakableWall) { _visited[_currentPosition.X, _currentPosition.Y] = true; if (_visited[_currentPosition.X, _currentPosition.Y - 1]) { _lookDirection = LookDirection.Right; } else { _currentPosition.Y--; } } if (_visited[_currentPosition.X, _currentPosition.Y - 1]) { _lookDirection = LookDirection.Right; } break; case LookDirection.Down: _currentPosition.Y++; if (!_visited[_currentPosition.X, _currentPosition.Y] && _gameRef.GamePlayScreen.World.Levels[_gameRef.GamePlayScreen.World.CurrentLevel]. Board[_currentPosition.X, _currentPosition.Y] is UnbreakableWall) { _visited[_currentPosition.X, _currentPosition.Y] = true; if (_visited[_currentPosition.X, _currentPosition.Y + 1]) { _lookDirection = LookDirection.Left; } else { _currentPosition.Y++; } } if (_visited[_currentPosition.X, _currentPosition.Y + 1]) { _lookDirection = LookDirection.Left; } break; case LookDirection.Left: _currentPosition.X--; if (!_visited[_currentPosition.X, _currentPosition.Y] && _gameRef.GamePlayScreen.World.Levels[_gameRef.GamePlayScreen.World.CurrentLevel]. Board[_currentPosition.X, _currentPosition.Y] is UnbreakableWall) { _visited[_currentPosition.X, _currentPosition.Y] = true; if (_visited[_currentPosition.X - 1, _currentPosition.Y]) { _lookDirection = LookDirection.Up; } else { _currentPosition.X--; } } if (_visited[_currentPosition.X - 1, _currentPosition.Y]) { _lookDirection = LookDirection.Up; } break; case LookDirection.Right: _currentPosition.X++; if (!_visited[_currentPosition.X, _currentPosition.Y] && _gameRef.GamePlayScreen.World.Levels[_gameRef.GamePlayScreen.World.CurrentLevel]. Board[_currentPosition.X, _currentPosition.Y] is UnbreakableWall) { _visited[_currentPosition.X, _currentPosition.Y] = true; if (_visited[_currentPosition.X + 1, _currentPosition.Y]) { _lookDirection = LookDirection.Down; } else { _currentPosition.X++; } } if (_visited[_currentPosition.X + 1, _currentPosition.Y]) { _lookDirection = LookDirection.Down; } break; } } // Move the map //Engine.Origin = NextMapPosition(); } #endregion } }