void Start() { health = maxHealth; OnHealthChange += HealthChange; if (healthUI) { healthUI.SetMaxHealth(maxHealth); } if (rendererBody && flashMaterial) { defaultMaterials = rendererBody.materials; flashingMaterials = MakeMaterialArray(flashMaterial); } lastDamageTime = (-1 * immunityAfterDamageTimer); }
public void UpdateDynamicAttributesUI(DynamicAttributeContainer container) { foreach (var attribute in container.dynamicAttributes) { if (attribute.dynamicType == DynamicAttributeType.Health) { healthBar.SetHealth(attribute.currentValue); healthBar.SetMaxHealth(attribute.maxValue); } if (attribute.dynamicType == DynamicAttributeType.Mana) { manaBar.SetCurrentMana(attribute.currentValue); manaBar.SetMaxMana(attribute.maxValue); } if (attribute.dynamicType == DynamicAttributeType.Coin) { coinUI.SetValue(attribute.currentValue); } } }
void Start() { CurrentHP = MaxHP; HPBar.SetMaxHealth(MaxHP); }