Example #1
0
 void Init()
 {
     currentStat           = initStat;
     currentStat.onChanged = stat =>
     {
         OnStatChanged.Invoke(stat);
     };
     currentStat.Init();
 }
        public bool ModifyStat(StatType targetType, Func <Stat, bool> handle)
        {
            if (targetType == null || handle == null)
            {
                return(false);
            }

            var stat = this[targetType];

            if (stat == null)
            {
                return(false);
            }

            if (handle(stat))
            {
                onStatChanged.Invoke(stat);
                return(true);
            }
            return(false);
        }