Example #1
0
    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);
            }
        }
    }
Example #3
0
 void Start()
 {
     CurrentHP = MaxHP;
     HPBar.SetMaxHealth(MaxHP);
 }