Skip to main content

GrowerGroup

A class in Root.Township, the global namespace.

Networked, saved group of growing items that each go through a GrowthDefinition's stages, such as the potato sapling's crops. Raises events as grown pickups appear and go away.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private List<GrowthItem> itemsThe group's growth items.
private static Logger loggerClass logger, used when a loaded stage time can't be worked out.

Properties​

MemberWhat it is
int Count { get; }Number of growth items in the group.
bool IsDestroyedOnCompletion { get; }Always false: the group stays when its items finish growing.
Transform Transform { get; }The group's transform.

Events​

MemberWhat it is
event Action<Pickup> PickupDeregisteredRaised when an item's pickup leaves the group.
event Action<Pickup> PickupRegisteredRaised when an item spawns an entity with a pickup.

Methods​

MemberWhat it is
void Add(GrowthDefinition definition, Vector3 position, Quaternion rotation)Adds a new growth item at a position and rotation and starts it growing.
IEnumerable<Pickup> AllPickups() (iterator)Yields the pickup of every item that currently has a spawned entity.
5 private and internal methods
MemberWhat it is
private void EntityAdded(GrowthItem item, NetworkEntity entity)Item handler that raises PickupRegistered when an item's spawned entity has a pickup.
private void EntityRemoved(GrowthItem item, NetworkEntity entity)Item handler that raises PickupDeregistered when an item's entity with a pickup is removed.
private void ItemRemoved(GrowthItem item)Item handler for destroyed or removed items: drops it from the list and raises PickupDeregistered.
private void OnDestroy()Tells every item the group is being destroyed.
private void Setup(GrowthItem item)Parents an item to this group, hooks its events and adds it to the list.

Used in​

Members of other types that take, return or hold a GrowerGroup: