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/Tracker.cs | |
parent | d141888a2c4e582df2725a16859dfcdfb19e1e2c (diff) |
*rename
Diffstat (limited to 'Valheim_v0.141.2_r202102/Valheim/assembly_valheim/Tracker.cs')
-rw-r--r-- | Valheim_v0.141.2_r202102/Valheim/assembly_valheim/Tracker.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Valheim_v0.141.2_r202102/Valheim/assembly_valheim/Tracker.cs b/Valheim_v0.141.2_r202102/Valheim/assembly_valheim/Tracker.cs new file mode 100644 index 0000000..f9aaed8 --- /dev/null +++ b/Valheim_v0.141.2_r202102/Valheim/assembly_valheim/Tracker.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +public class Tracker : MonoBehaviour +{ + private bool m_active; + + private void Awake() + { + ZNetView component = GetComponent<ZNetView>(); + if ((bool)component && component.IsOwner()) + { + m_active = true; + ZNet.instance.SetReferencePosition(base.transform.position); + } + } + + public void SetActive(bool active) + { + m_active = active; + } + + private void OnDestroy() + { + m_active = false; + } + + private void FixedUpdate() + { + if (m_active) + { + ZNet.instance.SetReferencePosition(base.transform.position); + } + } +} |