A class in Root.Township, Alta.Blacksmithing.
Tracks which upgrades a smelter has, and from them the recipes, materials and speed it allows. A component next to Smelter; the server applies the default upgrades in Awake.
Constructors
| Member | What it is |
|---|
SmelterUnlockManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private SmelterUpgrades defaultUpgrades | Upgrade unlocked at start on normal servers. |
private HashSet<PhysicalMaterial> physMats | Backing field for PhysicalMaterials. |
private HashSet<SmeltingRecipe> recipes | Backing field for Recipes. |
private SmelterUpgrades simpleServerDefaultUpgrades | Upgrade unlocked at start on simple servers, if set. |
private HashSet<SmelterUpgrades> unlocks | Private: the unlocked upgrades. |
Properties
| Member | What it is |
|---|
IReadOnlyCollection<PhysicalMaterial> PhysicalMaterials { get; } | Materials the smelter can work with from its unlocked upgrades. |
IReadOnlyCollection<SmeltingRecipe> Recipes { get; } | Smelting recipes from the unlocked upgrades. |
float SpeedMultiplier { get; private set; } | Smelting speed, 1 plus the bonus of every unlock. Unlocking the same upgrade twice adds its bonus twice. |
Events
| Member | What it is |
|---|
event Action UnlockAdded | Raised after each Unlock. |
Methods
| Member | What it is |
|---|
void Lock(SmelterUpgrades definition) | Removes an upgrade, its speed bonus, and any recipes and materials no other unlocked upgrade still gives. |
void Unlock(SmelterUpgrades definition) | Adds an upgrade's recipes, materials and speed bonus, then raises UnlockAdded. |
1 private and internal method
| Member | What it is |
|---|
private void Awake() | Server: unlocks the simple server defaults on a simple server, otherwise the normal defaults. |
Used in
Members of other types that take, return or hold a SmelterUnlockManager: