public void ResetBoard()
 {
     oldFaces = TileData.CreateEmptyFaceArray(new IntVector3(0, 0, 0));
     oldBalls = BallData.CreateEmptyBallDataMatrix(new IntVector3(0, 0, 0));
     CreateBoard(IntVector3.One * 3);
     UpdateModel();
 }
Exemple #2
0
    public static CubeData Parse(string serializedData)
    {
        string   currentField = "";
        CubeData result       = new CubeData();

        foreach (string line in serializedData.Split(Environment.NewLine.ToCharArray()))
        {
            string trimmedLine = line.Trim();
            if (trimmedLine.Length > 0)
            {
                if (trimmedLine[0] == ';')
                {
                    currentField = trimmedLine.Substring(1).Trim();
                }
                else
                {
                    switch (currentField)
                    {
                    case "Dimension":
                        string[]   split      = trimmedLine.Split(',');
                        IntVector3 dimensions = new IntVector3
                                                (
                            int.Parse(split[0].Trim()),
                            int.Parse(split[1].Trim()),
                            int.Parse(split[2].Trim())
                                                );
                        result.faces = TileData.CreateEmptyFaceArray(dimensions);
                        result.balls = BallData.CreateEmptyBallDataMatrix(dimensions);
                        break;

                    case "Tiles":
                        string[] split2    = trimmedLine.Split(' ');
                        string[] positions = split2[1].Split(',');
                        int      x2        = int.Parse(positions[0].Trim());
                        int      y2        = int.Parse(positions[1].Trim());
                        int      z2        = int.Parse(positions[2].Trim());
                        string[] type      = split2[0].Split(':');
                        result.faces[x2][y2, z2] = new TileData((ObjectiveType)int.Parse(type[1]), (TileType)type[0][0]);
                        break;

                    case "Balls":
                        string[] split3     = trimmedLine.Split(' ');
                        string[] positions3 = split3[1].Split(',');
                        int      x3         = int.Parse(positions3[0].Trim());
                        int      y3         = int.Parse(positions3[1].Trim());
                        int      z3         = int.Parse(positions3[2].Trim());
                        string[] type3      = split3[0].Split(':');
                        result.balls[x3, y3, z3] = new BallData((BallType)type3[0][0], (ObjectiveType)int.Parse(type3[1]));
                        break;
                    }
                }
            }
        }
        return(result);
    }
    public static BoardData GetDummyBoardData()
    {
        BoardData board = new BoardData
        {
            balls = BallData.CreateEmptyBallDataMatrix(3, 3),
            tiles = TileData.CreateEmptyTileDataMatrix(3, 3)
        };

        board.balls[0, 0] = BallData.GetObjective1Ball();
        board.tiles[2, 2] = TileData.GetObjective1Tile();
        return(board);
    }
Exemple #4
0
 public void ResetBoard()
 {
     tiles = TileData.CreateEmptyTileDataMatrix(0, 0);
     balls = BallData.CreateEmptyBallDataMatrix(0, 0);
 }