public ITamagotchiState Modify(ITamagotchiState state, double coefficient = 1) { var newState = new InternalTamagotchiState(); newState.SetHealth(state.Health - (int) (coefficient*_healthModifier.Invoke(state.Health))); newState.SetHappiness(state.Happiness - (int)(coefficient * _happinessModifier.Invoke(state.Happiness))); newState.SetEnergy(state.Energy - (int)(coefficient * _energyModifier.Invoke(state.Energy))); return newState; }
public void ReactOnEvent(IExternalEvent externalEvent) { ITamagotchiState tamagotchiState; _externalEventReaction.React(externalEvent, State, out tamagotchiState); State = tamagotchiState; }
public void ReactOnEnvironment(IEnvironmentState environment) { ITamagotchiState tamagotchiState; _environmentStateReaction.React(environment, State, out tamagotchiState); State = tamagotchiState; }
public void PushFood(IFood food) { ITamagotchiState tamagotchiState; _foodReaction.React(food, State, out tamagotchiState); State = tamagotchiState; }