live has music now

This commit is contained in:
左右看
2023-07-02 23:55:52 +08:00
parent 0e71fc6d56
commit 2257616ecd
11 changed files with 522 additions and 11 deletions
+32
View File
@@ -0,0 +1,32 @@
using UnityEngine;
using System.Collections;
public class CallAfterDelay : MonoBehaviour
{
float delay;
System.Action action;
// Will never call this frame, always the next frame at the earliest
public static CallAfterDelay Create(float delay, System.Action action)
{
CallAfterDelay cad = new GameObject("CallAfterDelay").AddComponent<CallAfterDelay>();
cad.delay = delay;
cad.action = action;
return cad;
}
float age;
void Update()
{
if (age > delay)
{
action();
Destroy(gameObject);
}
}
void LateUpdate()
{
age += Time.deltaTime;
}
}