public override void Execute(Steerable steerable) { base.Execute(steerable); // Retrieve the amount of light energy possessed by the NPC performing this action float myLightEnergy = steerable.GetComponent <LightSource>().LightEnergy.CurrentEnergy; if (targetLightSource) { // If this fish has less light than its target if (!alwaysSeek && (myLightEnergy < targetLightSource.LightEnergy.CurrentEnergy || alwaysFlee)) { // Flee the light source since it is stronger than this fish fleeWhenWeaker.Execute(steerable); //Debug.Log("FLEE THE FISH: " + targetLightSource.name); } // Else, if this fish has more light than its target else { // Seek the light source seekWhenStronger.Execute(steerable); } } else { // If the light source has been destroyed, stop performing this action. ActionCompleted(); } wallAvoidance.Execute(steerable); }
public override void Execute() { _seek.Execute(zombie.transform); if (_seek.GetDistance(zombie.transform) < 5) { zombie.ScareHuman(); } }
public override void Execute() { Transform transform = _npc.GetTransform(); if (_seek.GetDistance(transform) < 2) { SeekPunto(_puntoProvider.getDiferentPunto(_punto)); } _seek.Execute(transform); base.Execute(); }