Example #1
0
        /**public void AddEnemy(Enemy enemy, int spawnerId) {
         *  Spawner spawner = Spawners.Find(p => p.Id == spawnerId);
         *  spawner.AddEnemy(enemy);
         * }**/

        private void CleanUp()
        {
            //Remove objects outside the screen
            AllDrawableGameObjects.RemoveAll(go => (go.Position.X <0 || go.Position.X> GeneralSettings.screenWidth + go.Width ||
                                                    go.Position.Y <0 || go.Position.Y> GeneralSettings.screenHeight + go.Height));

            //remove killed objts
            AllDrawableGameObjects.RemoveAll(o => o is KillableGameObject && ((KillableGameObject)o).Dead);

            //Remove spawner if all its enemies has spawned
            Spawners.RemoveAll(s => s.Enemies.Count == 0);
        }
Example #2
0
 public void Initialize()
 {
     LevelIntro = new LevelIntro(this);
     AllDrawableGameObjects.AddRange(GameServices.GetService <List <Player> >());
 }