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); } }
private static Eater IncrementHunger(Eater eater) { return(new Eater(hunger: eater.hunger + 1)); }
private static Eater DecreaseHunger(Eater eater, DecreaseHunger parameters) { return(new Eater(hunger: eater.hunger - parameters.value)); }