public override void RunMainAction(GAgent gAgent) { var data = new GStateData(gAgent.controller, gAgent.agent, gAgent.target, gAgent.anim, "walk", 2f); Debug.Log("Setting navigation course to: " + gAgent.target.gameObject.name); gAgent.controller.Move(data); }
public override void RunMainAction(GAgent gAgent) { var herbivore = gAgent as Herbivore; var pos = AINavigation.Flee(herbivore.PredatorTargets[0].position, gAgent.agent, 40f); var data = new GStateData(gAgent.controller, gAgent.agent, pos, gAgent.anim, "run", 2f); Debug.Log("Setting navigation course to: " + pos); gAgent.controller.Move(data); }
public GState(GStateData data) { //anim.ResetTrigger(animationClip); this.animationClip = data.animationClip; this.anim = data.anim; this.controller = data.controller; this.agent = data.agent; this.targetLocation = data.targetLocation; this.targetTransform = data.targetTransform; this.transitionTime = data.transitionTime; stateStage = EVENT.ENTER; }
public Idle(GStateData data) : base(data) { currentStateName = STATE.IDLE; //anim.ResetTrigger(animationClip); this.animationClip = data.animationClip; this.anim = data.anim; this.controller = data.controller; this.agent = data.agent; this.targetLocation = data.targetLocation; this.transitionTime = data.transitionTime; stateStage = EVENT.ENTER; }
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 Activity(GStateData data) : base(data) { currentStateName = STATE.ACTIVITY; //anim.ResetTrigger(animationClip); //this.animationClip = data.animationClip; //this.anim = data.anim; //this.controller = data.controller; //this.agent = data.agent; //this.targetLocation = data.targetLocation; //this.targetTransform = data.targetTransform; //this.transitionTime = data.transitionTime; //stateStage = EVENT.ENTER; }
public void Activity(GStateData data) { var activity = new Activity(data); currentState.Transition(activity); }
public void Move(GStateData data) { var navigate = new Navigate(data); currentState.Transition(navigate); }
private void Start() { var data = new GStateData(); currentState = new Idle(data); }