Exemplo n.º 1
0
    private void Update()
    {
        if (!GameLogic.IsGameEnded())
        {
            Thread.Sleep(100);
            Map = GameLogic.GetNextPlayingMap();
            FillMapEmptyObjects();
            InsertElements();
            //ShowMapConsole();
            ShowMapTexture();
        }
        else
        {
            cccc++;
            string fileName = "Bug" + cccc.ToString() + ".txt";

            // Check if file already exists. If yes, delete it.
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            // Create a new file
            using (FileStream fs = File.Create(fileName))
            {
                // Add some text to file
                Byte[] title = new UTF8Encoding(true).GetBytes("New Text File");
                fs.Write(title, 0, title.Length);
                byte[] author = new UTF8Encoding(true).GetBytes("Mahesh Chand");
                fs.Write(author, 0, author.Length);
            }

            Map = GameLogic.GetNextPlayingMap();
            var statistics = GameLogic.GetSnakeStatistics();
            GameInits.SnakeStatistics = statistics;
            SceneManager.LoadScene(3);
        }
    }
Exemplo n.º 2
0
        void Update()
        {
            if (EndGame || GameLogic.IsGameEnded())
            {
                var statistics = GameLogic.GetSnakeStatistics();
                GameInits.SnakeStatistics = statistics;
                SceneManager.LoadScene(3);
            }

            if (TimePause <= Time.time && !GameLogic.IsGameEnded())
            {
                TimePause = Time.time + GameInits.Pause;

                Map = GameLogic.GetNextPlayingMap();
                SnakesTileMap.ClearAllTiles();
                ShowFood();
                ShowSnakes();
                ShowBarriers();
                UpdateStatisticsTable();
            }
        }