// (c) Copyright HutongGames, LLC 2010-2016. All rights reserved. using UnityEngine; namespace HutongGames.PlayMaker.Actions { [ActionCategory(ActionCategory.Animator)] [Tooltip("Returns the feet pivot. At 0% blending point is body mass center. At 100% blending point is feet pivot")] public class GetAnimatorFeetPivotActive : FsmStateAction { [RequiredField] [CheckForComponent(typeof(Animator))] [Tooltip("The Target. An Animator component is required")] public FsmOwnerDefault gameObject; [RequiredField] [UIHint(UIHint.Variable)] [Tooltip("The feet pivot Blending. At 0% blending point is body mass center. At 100% blending point is feet pivot")] public FsmFloat feetPivotActive; private Animator _animator; public override void Reset() { gameObject = null; feetPivotActive = null; } public override void OnEnter() { // get the animator component var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go==null) { Finish(); return; } _animator = go.GetComponent(); if (_animator==null) { Finish(); return; } DoGetFeetPivotActive(); Finish(); } void DoGetFeetPivotActive() { if (_animator==null) { return; } feetPivotActive.Value = _animator.feetPivotActive; } } }