GymnasiumCraftingIngredientSpawner
A class in Root.Township, the global namespace.
Gymnasium test helper: docking a recipe page in one dock spawns that recipe's ingredients into a row of other docks.
- Listed in Global namespace: E to H
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
GymnasiumCraftingIngredientSpawner() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private int dockCount | Number of ingredient docks, cached in Awake. |
private NetworkEntity entity | The network entity on this object; its chunk is used for items that don't fit in a dock. |
private PickupDock[] ingredientDocks | Docks that the ingredients are spawned into, in order. |
private PickupDock recipeDock | Dock the player puts the recipe page in. |
Methods
6 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Hooks OnDockRecipe to the recipe dock and counts the ingredient docks. |
private void OnDestroy() | Unhooks OnDockRecipe from the recipe dock. |
private void OnDockRecipe(Interactor interactor, Pickup pickup, PickupDock dock) | Runs when a pickup is docked; if it is a page with an ICraftingIngredientProvider, spawns its ingredients, else logs why not. |
private bool PrefabIsStackable(uint prefabHash) | True if the prefab's item is stackable, so a whole quantity can go in one dock. |
private void Spawn(int currentDockIndex, uint prefabHash, int count) | Empties the dock at the given index and spawns the items docked there, or spawns one loose above the object once docks run out. |
private void SpawnItems(Dictionary<uint, int> ingredientDictionary) | Spawns each ingredient: stackable or single items get one dock each, other items get one dock per unit. |