36 lines
917 B
C#
36 lines
917 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using BITFALL.Scene;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.Playables;
|
||
|
using UnityEngine.Windows;
|
||
|
using UnityEngine.Timeline;
|
||
|
|
||
|
namespace BITFALL.Scene
|
||
|
{
|
||
|
[RequireComponent(typeof(IActionBasedObject))]
|
||
|
public class ActionBasedTimeline : ActionBasedComponent
|
||
|
{
|
||
|
[SerializeField] private PlayableDirector director;
|
||
|
protected override void OnEnable()
|
||
|
{
|
||
|
base.OnEnable();
|
||
|
actionBasedObject.OnStarted += director.Play;
|
||
|
actionBasedObject.OnCanceled += director.Stop;
|
||
|
actionBasedObject.IsCompletedFactory += IsCompleted;
|
||
|
}
|
||
|
protected override void OnDisable()
|
||
|
{
|
||
|
base.OnDisable();
|
||
|
actionBasedObject.OnStarted -= director.Play;
|
||
|
actionBasedObject.OnCanceled -= director.Stop;
|
||
|
actionBasedObject.IsCompletedFactory -= IsCompleted;
|
||
|
}
|
||
|
private bool IsCompleted()
|
||
|
{
|
||
|
return director.state is PlayState.Paused;
|
||
|
}
|
||
|
}
|
||
|
}
|