public static void DestroyEntityIfEmpty(this PoolContext context, PoolEntity entity) { if (entity.GetComponentIndices().Length == 0) { context.DestroyEntity(entity); } }
protected override void Execute(List<PoolEntity> entities) { foreach (var e in entities) { if (e.destructible.hp <= 0) { pool.DestroyEntity(e); } } }
protected override void Execute(List <PoolEntity> entities) { int level = pool.level.level; // delete previous elements foreach (var entity in deleteOnExitGroup.GetEntities()) { pool.DestroyEntity(entity); } SetupScene(level); pool.isNextTurn = true; }
void OnAudioAdded(IGroup <PoolEntity> group, PoolEntity entity, int index, IComponent component) { pool.DestroyEntity(entity); var originalPitch = efxSource.pitch; efxSource.pitch = Random.Range(lowPitchRange, highPitchRange); efxSource.Play(); efxSource.pitch = originalPitch; return; }
void OnAudioAdded(IGroup <PoolEntity> group, PoolEntity entity, int index, IComponent component) { var audioComponent = (AudioComponent)component; var audioName = audioComponent.clipNames.Random(); var audioClip = Resources.Load <AudioClip>("Audio/" + audioName); if (audioClip != null) { Play(audioClip, audioComponent.randomizePitch); } // only play once pool.DestroyEntity(entity); }
protected override void Execute(List <PoolEntity> entities) { var position = pool.controllableEntity.position; ICollection <PoolEntity> posEntities; pool.IsGameBoardPositionOpen(position, out posEntities); PoolEntity food; if (posEntities != null && posEntities.ContainsComponent(PoolComponentsLookup.Food, out food)) { int points = food.food.points; pool.AddToFoodBag(points); pool.DestroyEntity(food); } }