Ejemplo n.º 1
0
        public static void Insert(this NumericComponent self, int numericType, long value, bool isPublicEvent = true)
        {
            long oldValue = self.GetByKey(numericType);

            if (oldValue == value)
            {
                return;
            }

            self.NumericDic[numericType] = value;

            if (numericType >= NumericType.Max)
            {
                self.Update(numericType, isPublicEvent);
                return;
            }

            if (isPublicEvent)
            {
                Game.EventSystem.Publish(self.DomainScene(),
                                         new EventType.NumbericChange()
                {
                    Unit = self.GetParent <Unit>(), New = value, Old = oldValue, NumericType = numericType
                });
            }
        }