public WallSet( Vector2 origin)
        {
            RoomWalls = new XNACS1Rectangle[4];

            roomMin = origin;

            roomMax = new Vector2(origin.X  + 100f, origin.Y + (9f/16f)*100f);
            allWalls = new XNACS1PrimitiveSet();
            InitializeWalls();
            allWalls.RemoveAllFromAutoDrawSet();
        }
        int y; //location of the room in y

        #endregion Fields

        #region Constructors

        public Room(ref StreamReader m, int xCoord, int yCoord)
        {
            x = xCoord;
            y = yCoord;

            roomOrigin = new Vector2((float)xCoord * 100f, (float)yCoord * ((9f / 16f) * 100f));
            backGround = new XNACS1Rectangle(new Vector2(roomOrigin.X + 50f, roomOrigin.Y + 50 * (9f / 16f)), 100f, 100f * (9f / 16f), "bg1");
            walls = new WallSet(roomOrigin);

            hasStairs = Convert.ToInt32(m.ReadLine());
            numDoors = Convert.ToInt32(m.ReadLine());
            myDoors = new Doors[numDoors];
            numEnemies = Convert.ToInt32(m.ReadLine());

            if (hasStairs == 1) {
                float stairX = (float)Convert.ToDouble(m.ReadLine());
                float stairY = (float)Convert.ToDouble(m.ReadLine());
                stairs = new Stair(new Vector2(stairX + roomOrigin.X, stairY + roomOrigin.Y));
            }

            activeEnemies = numEnemies;
            myEnemies = new Enemy[numEnemies];
            roomObjects = new XNACS1PrimitiveSet();

            coord = new Vector2((float)x, (float)y);

            for (int i = 0; i < numEnemies; i++) {
                float posX = (float)Convert.ToDouble(m.ReadLine()) + roomOrigin.X;
                string line = m.ReadLine();
                float posY = (float)Convert.ToDouble(line) + roomOrigin.Y;
                myEnemies[i] = new Enemy(new Vector2(posX, posY), "guard");
                roomObjects.AddToSet(myEnemies[i]);
            }

            for (int i = 0; i < numDoors; i++) {
                //takes in the origin of the room and the door type
                myDoors[i] = new Doors(roomOrigin, coord, m.ReadLine());
                roomObjects.AddToSet(myDoors[i]);
            }

            roomObjects.RemoveAllFromAutoDrawSet();

            wand = new Wand();
        }
        int y; //location of the room in y

        #endregion Fields

        #region Constructors

        public Room(ref StreamReader m, int xCoord, int yCoord)
        {
            x = xCoord;
            y = yCoord;

            roomOrigin = new Vector2((float)xCoord * 100f, (float)yCoord * ((9f / 16f) * 100f));
            walls = new WallSet(roomOrigin);

            numDoors = Convert.ToInt32(m.ReadLine());
            myDoors = new Doors[numDoors];

            numEnemies = Convert.ToInt32(m.ReadLine());
            activeEnemies = numEnemies;
            myEnemies = new Enemy[numEnemies];
            //line = m.ReadLine();
            //isVisited = Convert.ToBoolean(line);

            //line = m.ReadLine();
            //hasStairs = Convert.ToBoolean(line);
            roomObjects = new XNACS1PrimitiveSet();

            coord = new Vector2((float)x, (float)y);

            for (int i = 0; i < numEnemies; i++) {
                float posX = Convert.ToInt64(m.ReadLine()) + roomOrigin.X;
                float posY = Convert.ToInt64(m.ReadLine()) + roomOrigin.Y;
                myEnemies[i] = new Enemy(new Vector2(posX, posY), "guard");
                roomObjects.AddToSet(myEnemies[i]);
            }

            for (int i = 0; i < numDoors; i++) {
                //takes in the origin of the room and the door type
                myDoors[i] = new Doors(roomOrigin, coord, m.ReadLine());
                roomObjects.AddToSet(myDoors[i]);
            }

            roomObjects.RemoveAllFromAutoDrawSet();

            wand = new Wand();
        }
Exemple #4
0
        public Room(ref StreamReader m, int xCoord, int yCoord)
        {
            x = xCoord;
            y = yCoord;

            triggerPressed = false;
            roomOrigin = new Vector2((float)xCoord * 100f, (float)yCoord * ((9f / 16f) * 100f));
            backGround = new XNACS1Rectangle(new Vector2(roomOrigin.X + 50f, roomOrigin.Y + 50 * (9f / 16f)), 100f, 100f * (9f / 16f), "dungeonFloor");
            walls = new WallSet(roomOrigin);

            hasStairs = Convert.ToInt32(m.ReadLine());
            numDoors = Convert.ToInt32(m.ReadLine());
            myDoors = new Doors[numDoors];
            numEnemies = Convert.ToInt32(m.ReadLine());
            numKnights = Convert.ToInt32(m.ReadLine());
            roomObjects = new XNACS1PrimitiveSet();
            isAlive = false;
            heroCaught = false;

            if (hasStairs == 1) {
                float stairX = (float)Convert.ToDouble(m.ReadLine());
                float stairY = (float)Convert.ToDouble(m.ReadLine());
                stairs = new Stair(new Vector2(stairX + roomOrigin.X, stairY + roomOrigin.Y));
                roomObjects.AddToSet(stairs);

                float badGuyX = (float)Convert.ToDouble(m.ReadLine());
                float badGuyY = (float)Convert.ToDouble(m.ReadLine());
                badGuy = new Wizard(new Vector2(badGuyX + roomOrigin.X, badGuyY + roomOrigin.Y));

                roomObjects.AddToSet(badGuy);
                hasWon = false;
            }

            activeEnemies = numEnemies;
            myEnemies = new Enemy[numEnemies];
            numGuards = numEnemies - numKnights;
            coord = new Vector2((float)x, (float)y);

            for (int i = 0; i < numGuards; i++) {
                float posX = (float)Convert.ToDouble(m.ReadLine()) + roomOrigin.X;
                string line = m.ReadLine();
                float posY = (float)Convert.ToDouble(line) + roomOrigin.Y;
                myEnemies[i] = new Guard(new Vector2(posX, posY));
                roomObjects.AddToSet(myEnemies[i]);
            }

            for (int i = numGuards; i < numEnemies; i++) {
                float posX = (float)Convert.ToDouble(m.ReadLine()) + roomOrigin.X;
                string line = m.ReadLine();
                float posY = (float)Convert.ToDouble(line) + roomOrigin.Y;
                myEnemies[i] = new Knight(new Vector2(posX, posY));
                roomObjects.AddToSet(myEnemies[i]);
            }

            for (int i = 0; i < numDoors; i++) {
                //takes in the origin of the room and the door type
                myDoors[i] = new Doors(roomOrigin, coord, m.ReadLine());
                roomObjects.AddToSet(myDoors[i]);
            }

            roomObjects.RemoveAllFromAutoDrawSet();

            wand = new Wand();
        }