FiE-Game/Assets/Cinema Director/Cutscene Items/Actor Items/Animation/CrossFadeAnimationEvent.cs

31 lines
838 B
C#
Raw Normal View History

2023-07-26 21:47:00 +02:00
using UnityEngine;
using System.Collections;
namespace CinemaDirector
{
[CutsceneItemAttribute("Animation", "Cross Fade Animation", CutsceneItemGenre.ActorItem)]
public class CrossFadeAnimationEvent : CinemaActorEvent
{
public string Animation = string.Empty;
public float TargetWeight = 1f;
public PlayMode PlayMode = PlayMode.StopSameLayer;
public override void Trigger(GameObject actor)
{
if (actor != null)
{
Animation animation = actor.GetComponent<Animation>();
if (!animation)
{
return;
}
animation.CrossFade(Animation, TargetWeight, PlayMode);
}
}
public override void Reverse(GameObject actor)
{
}
}
}