/// <summary>Processes the entities.</summary> /// <param name="entities">The entities.</param> protected override void ProcessEntities(IDictionary <int, Entity> entities) { Bag <Entity> bullets = this.EntityWorld.GroupManager.GetEntities("BULLETS"); Bag <Entity> ships = this.EntityWorld.GroupManager.GetEntities("SHIPS"); if (bullets != null && ships != null) { ///being brutal !!! for (int shipIndex = 0; ships.Count > shipIndex; ++shipIndex) { Entity ship = ships.Get(shipIndex); for (int bulletIndex = 0; bullets.Count > bulletIndex; ++bulletIndex) { Entity bullet = bullets.Get(bulletIndex); if (this.CollisionExists(bullet, ship)) { TransformComponent bulletTransform = bullet.GetComponent <TransformComponent>(); Entity bulletExplosion = this.EntityWorld.CreateEntityFromTemplate(BulletExplosionTemplate.Name); bulletExplosion.GetComponent <TransformComponent>().Position = bulletTransform.Position; bulletExplosion.Refresh(); bullet.Delete(); HealthComponent healthComponent = ship.GetComponent <HealthComponent>(); healthComponent.AddDamage(4); if (!healthComponent.IsAlive) { TransformComponent shipTransform = ship.GetComponent <TransformComponent>(); Entity shipExplosion = this.EntityWorld.CreateEntityFromTemplate(ShipExplosionTemplate.Name); shipExplosion.GetComponent <TransformComponent>().Position = shipTransform.Position; shipExplosion.Refresh(); ship.Delete(); break; } } } } } }