mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-12-02 17:57:59 +01:00
49 lines
1.2 KiB
C#
49 lines
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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|