FiE-Game/Assets/Cinema Director/System/Runtime/TimelineTracks/DialogueTrack.cs

49 lines
1.2 KiB
C#
Raw Normal View History

2023-07-26 21:47:00 +02:00
// Cinema Suite 2014
using UnityEngine;
namespace CinemaDirector
{
[TimelineTrackAttribute("Dialogue Track", TimelineTrackGenre.CharacterTrack, CutsceneItemGenre.AudioClipItem)]
public class DialogueTrack : AudioTrack, IActorTrack
{
[SerializeField]
private Transform anchor;
public override void Initialize()
{
base.Initialize();
setTransform();
}
public override void UpdateTrack(float time, float deltaTime)
{
setTransform();
base.UpdateTrack(time, deltaTime);
}
private void setTransform()
{
if (anchor != null)
{
this.transform.position = anchor.position;
}
else if (Actor != null)
{
this.transform.position = Actor.transform.position;
}
}
public Transform Actor
{
get
{
ActorTrackGroup component = base.transform.parent.GetComponent<ActorTrackGroup>();
if (component == null)
{
return null;
}
return component.Actor;
}
}
}
}