Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public void ReactOnEvent(IExternalEvent externalEvent)
 {
     ITamagotchiState tamagotchiState;
     _externalEventReaction.React(externalEvent, State, out tamagotchiState);
     State = tamagotchiState;
 }
Exemplo n.º 3
0
 public void ReactOnEnvironment(IEnvironmentState environment)
 {
     ITamagotchiState tamagotchiState;
     _environmentStateReaction.React(environment, State, out tamagotchiState);
     State = tamagotchiState;
 }
Exemplo n.º 4
0
 public void PushFood(IFood food)
 {
     ITamagotchiState tamagotchiState;
     _foodReaction.React(food, State, out tamagotchiState);
     State = tamagotchiState;
 }