public Character(IConsoleOutputService consoleOut, ISoundPlayerService soundPlayer) { this.consoleOut = consoleOut; this.soundPlayer = soundPlayer; this.health = 100; this.pos = GameBoard.Position.Undefined; this.inventory = new ObservableCollection <InventoryItem>(); }
/// <summary> /// Applies an action to each <see cref="GameBoard.Position"/> /// on the <see cref="GameBoard"/>. /// </summary> /// <param name="actor"> /// Action to apply. /// </param> public void ForeachPosition(Action <GameBoard.Position> actor) { for (int row = 0; row < this.RowCount; row++) { for (int col = 0; col < this.ColumnCount; col++) { var pos = new GameBoard.Position(row, col); actor(pos); } } }
public Portal(IUserPromptService userPrompt, string name, string description, GameBoard.Position destination, Password pwd, int maxAttempts) { this.userPrompt = userPrompt; this.Name = name; this.desc = description; this.destination = destination; this.pwd = pwd; this.maxAttempts = maxAttempts; }
BoolMessageResult IMovePlayer.MoveTo(GameBoard.Position pos) { if (pos.IsUndefined) { // Undefined means exit the game this.player.Position = GameBoard.Position.Undefined; } else { this.player.Position = pos; this.OnPlayerPositionChanged(); } return(new BoolMessageResult(true, "Zap!")); }