public override IEnumerable <IActionEffect> Execute() { if (Entity.hasStomach) { Entity.ReplaceStomach(Entity.stomach.Satiation + 50, Entity.stomach.MaxSatiation); } _consumedIngredient.isMarkedForDestruction = true; return(new[] { new LambdaEffect(actorBehaviour => { _positionEffectPresenter.ShowPositionEffect(Entity.position.Position, "Gulp! Munch!"); }, Entity.view.Controller) }); }
protected override void Execute(List <GameEntity> entities) { foreach (GameEntity entity in entities) { int damage = entity.receiveDamage.DamageReceived; if (entity.hasIntegrity) { entity.ReplaceIntegrity(entity.integrity.Integrity - damage, entity.integrity.MaxIntegrity); } _positionEffectPresenter.ShowPositionEffect(entity.position.Position, "-" + damage, Color.red, false, 1f); _aggressionTriggerer.TriggerAggressionIfEligible(entity); entity.RemoveReceiveDamage(); } }
public override IEnumerable <IActionEffect> Execute() { int bite = 15; int newSatiation = Math.Min(Entity.stomach.MaxSatiation, Entity.stomach.Satiation + bite); Entity.ReplaceStomach(newSatiation, Entity.stomach.MaxSatiation); int newSatiety = _foodItemToEat.edible.Satiety - bite; if (newSatiety > 0) { _foodItemToEat.ReplaceEdible(newSatiety); } else { _foodItemToEat.isMarkedForDestruction = true; } return(new[] { new LambdaEffect(actorBehaviour => { _positionEffectPresenter.ShowPositionEffect(Entity.position.Position, "Munch!"); }, Entity.view.Controller) }); }
public void TriggerAggressionIfEligible(GameEntity target) { if (target.isPlayerControlled) { return; } try { // interrupting current activity if (target.hasActivity) { IActivity activity = target.activity.Activity; if (!(activity is AttackActivity)) { target.RemoveActivity(); } } } catch (Exception e) { Debug.LogError(e.Message + ", stack trace: " + e.StackTrace); throw; } if (target.isAggressive) { return; } target.isAggressive = true; _uiFacade.AddLogEntry($"{target.view.Controller.Name} becomes aggressive!"); _positionEffectPresenter.ShowPositionEffect(target.position.Position, "!", Color.red); if (target.hasActivity) { target.RemoveActivity(); } }