public override bool PrePerform(GAgent gAgent) { var herbivore = gAgent as Herbivore; if (herbivore.PredatorTargets.Count > 0) { return(true); } return(false); }
public override bool PrePerform(GAgent gAgent) { if (gAgent.target != null) { if (Vector3.Distance(gAgent.transform.position, gAgent.target.position) < 5f) { return(true); } } return(false); }
public override void RunMainAction(GAgent gAgent) { Debug.Log("Eating."); var data = new GStateData(gAgent.controller, gAgent.agent, gAgent.target.position, gAgent.anim, "idle", 2f); gAgent.controller.Activity(data); IEatable food = gAgent.target.GetComponent <IEatable>(); (gAgent as Herbivore).Eater.Eat(food); }
public override void RunMainAction(GAgent gAgent) { Vector3 locationTarget = Vector3.zero; locationTarget = AINavigation.RandomNavSphere(gAgent.transform.position, gAgent.ViewSphereRadius + 20, -1, false); var data = new GStateData(gAgent.controller, gAgent.agent, locationTarget, gAgent.anim, "walk", 2f); Debug.Log("Setting navigation course to: " + locationTarget); gAgent.GenerateLocationGizmo(locationTarget); gAgent.controller.Move(data); }
public override void RunMainAction(GAgent gAgent) { var herbivore = gAgent as Herbivore; Debug.Log("Resting."); var data = new GStateData(gAgent.controller, gAgent.agent, gAgent.transform.position, gAgent.anim, "idle", 5f); gAgent.controller.Activity(data); herbivore.Exhausted.LoseExhaustion(50, true); }
public override bool PrePerform(GAgent gAgent) { var herbivore = gAgent as Herbivore; if (herbivore.FoodTargets.Count > 0) { gAgent.target = herbivore.FoodTargets[0]; return(true); } return(false); }
public override bool PostPerform(GAgent gAgent) { return(true); }
public abstract bool PostPerform(GAgent gAgent);
public abstract void RunMainAction(GAgent gAgent);
public abstract bool PrePerform(GAgent gAgent);