コード例 #1
0
ファイル: Character.cs プロジェクト: jboenig/AdventureGame
 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>();
 }
コード例 #2
0
 /// <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);
         }
     }
 }
コード例 #3
0
 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;
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: jboenig/AdventureGame
        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!"));
        }