예제 #1
0
        public virtual void Update()
        {
            if (!hero.dead)
            {
                hero.Update(offset);

                for (int i = 0; i < spawnPoints.Count; i++)
                {
                    spawnPoints[i].Update(offset);
                }

                for (int i = 0; i < projectiles.Count; i++)
                {
                    projectiles[i].Update(offset, mobs.ToList <Unit>());

                    if (projectiles[i].done)
                    {
                        projectiles.RemoveAt(i);
                        i--;
                    }
                }

                for (int i = 0; i < mobs.Count; i++)
                {
                    mobs[i].Update(offset, hero);

                    if (mobs[i].dead)
                    {
                        numKilled++;
                        mobs.RemoveAt(i);
                        i--;
                    }
                }
            }
            else
            {
                if (Globals.keyboard.GetPress("Enter"))
                {
                    resetWorld(null);
                }
            }


            ui.Update(this);
        }
예제 #2
0
파일: Player.cs 프로젝트: RIProG/MonoGames
        public virtual void Update(Player ENEMY, Vector2 OFFSET)
        {
            if (hero != null)
            {
                hero.Update(OFFSET);
            }

            for (int i = 0; i < spawnPoints.Count; i++)
            {
                spawnPoints[i].Update(OFFSET);

                if (spawnPoints[i].dead)
                {
                    spawnPoints.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < units.Count; i++)
            {
                units[i].Update(OFFSET, ENEMY);

                if (units[i].dead)
                {
                    ChangeScore(1);
                    units.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < buildings.Count; i++)
            {
                buildings[i].Update(OFFSET, ENEMY);

                if (buildings[i].dead)
                {
                    ChangeScore(1);
                    buildings.RemoveAt(i);
                    i--;
                }
            }
        }
예제 #3
0
 public virtual void Update()
 {
     hero.Update();
 }