Пример #1
0
 // Start room and arrows
 public Player(Room start, Arrow[] arrows)
 {
     room = start;
     this.arrows = arrows;
 }
Пример #2
0
        /******************************************************************************************
         * Shoot Arrow
         *
         * @property rooms - Array of rooms to send to trajectory
         *
         * First convert the integer room numbers to Room objects via the map. Then set the
         * trajectory for the arrow. The arrow will check if it hit the Wumpus and return the
         * result.
         *****************************************************************************************/
        public bool shoot(Arrow arrow, int[] roomNumbers)
        {
            Room[] rooms = new Room[5];

            // Convert each roomNumber into a room
            foreach (int room in roomNumbers)
            {
                rooms[room - 1] = Board.Map[room];
            }

            // Set trajectory (Shoot arrow)
            arrow.Trajectory = rooms;

            // Return whether the arrow killed the Wumpus
            return arrow.KillWumpus;
        }