Пример #1
0
        public Vector2 updateRoom(Hero hero, int levelNum)
        {
            heroCaught = false;
            walls.UpdateWallCollisionWithHero(hero);

            for (int i = 0; i < myEnemies.Length; i++) {

                bool temp = myEnemies[i].UpdateEnemy(hero, walls);
                if (temp)
                    heroCaught = temp;

                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }

            walls.updateStatus(hero, levelNum);
            if ((XNACS1Base.GamePad.Triggers.Right > 0 && !triggerPressed) || XNACS1Base.GamePad.ButtonXClicked()) {
                wand.Shoot(hero);
                triggerPressed = true;
            }

            if (XNACS1Base.GamePad.Triggers.Right == 0) {
                triggerPressed = false;
            }

            dropPos = wand.Update(myEnemies, walls);
            if (dropPos.X > -1)
                reduceActiveEnemies();

            //allDone = true;
            //for (int i = 0; i < myEnemies.Length; i++) {
            //    if (!myEnemies[i].isBunny())
            //        allDone = false;

            //}

            if (hasStairs == 1 && badGuy != null) {
                walls.updateWizardStats(badGuy);
                hasWon = badGuy.Update(hero, wand);

                if (hasWon) {
                    stairs.AddToAutoDrawSet();
                    stairs.available = true;
                    openAllDoors();
                }

                if (badGuy.heroHit) {
                    heroCaught = true;
                }

            }

            if (key != null) {
                if (hero.Collided(key)) {
                    openAllDoors();
                    XNACS1Base.PlayACue("door_open");
                    key.RemoveFromAutoDrawSet();
                }

                if (myDoors[0].isOpen() && key != null) {
                    key.RemoveFromAutoDrawSet();
                    key = null;
                }
            }
            Vector2 newRoom = new Vector2(-1f, -1f);
            for (int i = 0; i < numDoors; i++) {

                newRoom = myDoors[i].UpdateDoor(hero);

                if (newRoom.X > 0f)
                    return newRoom;
            }

            return newRoom;
        }
Пример #2
0
 void dropKey()
 {
     if (key == null)
         key = new Key(new Vector2(dropPos.X + 3f, dropPos.Y), 1f, 1f);
 }
Пример #3
0
        public void deleteRoom()
        {
            roomObjects.RemoveAllFromSet();
            myDoors = null;
            myEnemies = null;
            walls = null;
            stairs = null;
            key = null;
            if (backGround != null)
                backGround.RemoveFromAutoDrawSet();
            backGround = null;

            badGuy = null;
        }