Skip to main content

TreeChopDetector

A class in Root.Township, the global namespace.

Fails a growth stage when its tree is chopped down to a small size, so young trees that are cut stop growing.

Constructors​

MemberWhat it is
TreeChopDetector()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private GrowthStageComponent growthStageThe growth stage that is failed.
private int minSizeToStuntTree size at or below which a chop stunts it.
private WoodcutTree tree2The woodcut tree whose chops are watched.

Methods​

4 private and internal methods
MemberWhat it is
private void Awake()Subscribes to chops if the growth stage is set up, and listens for setup changes.
private void HandleSetupChanged(GrowthStageComponent obj)Re-subscribes or unsubscribes from chops when the growth stage's setup changes.
private void StartHandlingChopped(bool isSubscribing)Unhooks the tree's chop event and hooks it again if isSubscribing is true.
private void TreeChopped()Fails the growth stage (without destroying) if the tree's total size is at or below minSizeToStunt.