public void CreateGame(String fileName)
        {
            parser = new TajParser();
            GameEnded = false;
            flashLight = false;

            GameLost = false;
            if(fileName.IndexOf("Levels" + Path.DirectorySeparatorChar) != 0)
            {
                fileName = "Levels" + Path.DirectorySeparatorChar + fileName;
            }
            //code to load in world
            world = new WorldRenderer(SaveFileSystem.LoadObjectFromFile<World>(fileName, new GameLoader()));
            this.parser.SetCustomHandler(this);
            game = new ClassicTetrisGame();

            game.SetEventLink(this);
            parser.Parse(Start);
        }
 public void SetGame(ClassicTetrisGame game)
 {
     this.game = game;
     this.game.SetEventLink(this);
 }
Exemplo n.º 3
0
        private void BuildTetris()
        {
            ClassicTetrisGame game = new ClassicTetrisGame();
            game.SetX((int)variablesToBuild.Peek()["X"]);
            game.SetY((int)variablesToBuild.Peek()["Y"]);
            game.SetPiece((string)variablesToBuild.Peek()["Piece"]);
            game.SetColor((byte)variablesToBuild.Peek()["Color"]);
            game.SetBoard((ByteBoard)variablesToBuild.Peek()["TheBoard"]);

            game.SetFlashLight((bool)variablesToBuild.Peek()["Flashlight"]);

            if((byte)variablesToBuild.Peek()["Mode"] == 1)
            {
                game.SetClusterMode((byte)variablesToBuild.Peek()["Low"], (byte)variablesToBuild.Peek()["High"]);
            }
            else if ((byte)variablesToBuild.Peek()["Mode"] == 2)
            {
                game.SetRowMode();
            }
            else
            {
                game.SetClassicMode();
            }

            game.SetPowerUp((bool)variablesToBuild.Peek()["PowerUp"]);

            game.ClearPieces();
            game.AddPieces(convertArray<String>((object[])variablesToBuild.Peek()["Pieces"]));
            buildStack.Push(game);

            currentClass.Pop();
            variablesToBuild.Pop();
        }