コード例 #1
0
 //logic check after moving - checks player inventory
 //checks for hazards, then updates render
 public InGameRenderInfo moveCheck()
 {
     //ends game if player runs out of gold
     if (player.getGold() < 0)
     {
         endGame(1);
     }
     //ends game if player runs out of arrows
     if (player.getNumOfArrows() <= 0)
     {
         endGame(2);
     }
     //checks for hazards and acts accordingly
     encounterHazard(map.encounterHazard());
     //updates and returns render info
     updateRender();
     return(render);
 }
コード例 #2
0
        /// <summary>
        /// setting gold locations
        /// </summary>
        /// <param name="roomNumber"></param>
        public void updateExploredAndGold(int roomNumber)
        {
            int  gold = r.Next(2) + 3;
            Room rm   = new Room(roomNumber);

            explored.Add(rm);

            if (!explored.Contains(rm))
            {
                p.setGold(p.getGold() + gold);
            }
        }
コード例 #3
0
 public void updateGold(Room room)
 {
     MyPlayer.setGold(MyPlayer.getGold() + MyMap.updateExploredAndReturnGold(room.getIntegerForm()));
 }