public void ReplaceEnemyPool(DesperateDevs.Utils.ObjectPool <GameEntity> newPool) { var index = GameComponentsLookup.EnemyPool; var component = (EnemyPoolComponent)CreateComponent(index, typeof(EnemyPoolComponent)); component.Pool = newPool; ReplaceComponent(index, component); }
public void ReplaceBulletPool(DesperateDevs.Utils.ObjectPool <GameEntity> newPlayerBulletPool, DesperateDevs.Utils.ObjectPool <GameEntity> newEnemyBulletPool) { var index = GameComponentsLookup.BulletPool; var component = (BulletPoolComponent)CreateComponent(index, typeof(BulletPoolComponent)); component.PlayerBulletPool = newPlayerBulletPool; component.EnemyBulletPool = newEnemyBulletPool; ReplaceComponent(index, component); }
public GameEntity SetBulletPool(DesperateDevs.Utils.ObjectPool <GameEntity> newPlayerBulletPool, DesperateDevs.Utils.ObjectPool <GameEntity> newEnemyBulletPool) { if (hasBulletPool) { throw new Entitas.EntitasException("Could not set BulletPool!\n" + this + " already has an entity with BulletPoolComponent!", "You should check if the context already has a bulletPoolEntity before setting it or use context.ReplaceBulletPool()."); } var entity = CreateEntity(); entity.AddBulletPool(newPlayerBulletPool, newEnemyBulletPool); return(entity); }
public void ReplaceBulletPool(DesperateDevs.Utils.ObjectPool <GameEntity> newPlayerBulletPool, DesperateDevs.Utils.ObjectPool <GameEntity> newEnemyBulletPool) { var entity = bulletPoolEntity; if (entity == null) { entity = SetBulletPool(newPlayerBulletPool, newEnemyBulletPool); } else { entity.ReplaceBulletPool(newPlayerBulletPool, newEnemyBulletPool); } }
public void ReplaceEnemyPool(DesperateDevs.Utils.ObjectPool <GameEntity> newPool) { var entity = enemyPoolEntity; if (entity == null) { entity = SetEnemyPool(newPool); } else { entity.ReplaceEnemyPool(newPool); } }