public AnimationController(NavMeshAgent agent, AnimatorPlayableObject animatorPlayableObject, Rigidbody rigidbody, Action OnRootMotionEnabled = null, Action OnRootMotionDisabled = null) { Agent = agent; AnimatorPlayableObject = animatorPlayableObject; Rigidbody = rigidbody; this.RootMotionEnabled = new BoolVariable(false, () => { this.OnRootMotionEnabled(); if (OnRootMotionEnabled != null) { OnRootMotionEnabled.Invoke(); } }, () => { this.OnRootMotionDisabled(); if (OnRootMotionDisabled != null) { OnRootMotionDisabled.Invoke(); } }); }
private void Start() { var animator = this.GetComponent <Animator>(); this.AnimatorPlayableObject = new AnimatorPlayableObject("Test", animator); this.TwoDObjectAnimationPlayableSystem = new TwoDObjectAnimationPlayableSystem(this.AnimatorPlayableObject, this.BlendTree); }
public AnimatorPlayableGameObject(GameObject parent = null) { this.animatorPlayableGameObject = new GameObject(); if (parent != null) { this.animatorPlayableGameObject.transform.parent = parent.transform; this.animatorPlayableGameObject.transform.ResetLocal(); } this.Animator = this.animatorPlayableGameObject.AddComponent <Animator>(); this.AnimatorPlayableObject = new AnimatorPlayableObject("Test", this.Animator); this.animatorPlayableBehavior = this.animatorPlayableGameObject.AddComponent <AnimatorPlayableBehavior>(); this.animatorPlayableBehavior.Init(this.AnimatorPlayableObject); }
public TwoDObjectAnimationPlayableSystem(AnimatorPlayableObject AnimatorPlayableObject, A_AnimationPlayableDefinition Blendtree) { this.AnimatorPlayableObjectRef = AnimatorPlayableObject; AnimatorPlayableObject.PlayAnimation(0, Blendtree.GetAnimationInput()); }
public void Init(AnimatorPlayableObject AnimatorPlayableObject) { this.AnimatorPlayableObject = AnimatorPlayableObject; }
private void Start() { this.AnimatorPlayableObject = new AnimatorPlayableObject("Test", this.GetComponent <Animator>()); this.AnimatorPlayableObject.PlayAnimation(0, TwoDBlendTreePlayableDefinition.GetAnimationInput(), null, null); }