Exemple #1
0
        public void Add(AttributeMotifier am)
        {
            if (am.Operation == Operation.Percent)
            {
                _motifiers.AddFirst(am);
            }
            else
            {
                _motifiers.AddLast(am);
            }

            Caculate();
        }
Exemple #2
0
        public void Remove(AttributeMotifier am)
        {
            if (_motifiers.Count == 0)
            {
                return;
            }
            var rst = _motifiers.Remove(am);

            if (rst)
            {
                Caculate();
            }
            else
            {
                Debug.LogError(am.Operation + " fail to remove");
            }
        }
Exemple #3
0
        public void Add(Operation operation, long value)
        {
            var attr = new AttributeMotifier
            {
                Operation = operation,
                Value     = value
            };

            if (operation == Operation.Percent)
            {
                _motifiers.AddFirst(attr);
            }
            else
            {
                _motifiers.AddLast(attr);
            }

            Caculate();
        }
Exemple #4
0
 public void Add(AttributeType at, AttributeMotifier am)
 {
     if (_attributes.ContainsKey((int)at))
     {
         var attr     = _attributes[(int)at];
         var oldValue = attr.FinalValue;
         attr.Add(am);
         EventGroup.FireEvent((int)Event.OnAttributechange, this, EventGroup.NewArg <EventSingleArgs <AttributeMsg>, AttributeMsg>(new AttributeMsg()
         {
             At       = at,
             NewValue = attr.FinalValue,
             OldValue = oldValue
         }));
     }
     else
     {
         Debug.LogError(at + " Key not exsit");
     }
 }