Пример #1
0
        static void Main()
        {
            Memory memory = new Memory();
            // Starting a new game

            Game superMario = new Game();
            superMario.Start();
            // playing, playing, jumping, falling, going underground, growing, fighting, killing e.t.c...
            superMario.Coins = 89;
            superMario.Level = 3;
            superMario.SubLevel = 4;
            superMario.Lives = 7;
            superMario.Score = 65340;
            superMario.State = MarioStates.BigAndArmed;
            Console.WriteLine("Playing 3 hours...");

            // Player saves it's good condition.
            memory.Save = superMario.Save();
            superMario.Start();

            // Suddenly Mario dies, killed by Big F***ing Monster
            superMario.GameOver();
            Console.WriteLine("Start from began after dead...");
            superMario.Start();

            // Player: "WtF Wtf, all my lives are gone, coins, aaaah :@ ;("
            // "Don't worry" - said the Game, "I have save for you"
            superMario.Restore(memory.Save);
            Console.WriteLine("Restore save...");
            superMario.Start();
        }
Пример #2
0
        static void Main()
        {
            Memory memory = new Memory();
            // Starting a new game

            Game superMario = new Game();

            superMario.Start();
            // playing, playing, jumping, falling, going underground, growing, fighting, killing e.t.c...
            superMario.Coins    = 89;
            superMario.Level    = 3;
            superMario.SubLevel = 4;
            superMario.Lives    = 7;
            superMario.Score    = 65340;
            superMario.State    = MarioStates.BigAndArmed;
            Console.WriteLine("Playing 3 hours...");

            // Player saves it's good condition.
            memory.Save = superMario.Save();
            superMario.Start();

            // Suddenly Mario dies, killed by Big F***ing Monster
            superMario.GameOver();
            Console.WriteLine("Start from began after dead...");
            superMario.Start();

            // Player: "WtF Wtf, all my lives are gone, coins, aaaah :@ ;("
            // "Don't worry" - said the Game, "I have save for you"
            superMario.Restore(memory.Save);
            Console.WriteLine("Restore save...");
            superMario.Start();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Game game = new Game();

            game.Set("LVL-1", 10);
            Console.WriteLine(game);

            File file = new File();

            file.Data = game.Save();

            game.Set("LVL-2", 20);
            Console.WriteLine(game);

            game.Load(file.Data);
            Console.WriteLine(game);
        }
Пример #4
0
        static void Main(string[] args)
        {
            Game game = new Game();

            while (!game.IsFinished)
            {
                game.Play();
                if (game.IsOver)
                {
                    game.Load();
                }
                else
                {
                    if (!game.IsFinished)
                    {
                        game.Save();
                    }
                }
            }
        }