12 [RequireComponent(typeof(Animator))]
24 private Animator _animator;
31 if (_animator == null)
33 _animator = this.GetComponent<Animator>();
36 if (AnimActions == null)
38 base.OnStateChange(newState);
42 for (
int i = 0; i < AnimActions.Length; i++)
44 if (AnimActions[i].ButtonState == newState)
46 switch (AnimActions[i].ParamType)
48 case AnimatorControllerParameterType.Bool:
49 _animator.SetBool(AnimActions[i].ParamName, AnimActions[i].BoolValue);
51 case AnimatorControllerParameterType.Float:
52 _animator.SetFloat(AnimActions[i].ParamName, AnimActions[i].FloatValue);
54 case AnimatorControllerParameterType.Int:
55 _animator.SetInteger(AnimActions[i].ParamName, AnimActions[i].IntValue);
57 case AnimatorControllerParameterType.Trigger:
58 _animator.SetTrigger(AnimActions[i].ParamName);
61 throw new ArgumentOutOfRangeException();
67 base.OnStateChange(newState);