Skip to main content

SmelterUnlockManager

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​

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

Fields​

5 private and internal fields
MemberWhat it is
private SmelterUpgrades defaultUpgradesUpgrade unlocked at start on normal servers.
private HashSet<PhysicalMaterial> physMatsBacking field for PhysicalMaterials.
private HashSet<SmeltingRecipe> recipesBacking field for Recipes.
private SmelterUpgrades simpleServerDefaultUpgradesUpgrade unlocked at start on simple servers, if set.
private HashSet<SmelterUpgrades> unlocksPrivate: the unlocked upgrades.

Properties​

MemberWhat 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​

MemberWhat it is
event Action UnlockAddedRaised after each Unlock.

Methods​

MemberWhat 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
MemberWhat 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: