2
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB
C#

using UnityEngine;
using UnityEngine.Timeline;
namespace Game
{
public class ClipThrowAnimation : TimelineClipBase
{
private ThrowAnimationClip _mRealAsset;
private const string OverrideClip = "timeline";
private const string OverrideClipAnother = "timeline_another";
private AnimationComponent _animation;
private Animator _animator;
public override void OnEnter()
{
var target = Util.GetEntity(Owner.skill.ThrowTarget);
_mRealAsset = Asset as ThrowAnimationClip;
_animation = target.animation;
_animator = _animation.Animator;
_animation.IsTimelineAnother = !_animation.IsTimelineAnother;
var clipName = _animation.IsTimelineAnother ? OverrideClipAnother : OverrideClip;
_animation.AnimatorOverrideController[clipName] = _animation.AnimatorOverrideController[_mRealAsset.clip.name];
_animator.speed = (float)Speed;
}
public override void OnStay()
{
}
public override void OnLeave()
{
}
}
}