public PieceSprite(Texture2D textureImage, Vector2 position, Point frameSize, int collisionOffset,
     Point currentFrame, Point sheetSize, Vector2 speed, SpriteFont font, Room room)
     : base(textureImage, position, frameSize, collisionOffset, currentFrame, sheetSize,
     speed, null, font)
 {
     this.room = room;
 }
Beispiel #2
0
 public WGame(Game game)
 {
     this.game = game;
     board = new Board();
     status = "Start";
     turn = "wumpus";
     bumped = false;
     prevRoom = Board.Player.Room;
 }
Beispiel #3
0
 // All parameters with default values
 public Room(int room, Room[] adjRooms = null, bool player = false, bool wumpus = false, 
     Hazard hazard = null)
 {
     roomNumber = room;
     adjacentRooms = adjRooms;
     this.player = player;
     this.wumpus = wumpus;
     this.hazard = hazard;
 }
Beispiel #4
0
        // Start room
        public Player(Room start)
        {
            room = start;

            arrows = new Arrow[]{
                new Arrow(),
                new Arrow(),
                new Arrow(),
                new Arrow(),
                new Arrow()
            };
        }
Beispiel #5
0
        /******************************************************************************************
         * Constructors
         *****************************************************************************************/
        // No parameters
        public Player()
        {
            room = null;

            arrows = new Arrow[]{
                new Arrow(),
                new Arrow(),
                new Arrow(),
                new Arrow(),
                new Arrow()
            };
        }
Beispiel #6
0
        public static void gameStatus()
        {
            // Only update the status if the player moves
            if (Board.Player.Room != prevRoom)
            {
                // Set previous room to current room
                prevRoom = Board.Player.Room;

                // Wumpu's turn
                turn = "Wumpus";

                // Did the player bump the Wumpus
                if (bumped && Board.Wumpus.Room.Number == Board.Player.Room.Number)
                {
                    status = "Eaten";
                }
                else if (!bumped && Board.Wumpus.Room.Number == Board.Player.Room.Number)
                {
                    status = "Bumped";
                    bumped = true;
                    Board.Wumpus.Awake = true;
                }
                // Did the player fall into a pit?
                else if (Board.Player.Room.Hazard != null)
                {
                    if (Board.Player.Room.Hazard.Type == "pit")
                    {
                        status = "Pit";
                    }
                }
                // Room is empty
                else
                {
                    status = "Play";
                }
            }
            // Did a Superbat moved the player
            else if (Board.RandomMove)
            {
                Board.RandomMove = false;
                status = "Superbat";
            }
        }
Beispiel #7
0
 /******************************************************************************************
  * Constructors
  *****************************************************************************************/
 // No parameters
 public Hazard()
 {
     room = null;
     type = "None";
 }
Beispiel #8
0
 // Start room and arrows
 public Player(Room start, Arrow[] arrows)
 {
     room = start;
     this.arrows = arrows;
 }
Beispiel #9
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;
        }
Beispiel #10
0
 /******************************************************************************************
  * Move Player
  *
  * @property rooms - Array of rooms to send to trajectory
  *
  * Sets the room room for the player to the Room object in the map corresponding to
  * the integer room number entered.
  *****************************************************************************************/
 public void move(int roomNumber)
 {
     room = Board.Map[roomNumber];
 }
Beispiel #11
0
 /******************************************************************************************
  * Constructors
  *****************************************************************************************/
 //No parameters
 public Wumpus()
 {
     room = null;
     awake = false;
     alive = true;
 }
Beispiel #12
0
 // Trajectory
 public Arrow(Room[] traj)
 {
     trajectory = traj;
     shot = true;
     killWumpus = false;
 }
Beispiel #13
0
 // Room and Sleep state
 public Wumpus(Room room, bool state)
 {
     this.room = room;
     awake = state;
     alive = true;
 }
Beispiel #14
0
 // Room
 public Wumpus(Room room)
 {
     this.room = room;
     awake = false;
     alive = true;
 }
Beispiel #15
0
 // Type
 public Hazard(string type)
 {
     room = null;
     this.type = type;
 }
Beispiel #16
0
 // Type and room
 public Hazard(string type, Room room)
 {
     this.type = type;
     this.room = room;
 }
Beispiel #17
0
        /******************************************************************************************
         * Move Wumpus
         *
         * @property random - Random number generator
         *
         * Once awake, the Wumpus has a 75% chance of moving each turn
         *****************************************************************************************/
        public void move()
        {
            Random random = new Random();

            // Move Wumpus
            if (random.Next(1, 100) >= 25)
            {
                Room oldRoom = room;
                room = room.randomRoom();
                oldRoom.Wumpus = false;
                room.Wumpus = true;
            }

            // Check to see if killed player
            if (room.Number == Board.Player.Room.Number)
            {
                Board.Player.Alive = false;
            }
        }