public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); if (_pathFinder == null) _pathFinder = AICtrl.GetComponent<Pathfinder>(); if(_input == null) _input = AICtrl.ControlledBy.GetComponent<InputManager>(); #if UNITY_EDITOR if (_pathFinder == null) Debug.LogError("No PathFinder in AIController object!"); #endif if (AICtrl.StateMachineAnimator.GetBool("IsDead")) Interrupt(); if (!bHasInit && _wpCtrl == null) { _wpCtrl = AICtrl.GetComponent<WaypointControl>(); bHasInit = true; } _wpCtrl.EOnPointReached -= this.OnPointReached; _wpCtrl.EOnFirstPointReached -= this.OnFirstPointReached; _wpCtrl.EOnLastPointReached -= this.OnLastPointReached; _wpCtrl.EOnPointReached += this.OnPointReached; _wpCtrl.EOnFirstPointReached += this.OnFirstPointReached; _wpCtrl.EOnLastPointReached += this.OnLastPointReached; AICtrl.LadderClimberCmp.EOnLadderUnset -= OffTheLadder; AICtrl.LadderClimberCmp.EOnLadderUnset += OffTheLadder; }//OnStateEnter
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); if (_pathFinder == null) _pathFinder = AICtrl.GetComponent<Pathfinder>(); #if UNITY_EDITOR if (_pathFinder == null) Debug.LogError("No PathFinder in AIController object!"); #endif }//OnStateEnter