예제 #1
0
        public static Eater Update(EaterMsg msg, Eater eater, EaterParameters parameters = null)
        {
            switch (msg)
            {
            case EaterMsg.IncrementHunger:
                return(IncrementHunger(eater));

            case EaterMsg.DecreaseHunger:
                return(DecreaseHunger(eater, (DecreaseHunger)parameters));

            default:
                throw new ArgumentOutOfRangeException(nameof(msg), msg, null);
            }
        }
예제 #2
0
 private static Eater IncrementHunger(Eater eater)
 {
     return(new Eater(hunger: eater.hunger + 1));
 }
예제 #3
0
 private static Eater DecreaseHunger(Eater eater, DecreaseHunger parameters)
 {
     return(new Eater(hunger: eater.hunger - parameters.value));
 }