// Use this for initialization // Use this for initialization void Start() { wapon1 = GetComponentInChildren <IInputClient>(); GetComponent <InputClientManager>().ResetClient(wapon1); processor = GetComponent <LEUnitProcessorBase>(); animationPro = GetComponent <LEUnitAnimatorManager>(); animationPro.SetMotionTypeImmediately(LEUnitAnimatorManager.AnimationMotionType.IWR_0); angent = GetComponent <NavMeshAgent>(); partrolState = new AiPatrolState(this); searchState = new AISearchState(this); chaseState = new AiChaseState(this); fightState = new AiFightState(this); partrolState.Init(); searchState.Init(); chaseState.Init(); fightState.Init(); currentState = partrolState; currentState.OnStateEnter(); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { foreach (BoolObject b in boolObjectsEnter) { animator.SetBool(b.boolName, b.value); } foreach (IntObject i in intObjectsEnter) { animator.SetInteger(i.intName, i.value); } if (animatorManager != null) { foreach (MethodInfo m in instanceVoidEnteres) { animatorManager.InvokeMethod(m, null); } foreach (FloatMethodInfo m in instanceFloatEnteres) { animatorManager.InvokeMethod(m.methodInfo, m.value); } foreach (BoolMethodInfo m in instanceBoolEnteres) { animatorManager.InvokeMethod(m.methodInfo, m.value); } foreach (Vec3MethodInfo m in instanceVec3Enter) { animatorManager.InvokeMethod(m.methodInfo, m.value); } } else { animatorManager = animator.GetComponent <LEUnitAnimatorManager>(); Convert.ChangeType(animatorManager, animatorManagerType); if (!animatorManager) { Debug.LogError("No AnimationController attach to this animator's GameObject"); } else { foreach (MethodInfo m in instanceVoidEnteres) { animatorManager.InvokeMethod(m, null); } foreach (FloatMethodInfo m in instanceFloatEnteres) { animatorManager.InvokeMethod(m.methodInfo, m.value); } foreach (BoolMethodInfo m in instanceBoolEnteres) { animatorManager.InvokeMethod(m.methodInfo, m.value); } foreach (Vec3MethodInfo m in instanceVec3Enter) { animatorManager.InvokeMethod(m.methodInfo, m.value); } } } }
void InitalTarget() { targetLEObject = FindObjectOfType <TargetLE>().gameObject; leUnitProcessor = targetLEObject.GetComponent <LEUnitProcessorBase>(); leUnitAnimationManager = targetLEObject.GetComponent <LEUnitAnimatorManager>(); leUnitBasicMovementManager = targetLEObject.GetComponent <LEUnitBasicMoveMentManager>(); inputActionManager = targetLEObject.GetComponent <InputClientManager>(); }
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { foreach (BoolValues b in boolValues) { if (b.resetOnExit) { animator.SetBool(b.boolName, !b.enterStatu); } } foreach (IntValueExit i in intExit) { animator.SetInteger(i.intName, i.value); } if (controller != null) { if (exitDels != null) { exitDels(controller); } //else { Debug.Log("enterDels = null"); } } else { controller = animator.transform.parent.GetComponent <LEUnitAnimatorManager>(); if (!controller) { Debug.LogError("No AnimationController attach to this animator's parent GameObject"); } else { if (exitDels != null) { exitDels(controller); } //else { Debug.Log("enterDels = null"); } } } }
private void OnEnable() { inputClientManager = GetComponent <InputClientManager>(); basicMovementManager = GetComponent <LEUnitBasicMoveMentManager>(); animationManager = GetComponent <LEUnitAnimatorManager>(); }
protected virtual void OnEnable() { rightHandTF = GetComponentInChildren <RightHandHolder>().transform; animationManager = GetComponent <LEUnitAnimatorManager>(); }