public void Initialize(StatusEffect _o, StatusEffectType _type, Sprite image, String descr)
    {
        o    = _o;
        type = _type;
        effectImage.sprite = image;
        switch (type)
        {
        case StatusEffectType.BLEED:
            timeLeft.color = Color.red;
            if (valueText != null)
            {
                valueText.color = Color.red;
            }
            break;

        case StatusEffectType.ARMOR:
        case StatusEffectType.DEFLECT:
            timeLeft.color = Color.green;
            if (valueText != null)
            {
                valueText.color = Color.green;
            }
            break;
        }
        if (descrText != null)
        {
            descrText.text = descr;
        }
        if (nameText != null)
        {
            nameText.text = type.ToString();
        }
    }
示例#2
0
        public static Type GetStatusEffect(StatusEffectType type)
        {
            if (!_statusEffects.ContainsKey(type))
            {
                throw new Exception("Status effect not defined: " + type.ToString());
            }

            return(_statusEffects[type]);
        }
示例#3
0
    public static bool StatusEffectTypeIsNegative(StatusEffectType inType)
    {
        string key = inType.ToString();

        if (effectsAreNegative.ContainsKey(key))
        {
            return(effectsAreNegative[key]);
        }

        throw new System.Exception("Status effect type '" + inType + "' has no definition for it being negative or positive");
    }
    public void AddStatusEffect(StatusEffectType statusEffectType, int damage, int duration)
    {
        foreach (StatusEffect statusEffect in statusEffects)
        {
            if (statusEffect.statusEffectType == statusEffectType && statusEffect.damage == damage)
            {
                statusEffect.remainingDuration += duration;
                statusEffect.name = statusEffect.statusEffectType.ToString() + ", " + damage + " (" + statusEffect.remainingDuration + ")";
                return;
            }
        }
        StatusEffect newStatusEffect = ScriptableObject.CreateInstance <StatusEffect>();

        newStatusEffect.name              = statusEffectType.ToString() + ", " + damage + " (" + duration + ")";
        newStatusEffect.statusEffectType  = statusEffectType;
        newStatusEffect.damage            = damage;
        newStatusEffect.duration          = duration;
        newStatusEffect.remainingDuration = duration;
        statusEffects.Add(newStatusEffect);
    }