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

public class ReduceChildrensBuildRequirementIfPerk : MonoBehaviour
{
	[SerializeField]
	private Equippable perk;

	private void Update()
	{
		if (PerkManager.instance.CurrentlyEquipped.Contains(perk))
		{
			BuildSlot component = GetComponent<BuildSlot>();
			Debug.Log("Reduced build requirements of " + component.IsRootOf.Count);
			foreach (BuildSlot item in component.IsRootOf)
			{
				if (item.ActivatorBuilding == component)
				{
					item.ActivatorLevel = Mathf.Max(0, item.ActivatorLevel - 1);
				}
			}
		}
		Object.Destroy(this);
	}
}