summaryrefslogtreecommitdiff
path: root/Valheim_v202102/Valheim/assembly_valheim/Tracker.cs
blob: f9aaed87bb1df72f87386e4afcbae51423ab1165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
		}
	}
}