FiE-Game/Assets/Cinema Director/System/Runtime/TimelineTracks/DialogueTrack.cs
2023-07-27 00:47:00 +05:00

49 lines
No EOL
1.2 KiB
C#

// 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;
}
}
}
}