A class in Root.Township, Alta.Loot.
A loot rarity asset with a weighting. All rarities load from Resources/Items/Rarities, and loot tables pick one at random.
Constructors
| Member | What it is |
|---|
Rarity() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private static Rarity[] allRarities | Every rarity in Resources/Items/Rarities, loaded on the first GetRandom call. |
private OriginSingleValue[] originWeightings | Weight of each origin for loot of this rarity. Exposed as OriginWeightings. |
private float weighting | How likely this rarity is picked relative to others. Exposed as Weighting. |
Properties
| Member | What it is |
|---|
OriginSingleValue[] OriginWeightings { get; } | Weightings used to pick an Origin for loot of this rarity. |
float Weighting { get; } | Base weighting (default 1). |
Methods
| Member | What it is |
|---|
static Rarity GetRandom(float weightingPower, List<Rarity> ignore) | Weighted pick from all rarities not in ignore. The running total is raised to weightingPower before comparing, which favours rarities earlier in the list as it grows. |
Used in
Members of other types that take, return or hold a Rarity: