diff options
author | chai <215380520@qq.com> | 2024-05-21 20:51:53 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2024-05-21 20:51:53 +0800 |
commit | 419dcc2e47d94accd0894a1cb36282c8421e7bc1 (patch) | |
tree | 24c100ecc3ebfb2a976e29bd010ff84300a6e5e6 /Valheim_v0.141.2_r202102/Valheim/assembly_valheim/SlowUpdate.cs | |
parent | d141888a2c4e582df2725a16859dfcdfb19e1e2c (diff) |
*rename
Diffstat (limited to 'Valheim_v0.141.2_r202102/Valheim/assembly_valheim/SlowUpdate.cs')
-rw-r--r-- | Valheim_v0.141.2_r202102/Valheim/assembly_valheim/SlowUpdate.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Valheim_v0.141.2_r202102/Valheim/assembly_valheim/SlowUpdate.cs b/Valheim_v0.141.2_r202102/Valheim/assembly_valheim/SlowUpdate.cs new file mode 100644 index 0000000..2871f3d --- /dev/null +++ b/Valheim_v0.141.2_r202102/Valheim/assembly_valheim/SlowUpdate.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using UnityEngine; + +public class SlowUpdate : MonoBehaviour +{ + private static List<SlowUpdate> m_allInstances = new List<SlowUpdate>(); + + private int m_myIndex = -1; + + public virtual void Awake() + { + m_allInstances.Add(this); + m_myIndex = m_allInstances.Count - 1; + } + + public virtual void OnDestroy() + { + if (m_myIndex != -1) + { + m_allInstances[m_myIndex] = m_allInstances[m_allInstances.Count - 1]; + m_allInstances[m_myIndex].m_myIndex = m_myIndex; + m_allInstances.RemoveAt(m_allInstances.Count - 1); + } + } + + public virtual void SUpdate() + { + } + + public static List<SlowUpdate> GetAllInstaces() + { + return m_allInstances; + } +} |