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); } }
bool PrepareMove(PoolEntity enemy, ICollection <PoolEntity> entitiesInSpot) { // handle player PoolEntity player; if (enemy.hasFoodDamager && entitiesInSpot.ContainsComponent(PoolComponentsLookup.Controllable, out player)) { pool.AddToFoodBag(-enemy.foodDamager.points); pool.PlayAudio(enemy.audioAttackSource); enemy.AddAnimation(Animation.enemyAttack); player.AddAnimation(Animation.playerHit); // can't move return(false); } if (entitiesInSpot.Count == 1 && entitiesInSpot.ContainsComponent(PoolComponentsLookup.Food)) { return(true); } return(false); }