示例#1
0
        public Vector2 updateRoom(Hero hero)
        {
            walls.UpdateWallCollisionWithHero(hero);
            XNACS1Base.EchoToTopStatus("num of enemy" + activeEnemies);
            for (int i = 0; i < myEnemies.Length; i++)
            {
                myEnemies[i].UpdateEnemy(hero, walls);
                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }
            //note to self: work on trigger
            if (XNACS1Base.GamePad.ButtonXClicked())
            {
                wand.Shoot(hero);
            }


            dropPos = wand.Update(myEnemies);
            if (dropPos.X > -1)
            {
                reduceActiveEnemies();
            }

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


            if (key != null)
            {
                if (hero.Collided(key))
                {
                    openAllDoors();
                    key.RemoveFromAutoDrawSet();
                }

                if (myDoors[0].isOpen() && key != null)
                {
                    key.RemoveFromAutoDrawSet();
                }
            }
            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);
        }
        public Vector2 updateRoom(Hero hero)
        {
            walls.UpdateWallCollisionWithHero(hero);

            for (int i = 0; i < myEnemies.Length; i++)
            {
                myEnemies[i].UpdateEnemy(hero, walls);
                walls.UpdateWallCollisionWithEnemy(myEnemies[i]);
            }
            //note to self: work on trigger
            if (XNACS1Base.GamePad.ButtonXClicked())
            {
                wand.Shoot(hero);
            }

            for (int i = 0; i < numEnemies; i++)
            {
                dropPos = wand.Update(myEnemies[i]);
                if (dropPos.X > -1)
                {
                    reduceActiveEnemies();
                }
            }

            if (key != null)
            {
                if (hero.Collided(key))
                {
                    openAllDoors();
                    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);
        }
示例#3
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);
        }