Ejemplo n.º 1
0
 public void LoadGame(GameMemento memento)
 {
     _state = memento.GetState();
 }
Ejemplo n.º 2
0
 public GameMemento(GameState state)
 {
     _state = state;
 }
Ejemplo n.º 3
0
        private GameState _state = new GameState(100, 0);//Health & Killed Monsters

        public void Play()
        {
            //During this Play method game's state is continuously changed
            Console.WriteLine(_state.ToString());
            _state = new GameState((int)(_state.Health * 0.9), _state.KilledMonsters + 2);
        }