Example #1
0
        public virtual void Update()
        {
            hero.Update(offset);

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

            // Update for projectiles
            for (int i = 0; i < projectiles.Count; i++)
            {
                projectiles[i].Update(offset, mobs.ToList <Unit>());
                if (projectiles[i].done)
                {
                    projectiles.RemoveAt(i);
                    i--;
                }
            }

            // Update for mobs
            for (int i = 0; i < mobs.Count; i++)
            {
                mobs[i].Update(offset, hero);
                if (mobs[i].dead)
                {
                    mobs.RemoveAt(i);
                    i--;
                }
            }
        }
Example #2
0
        public virtual void Update(Player ENEMY, Vector2 OFFSET)
        {
            if (hero != null)
            {
                hero.Update(OFFSET);
            }

            // could be used as a skill to aid the player like "spawn box with mechs"
            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)
                {
                    // in future killCount should be tightly coupled with a "death animation"
                    ChangeScore(1);
                    units.RemoveAt(i);
                    i--;
                }
            }

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

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