private void AddTrap() { Coordinate pos = _gameArea.GetEmptyPosition(); var newTrap = new TrapCell(pos); _gameArea.AddCell(newTrap); }
private void Populate(int rows, int columns, IList<string> contentRows) { Board = new Delegate[rows, columns]; for (int rowIndex = 0; rowIndex < contentRows.Count(); rowIndex++) { var elementsInRow = contentRows[rowIndex].Split(' '); for (int columnIndex = 0, col = 0; columnIndex < elementsInRow.Count(); columnIndex++) { switch (elementsInRow[columnIndex]) { case "D": var deltaX = Convert.ToInt32(elementsInRow[++columnIndex]); var deltaY = Convert.ToInt32(elementsInRow[++columnIndex]); Board[rowIndex, col++] = new DisplacementCell( current => new Tuple<int, int>(Math.Abs(current.Item1 + deltaX)% rows, Math.Abs(current.Item2 + deltaY)% columns)); break; case "T": Board[rowIndex, col++] = new TrapCell( current => current); break; case "G": Board[rowIndex, col++] = new GoldCell( current => Console.Out.WriteLine("GAME OVER")); break; } } } }
public void TestInit() { Black.Reset(); pirate = Black.Pirate; pirate2 = Black.Pirate2; trapCell = new TrapCell(1, 1); }
public void TestInit() { trapCell = new TrapCell(1, 1); }