Пример #1
0
 public static Game Instance()
 {
     lock (padlock)
     {
         if (instance == null)
         {
             instance = new Game();
         }
     }
     return instance;
 }
Пример #2
0
 public void Load()
 {
     XmlSerializer xs = new XmlSerializer(typeof(Game));
     FileStream fs = new FileStream("game.txt", FileMode.Open, FileAccess.Read);
     instance = xs.Deserialize(fs) as Game;
     fs.Close();
     Console.Clear();
     instance.snake.Draw();
     instance.wall.Draw();
     instance.food.Draw();
     instance.info.ShowInfo();
     if (instance.superfood.body.Count > 0)
     {
         instance.superfood.Draw();
     }
     if (instance.supertime > 0)
     {
         Program.timerSSnake.Start();
         Program.timerMove.Interval = 100;
     }
 }