コード例 #1
0
ファイル: Room.cs プロジェクト: abflin2/Princess_Penny_Game
        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();
        }
コード例 #2
0
 public void updateWizardStats(Wizard wiz)
 {
     right.Label = "Wizard Health: " + wiz.healthRemaining;
     right.LabelColor = Color.White;
 }
コード例 #3
0
ファイル: Room.cs プロジェクト: abflin2/Princess_Penny_Game
        public void deleteRoom()
        {
            roomObjects.RemoveAllFromSet();
            myDoors = null;
            myEnemies = null;
            walls = null;
            stairs = null;
            key = null;
            if (backGround != null)
                backGround.RemoveFromAutoDrawSet();
            backGround = null;

            badGuy = null;
        }
コード例 #4
0
 public void updateWizardStats(Wizard wiz)
 {
     right.Label      = "Wizard Health: " + wiz.healthRemaining;
     right.LabelColor = Color.White;
 }