Skip to main content

HealthValidation

A class in Root.Township, Alta.StatSystem.

Editor tool component with inspector buttons for saving, loading and fixing up health stat setups on network prefabs. Not used at runtime.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private bool btnApplyRefInspector button for ApplyRefs.
private bool btnLoadInspector button for LoadData.
private bool btnSaveInspector button for SaveData.
private bool btnValidateChildrenInspector button for ValidateChildren.
private HealthData dataThe HealthData asset used by the buttons.
private StatDefinition healthStatThe health stat definition used when loading.

Methods​

MemberWhat it is
void ApplyRefs()Applies stored stat manager references from the data to children, through the private statManager field.
void LoadData()Applies the stored health data to children using healthStat.
void SaveData()Fills the data with the health of every network prefab in Resources. Creates the data asset if missing, without filling it.
void ValidateChildren()Makes sure each child HealthObject has a stat manager with a definition, copying it from a same named child.
1 private and internal method
MemberWhat it is
private StatDefinitionApplication GetRelatedApplication(string objectName)Finds a child with the given name and returns the first definition application on its stat manager.