60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class OpenSequence : MonoBehaviour
|
|
{
|
|
public DeepInClock deepInClock;
|
|
public PlayableDirector fadeInPlayable;
|
|
public GameObject fadeInAnima;
|
|
public SpriteDeepIn deepIn;
|
|
|
|
private void Awake()
|
|
{
|
|
// 组装
|
|
deepInClock.OnClockReached += PlayFadeIn;
|
|
fadeInPlayable.stopped += PlayDeepIn;
|
|
deepIn.OnFinished += Finished;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.K))
|
|
{
|
|
EnableClock();
|
|
}
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
deepInClock.OnClockReached -= PlayFadeIn;
|
|
fadeInPlayable.stopped -= PlayDeepIn;
|
|
deepIn.OnFinished -= Finished;
|
|
}
|
|
|
|
public void EnableClock()
|
|
{
|
|
deepInClock.Enable();
|
|
}
|
|
|
|
private void PlayFadeIn()
|
|
{
|
|
fadeInAnima.SetActive(true);
|
|
fadeInPlayable.Play();
|
|
}
|
|
|
|
private void PlayDeepIn(PlayableDirector director)
|
|
{
|
|
fadeInAnima.SetActive(false);
|
|
deepIn.gameObject.SetActive(true);
|
|
deepIn.Play();
|
|
}
|
|
|
|
private void Finished()
|
|
{
|
|
Debug.Log("Open Finished");
|
|
}
|
|
}
|
|
}
|