Ejemplo n.º 1
0
        private void CleanupDeletedEntities()
        {
            if (QueuedForDisposal.Count > 0)
            {
                foreach (CharacterEntity entity in QueuedForDisposal)
                {
                    entity.DynamicBody.Enabled = false;
                    entity.DynamicBody.Dispose();
                    ActiveEntities.Remove(entity);

                    EnemyEntity enemy = entity as EnemyEntity;
                    if (enemy != null)
                    {
                        Enemies.Remove(enemy);
                    }
                    else
                    {
                        EggEntity egg = entity as EggEntity;
                        if (egg != null)
                        {
                            Eggs.Remove(egg);
                        }
                    }
                }
                QueuedForDisposal.Clear();
            }
        }
Ejemplo n.º 2
0
        public EggEntity AddEgg(Vector2 pos)
        {
            _eggCounterCurrent++;

            EggEntity egg =
                new EggEntity(this, Clips["egg"], pos);

            egg.DynamicBody.LinearDamping = 5f;
            Eggs.Add(egg);
            QueuedForCreation.Add(egg);
            return(egg);
        }
Ejemplo n.º 3
0
        public void DestroyEgg(EggEntity egg)
        {
            egg.IsValid = false;

            QueuedForDisposal.Add(egg);
        }
Ejemplo n.º 4
0
        public EggEntity AddEgg(Vector2 pos)
        {
            _eggCounterCurrent++;

            EggEntity egg =
                new EggEntity(this, Clips["egg"], pos);
            egg.DynamicBody.LinearDamping = 5f;
            Eggs.Add(egg);
            QueuedForCreation.Add(egg);
            return egg;
        }
Ejemplo n.º 5
0
        public void DestroyEgg(EggEntity egg)
        {
            egg.IsValid = false;

            QueuedForDisposal.Add(egg);
        }