r2mods/ilspy_dump/ror2_csproj/SetAkGameObjToStaticAfterDe...

32 lines
765 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using System.Collections;
using UnityEngine;
public class SetAkGameObjToStaticAfterDelay : MonoBehaviour
{
[Tooltip("Delay until setting this AkGameObj script as 'static' (not updating")]
[SerializeField]
private float timeUntilSetToStatic = -1f;
public static float defaultValueForDelayUntilSetToStatic = 10f;
private void Awake()
{
if (timeUntilSetToStatic == -1f)
{
timeUntilSetToStatic = defaultValueForDelayUntilSetToStatic;
}
else
{
timeUntilSetToStatic = Mathf.Abs(timeUntilSetToStatic);
}
StartCoroutine(SetAkGameObjToStatic());
}
private IEnumerator SetAkGameObjToStatic()
{
yield return new WaitForSeconds(timeUntilSetToStatic);
AkGameObjUtil.SetAkGameObjectStatic(base.gameObject, this);
Object.Destroy(this);
}
}