Ejemplo n.º 1
0
    public virtual void AddAttribute(EntityAttribute attr, EntityStats source)
    {
        AppliedAttribute app;

        app.attr   = attr;
        app.source = source;
        if (attr.duration == float.PositiveInfinity)
        {
            app.endTime = float.PositiveInfinity;
        }
        else
        {
            app.endTime = Time.time + attr.duration;
        }

        if (!attr.stackable)
        {
            for (int i = 0; i < attribList.Count; i++)
            {
                string temp = attribList[i].attr.name;
                if (temp != "" && temp == attr.name)
                {
                    return;
                }
            }
        }

        attribList.Add(app);
        attr.OnAdd(this);
    }