Skip to main content

Eater

A class in Root.Township, the global namespace.

Mouth trigger on a player: starts eating an EdibleObject that enters it and stops shortly after it leaves.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private ConsumptionManager consumptionManagerThe player's ConsumptionManager.
private EdibleObject currentEdibleFood being eaten.
private Collider currentEdibleColliderCollider of the food being eaten.
private float stopDelaySeconds after the food leaves before eating stops. Defaults to 0.2.

Methods​

5 private and internal methods
MemberWhat it is
private IEnumerator DelayToStopEating() (iterator)Waits stopDelay seconds after the food leaves, then stops eating.
private void FinishEating(EdibleObject edible)Stops eating the food and reports an eating game task action for the player.
private void OnDestroy()Stops eating if something is being eaten.
private void OnTriggerEnter(Collider other)Starts eating the edible on the entering rigidbody's entity, if allowed. Re-entering cancels a pending stop.
private void OnTriggerExit(Collider other)Starts the stop delay when the food being eaten leaves.

Used in​

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