Exemplo n.º 1
0
    void AddHP(float hp)
    {
        float maxHP = _attributeDictionary[PropertiesEnum.MaxHP].Value;
        float curHP = _attributeDictionary[PropertiesEnum.HP].Value;

        curHP = Mathf.Min(curHP + hp, maxHP);
        _attributeDictionary[PropertiesEnum.HP].Value = curHP;
        _hpSlider.UpdateHpSlider(curHP, maxHP);
        Text damageText = Instantiate(Resources.Load("Prefabs/UI/FlowText", typeof(Text)) as Text);

        damageText.transform.SetParent(_canvasTransform);
        damageText.GetComponent <FlowTextControl>().FlowAddHPText(hp);
    }
Exemplo n.º 2
0
    public void BeAttackedAndFlowText(float damage)
    {
        int damageReal = (int)PropertieManager.AttackDamageCalc(damage);

        _attributeDictionary[PropertiesEnum.HP].Value -= damageReal;
        if (_attributeDictionary[PropertiesEnum.HP].Value <= 0)
        {
            _attributeDictionary[PropertiesEnum.HP].Value = 0;
        }
        _hpSlider.UpdateHpSlider(_attributeDictionary[PropertiesEnum.HP].Value, _attributeDictionary[PropertiesEnum.MaxHP].Value);
        Text flowText = Instantiate(Resources.Load("Prefabs/UI/FlowText", typeof(Text)) as Text);

        flowText.transform.SetParent(_canvasTransform);
        flowText.GetComponent <FlowTextControl>().FlowDamageText(damageReal);
    }