Ejemplo n.º 1
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);
    }
Ejemplo n.º 2
0
    public void BeAttacked(GameObject enemy)
    {
        int damage = (int)PropertieManager.AttackDamageCalc(enemy.GetComponent <EnemyPropertie>().GetDamage());

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

        damageText.transform.SetParent(_canvasTransform);
        damageText.GetComponent <FlowTextControl>().FlowDamageText(damage);
    }