コード例 #1
0
        public bool shoot(Game1WithoutKinect.Direction dir)
        {
            if (MyPlayer.getArrows() >= 1)
            {
                Room NextRoom = MyCave.getConnectedRooms(MyMap.getPlayerRoom().getDecimalForm())[(int)(dir)];
                MyPlayer.setArrows(MyPlayer.getArrows() - 1);
                if (NextRoom != null)
                {
                    won = MyMap.ShootArrow(NextRoom);
                    if (won)
                    {
                        GameState = Gstate.EndGame;
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public bool ShootArrow(int roomNumber)
 {
     // check if have arrow
     // check if can shoot arrow in that room (to test for errors, basically)
     // updates "won" variable if roomNumber == wumpus;
     if (p.getArrows() < 1)
     {
         // print error
     }
     else if (roomNumber == wumpusRoomInt)
     {
         p.setArrows(p.getArrows() - 1);
         won = true;
     }
     else
     {
         p.setArrows(p.getArrows() - 1);
         // print message & access trivia
     }
     return(won);
 }