Esempio n. 1
0
            }//OnStateEnter


            public override bool Action() {
                base.Action();
 
                if (Time.timeSinceLevelLoad - this.enteredTime < 1f) {
                    AICtrl.MvmntCmp.SetVelocity(Vector2.zero);
                    return false;
                }

                if (bIsAtTarget)
                    return false;
                if (this.target == null) {
                    this.target = _wpCtrl.GetNext().transform;
                }

                bool hasArrived = this.GoToTarget(this.target);

                if (hasArrived) {
                    bIsAtTarget = _wpCtrl.IsAtLastPoint();
                    this.target = _wpCtrl.GetNext().transform;
                }
                if (bIsAtTarget) {
                    _wpCtrl.ResetPatrolPoints();
                    AICtrl.OnLookAround(this.BackToPatrol);
                }

                return true;
            }//Action
Esempio n. 2
0
            }//Action


            protected override void OnLastPointReached(WaypointControl wpCtrl) {
                base.OnLastPointReached(wpCtrl);
                if (wpCtrl.IsWaitingAtWaypoint) {
                    this.deferPointSwitch = true;
                    return;
                }
                wpCtrl.FlipIterationIndex();

                if (!bUsePatrolPath) {
                    var t = wpCtrl.GetActivePoint();
                    wpCtrl.ResetPatrolPoints();
                    bUsePatrolPath = true;
                    this.target = wpCtrl.GetNext(t).transform;
                }
            }//OnLastPointReached