예제 #1
0
 // Special Methods
 public void TakeDamage(float amount, DamageType type, AttrModType modType)
 {
     // A switch can be implemented here to reduce the amount based on the
     // damage type and the associated resitances
     health.AddModifier(new AttrModifier(-amount, modType));
     Debug.Log(gameObject.name + " health " + health.value + " remaining after " + amount + " damage delt");
 }
예제 #2
0
 //"Main" constructor.Requires all variables.
 public AttributeModifier(float value, AttrModType type, int order, object source)
 {
     mValue  = value;
     mType   = type;
     mOrder  = order;
     mSource = source;
 }
예제 #3
0
 //constructor
 public AttrModifier(float value, AttrModType type, int order, object source)
 {
     baseValue = value;
     _type     = type;
     _order    = order;
     _source   = source;
 }
예제 #4
0
 public void Heal(float amount, AttrModType type)
 {
     // Checks if a modifier equal to the negative of the amount to heal can be found
     if (health.RemoveModifier(new AttrModifier(-amount, type)) == false)
     {
         // If not adds the amount to heal as a new modifier
         health.AddModifier(new AttrModifier(amount, type));
     }
     Debug.Log(gameObject.name + " health of " + health.value + " after " + amount + " healing.");
 }
예제 #5
0
    public bool RemoveModifierOfType(AttrModType modType)
    {
        bool didRemove = false;

        for (int i = _attrModifiers.Count - 1; i >= 0; i--)
        {
            if (_attrModifiers[i].type == modType)
            {
                isDirty = true;
                _attrModifiers.RemoveAt(i);
                didRemove = true;
                break;
            }
        }
        return(didRemove);
    }
예제 #6
0
 // Requires Value, Type and Source. Sets Order to its default value: (int)Type
 public AttributeModifier(float value, AttrModType type, object source) : this(value, type, (int)type, source)
 {
 }
예제 #7
0
 // Requires Value, Type and Order. Sets Source to its default value: null
 public AttributeModifier(float value, AttrModType type, int order) : this(value, type, order, null)
 {
 }
예제 #8
0
 // Requires Value and Type.Calls the "Main" constructor and sets Order and Source to their default values: (int) type and null, respectively.
 public AttributeModifier(float value, AttrModType type) : this(value, type, (int)type, null)
 {
 }
예제 #9
0
 public void AddAttributeModifier(float value, AttrModType type)
 {
     testAttribute.AddModifier(new AttrModifier(value, AttrModType.FLAT));
 }
예제 #10
0
 // Methods to Add Modifiers to Attributes
 #region
 public void AddAttributeModifier(float value, AttrModType type, object source)
 {
     testAttribute.AddModifier(new AttrModifier(value, AttrModType.FLAT, this));
 }