summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/FakeChildTo.cs
blob: fe9d361ee3fccce688c375aba6d46b19b6036170 (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
using UnityEngine;

public class FakeChildTo : MonoBehaviour
{
	[SerializeField]
	private Transform fakeParent;

	[SerializeField]
	private bool unparentAtStart = true;

	private Vector3 offset;

	private void Start()
	{
		offset = base.transform.localPosition;
		if (unparentAtStart)
		{
			base.transform.SetParent(null);
		}
	}

	private void Update()
	{
		if (!fakeParent)
		{
			Object.Destroy(base.gameObject);
		}
		else
		{
			base.transform.position = fakeParent.position + offset;
		}
	}
}