コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: GFSM.cs プロジェクト: byyjoww/Ecosystem-Simulation
 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;
 }
コード例 #4
0
ファイル: GFSM.cs プロジェクト: byyjoww/Ecosystem-Simulation
 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;
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: GFSM.cs プロジェクト: byyjoww/Ecosystem-Simulation
 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;
 }
コード例 #9
0
ファイル: GFSM.cs プロジェクト: byyjoww/Ecosystem-Simulation
        public void Activity(GStateData data)
        {
            var activity = new Activity(data);

            currentState.Transition(activity);
        }
コード例 #10
0
ファイル: GFSM.cs プロジェクト: byyjoww/Ecosystem-Simulation
        public void Move(GStateData data)
        {
            var navigate = new Navigate(data);

            currentState.Transition(navigate);
        }
コード例 #11
0
ファイル: GFSM.cs プロジェクト: byyjoww/Ecosystem-Simulation
        private void Start()
        {
            var data = new GStateData();

            currentState = new Idle(data);
        }