protected void lazyInit(Animator animator) { if (roleController == null) { roleController = animator.GetComponentInParent <Tang.RoleController>(); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); if (roleController == null) { roleController = animator.GetComponentInParent <Tang.RoleController>(); } if (roleController != null) { if (roleController.GetDirectionInt() > 0) { roleController.SetDirection(Tang.Direction.Left); } else { roleController.SetDirection(Tang.Direction.Right); } } }
private void lazyInit(Animator animator) { roleController = animator.GetComponentInParent <Tang.RoleController>(); }