示例#1
0
        public override void Update(GameTime gameTime)
        {
            foreach (HealthPotion HP in HealthPotion.hpList)
            {
                HP.Update(gameTime, player, boxCollider);
            }
            player.Update(gameTime, boxCollider);
            camera.LookAt(player.Position);//update camera
            healthBar.Update(gameTime, camera.Position, player);
            healthBarBoss.Update(gameTime, camera.Position, boss);
            foreach (Background b in backgrounds)
            {
                b.Update(gameTime, camera);                                    //update map
            }
            torch1.Update(gameTime, player);
            torch2.Update(gameTime, player);

            foreach (Phantom phantom in phantomList)
            {
                if (phantom.IsAlive)
                {
                    phantom.Update(gameTime, player, Content);
                }
            }
            if (Phantom.CountPhantomExist < 2)
            {
                phantomList.Add(new Phantom(Content));
            }
            if (boss.IsAlive)
            {
                boss.Update(gameTime, player, Content);
            }
            if (!player.IsActive) //màn hình thua xuất hiện
            {
                ScreenState = State.Lose;
            }
            else if (!boss.IsAlive) ///màn hình win xuất hiện
            {
                ScreenState = State.Win;
            }
        }
示例#2
0
        public override void Update(GameTime gameTime)
        {
            foreach (HealthPotion HP in HealthPotion.hpList)
            {
                HP.Update(gameTime, player, boxCollider);
            }

            foreach (Zombie zombie in zombiesList)
            {
                if (zombie.IsAlive)
                {
                    zombie.Update(gameTime, player, Content);
                }
            }
            foreach (Gargoyle gargoyle in gargoyleList)
            {
                if (gargoyle.IsAlive)
                {
                    gargoyle.Update(gameTime, player, Content);
                }
            }
            foreach (Skeleton skeleton in skeletonList)
            {
                if (skeleton.IsAlive)
                {
                    skeleton.Update(gameTime, player, Content);
                }
            }
            foreach (SkeletonZombie skezom in skeletonzombieList)
            {
                if (skezom.IsAlive)
                {
                    skezom.Update(gameTime, player, Content);
                }
            }

            foreach (FireTrap f in fireTraps)
            {
                f.Update(gameTime, player);                                  //update fire trap
            }
            foreach (CampFireTrap c in campfireTraps)
            {
                c.Update(gameTime, player);                                      //update campfire trap
            }
            foreach (Spear s in spearTraps)
            {
                s.Update(gameTime, player);
            }
            foreach (SpearV sV in spearVTraps)
            {
                sV.Update(gameTime, player);
            }
            foreach (SpearH sH in spearHTraps)
            {
                sH.Update(gameTime, player);
            }

            player.Update(gameTime, boxCollider);
            camera.LookAt(player.Position);
            healthBar.Update(gameTime, camera.Position, player);
            foreach (Background b in backgrounds)
            {
                b.Update(gameTime, camera);                                    //update map
            }
            portal.Update(gameTime, player);
            pumpkin.Update(gameTime);
            if (!player.IsActive)
            {
                ScreenState = State.Lose;
            }
        }