예제 #1
0
        public StatWithMax Reduce(int amount)
        {
            StatWithMax result = this;

            Current = Math.Max(0, Current - amount);
            return(result);
        }
예제 #2
0
        public object Clone()
        {
            StatWithMax copy = new StatWithMax();

            copy.max     = this.max;
            copy.current = this.current;
            return(copy);
        }
예제 #3
0
        public StatWithMax Add(int amount)
        {
            StatWithMax result = this;

            if (amount == int.MaxValue)
            {
                Current = Max;
            }
            else
            {
                Current = Math.Min(Max, Current + amount);
            }
            return(result);
        }