Class LegionRecipe
- Namespace
- PixelUnitStudio
- Assembly
- PixelUnitStudio.Runtime.dll
One hero's combination written as option names. Used to assemble heroes at game runtime (LegionBuilder.Create / Apply). As text, "slot=option[:dye]" entries are joined by spaces. Example: "Helmet=helmet_mitre Cloth=robe_priest:gold WeaponRight=staff_sun". Written by name, so it is found correctly even if the catalog is rebuilt and the order changes. Slots not listed are cleared (if they can be) or set to the default. The skin color is written like "Skin=orc" (LegionDye.Skins). If not written, it is the default skin.
public sealed class LegionRecipe
- Inheritance
-
LegionRecipe
- Inherited Members
Constructors
LegionRecipe()
public LegionRecipe()
Fields
DyeChance
Probability that a dyeable part is dyed in a random combination.
public const float DyeChance = 0.4
Field Value
FillChance
Probability of filling a slot in a random combination. Slots not listed get 0.5; slots that cannot be cleared are always filled.
public static readonly IReadOnlyDictionary<string, float> FillChance
Field Value
OffHandRandomSets
Motion sets a random combination puts in the off hand. The off hand is decoration, so only one-handed weapons and shields (default) and daggers are chosen.
public static readonly HashSet<string> OffHandRandomSets
Field Value
SkinChance
Probability that a random combination picks a non-default skin color.
public const float SkinChance = 0.3
Field Value
Properties
Dyes
public IReadOnlyDictionary<string, string> Dyes { get; }
Property Value
Options
public IReadOnlyDictionary<string, string> Options { get; }
Property Value
Skin
public string Skin { get; }
Property Value
Methods
DyeFor(string)
public string DyeFor(string slot)
Parameters
slotstring
Returns
From(LegionBuilder)
Reads the current combination of a hero being assembled.
public static LegionRecipe From(LegionBuilder builder)
Parameters
builderLegionBuilder
Returns
From(LegionUnit)
Reads the combination of a saved hero prefab.
public static LegionRecipe From(LegionUnit unit)
Parameters
unitLegionUnit
Returns
Missing(LegionCatalog)
Returns option and dye names ("slot/name") not in the catalog.
public List<string> Missing(LegionCatalog catalog)
Parameters
catalogLegionCatalog
Returns
OptionFor(string)
public string OptionFor(string slot)
Parameters
slotstring
Returns
Parse(string)
Reads "slot=option[:dye] ..." text. FormatException if any piece is malformed.
public static LegionRecipe Parse(string text)
Parameters
textstring
Returns
Random(LegionCatalog, Random)
Builds a random combination from the catalog. The same seed gives the same combination (for the same catalog).
public static LegionRecipe Random(LegionCatalog catalog, Random random)
Parameters
catalogLegionCatalograndomRandom
Returns
Set(string, string, string)
Writes an option into a slot. If option is empty the slot is cleared. If dye is empty, the original color.
public LegionRecipe Set(string slot, string option, string dye = null)
Parameters
Returns
ToString()
public override string ToString()