45 lines
911 B
C#
45 lines
911 B
C#
// (c) Copyright HutongGames, LLC 2010-2016. All rights reserved.
|
|
|
|
using UnityEngine;
|
|
|
|
namespace HutongGames.PlayMaker.Actions
|
|
{
|
|
[ActionCategory(ActionCategory.Animator)]
|
|
[Tooltip("Stops the animator playback mode. When playback stops, the avatar resumes getting control from game logic")]
|
|
public class AnimatorStopPlayback : FsmStateAction
|
|
{
|
|
[RequiredField]
|
|
[CheckForComponent(typeof(Animator))]
|
|
[Tooltip("The target. An Animator component is required")]
|
|
public FsmOwnerDefault gameObject;
|
|
|
|
public override void Reset()
|
|
{
|
|
gameObject = null;
|
|
}
|
|
|
|
public override void OnEnter()
|
|
{
|
|
// get the animator component
|
|
var go = Fsm.GetOwnerDefaultTarget(gameObject);
|
|
|
|
if (go==null)
|
|
{
|
|
Finish();
|
|
return;
|
|
}
|
|
|
|
Animator _animator = go.GetComponent<Animator>();
|
|
|
|
if (_animator!=null)
|
|
{
|
|
_animator.StopPlayback();
|
|
}
|
|
|
|
Finish();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
} |