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.
- Listed in Global namespace: E to H
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
Eater() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private ConsumptionManager consumptionManager | The player's ConsumptionManager. |
private EdibleObject currentEdible | Food being eaten. |
private Collider currentEdibleCollider | Collider of the food being eaten. |
private float stopDelay | Seconds after the food leaves before eating stops. Defaults to 0.2. |
Methods
5 private and internal methods
| Member | What 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: