コード例 #1
0
 public virtual bool ContainsAttribute(ENT_ATTR type)
 {
     for (int i = 0; i < attribList.Count; i++)
     {
         if (attribList[i].attr.type == type)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
 public virtual void RemoveAttributesByType(ENT_ATTR type)
 {
     for (int i = 0; i < attribList.Count; i++)
     {
         if (attribList[i].attr.type == type)
         {
             EntityAttribute rem = attribList[i].attr;
             Debug.Log("Removed " + rem.name);
             attribList.RemoveAt(i);
             rem.OnRemove(this);
             i--;
         }
     }
 }
コード例 #3
0
    public bool isAdditive; // true: The attribute is additive. false: the attribute is multiplicative. (this is only relevant for modifiers affecting numerical stats, and not for something like poison)

    public EntityAttribute(ENT_ATTR type, float value, float duration = float.PositiveInfinity, bool stackable = false, bool isAdditive = true, string name = "")
    {
        this.name  = name;
        this.type  = type;
        this.value = value;
        if (duration > 0f)
        {
            this.duration = duration;
        }
        else
        {
            this.duration = float.PositiveInfinity;
        }

        this.stackable  = stackable;
        this.isAdditive = isAdditive;
    }