2026-07-09 구준표루스 타임라인
This commit is contained in:
8
Assets/02_Scripts/Core.meta
Normal file
8
Assets/02_Scripts/Core.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86e2764687ba69f4a8bb3867340b6595
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
43
Assets/02_Scripts/Core/Util.cs
Normal file
43
Assets/02_Scripts/Core/Util.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
public static class Util
|
||||
{
|
||||
/// 특정 시간(초) 후에 액션을 실행
|
||||
public static async Awaitable RunDelayed(float delay, Action action, CancellationToken token = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 유니티 전용 비동기 대기
|
||||
await Awaitable.WaitForSecondsAsync(delay, token);
|
||||
|
||||
// 함수 실행
|
||||
action?.Invoke();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// 취소되었을 때의 처리 (필요 시)
|
||||
}
|
||||
}
|
||||
|
||||
/// 다음 프레임에 액션을 실행
|
||||
public static async Awaitable RunNextFrame(Action action, CancellationToken token = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Awaitable.EndOfFrameAsync(token);
|
||||
action?.Invoke();
|
||||
}
|
||||
catch (OperationCanceledException) { }
|
||||
}
|
||||
|
||||
public static float NormalizeAngle(float angle)
|
||||
{
|
||||
while (angle > 180)
|
||||
angle -= 360;
|
||||
while (angle < -180)
|
||||
angle += 360;
|
||||
return angle;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Core/Util.cs.meta
Normal file
2
Assets/02_Scripts/Core/Util.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5200481bd26370442b5a3de187578d14
|
||||
19
Assets/02_Scripts/TimelineSupport.cs
Normal file
19
Assets/02_Scripts/TimelineSupport.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEditor.Playables;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public class TimelineSupport : MonoBehaviour
|
||||
{
|
||||
private PlayableDirector _director;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_director = GetComponent<PlayableDirector>();
|
||||
}
|
||||
|
||||
public void PlayRequest(float delay)
|
||||
{
|
||||
_ = Util.RunDelayed(delay,()=>_director.Play());
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/02_Scripts/TimelineSupport.cs.meta
Normal file
2
Assets/02_Scripts/TimelineSupport.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f8f7dbac3df3904cbfd4a950c0a6a28
|
||||
Reference in New Issue
Block a user