feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
50
SVSim.BattleEngine/Engine/Timer.cs
Normal file
50
SVSim.BattleEngine/Engine/Timer.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class Timer
|
||||
{
|
||||
public delegate void OnEndDelegate();
|
||||
|
||||
public float RemainTimeSec;
|
||||
|
||||
public bool IsEnd { get; protected set; }
|
||||
|
||||
public event OnEndDelegate onEndEvent;
|
||||
|
||||
public Timer(float time, OnEndDelegate onEndEvent)
|
||||
{
|
||||
RemainTimeSec = time;
|
||||
this.onEndEvent = onEndEvent;
|
||||
IsEnd = false;
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
if (!IsEnd)
|
||||
{
|
||||
RemainTimeSec -= Time.deltaTime;
|
||||
if (!(RemainTimeSec > 0f))
|
||||
{
|
||||
IsEnd = true;
|
||||
CallEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CallEvent()
|
||||
{
|
||||
this.onEndEvent();
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
IsEnd = true;
|
||||
}
|
||||
|
||||
public static IEnumerator DelayMethod(float waitTime, Action process)
|
||||
{
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
process?.Invoke();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user