Example #1
0
        private void InitBoard()
        {
            whiteSymbol = families.First() as FamilySymbol;
            blackSymbol = families.First() as FamilySymbol;

            foreach (FamilySymbol ele in families)
            {
                if (ele.Family.Name == "ChessTile")
                {
                    if (ele.Name == "White Tile")
                    {
                        whiteSymbol = ele;
                    }
                    else if (ele.Name == "Black Tile")
                    {
                        blackSymbol = ele;
                    }
                    else if (ele.Name == "Green Tile")
                    {
                        greenSymbol = ele;
                    }
                    else if (ele.Name == "Red Tile")
                    {
                        redSymbol = ele;
                    }
                }
            }


            bool stagger = true;

            for (int ii = 1; ii < 9; ii++)
            {
                for (int i = 1; i < 9; i++)
                {
                    TileClass tc = new TileClass();
                    tc.row    = ii;
                    tc.column = i;

                    XYZ xyz = new XYZ(i, ii, 0);
                    if (stagger)
                    {
                        tc.color   = "Black";
                        tc.element = doc.Create.NewFamilyInstance(xyz, blackSymbol, StructuralType.NonStructural);
                    }
                    else
                    {
                        tc.color   = "White";
                        tc.element = doc.Create.NewFamilyInstance(xyz, whiteSymbol, StructuralType.NonStructural);
                    }
                    Tiles.Add(tc);
                    stagger = !stagger;
                }
                stagger = !stagger;
            }
        }
Example #2
0
        public void InitRectangle(int recRow, int recCol, bool clash)
        {
            XYZ       xyz = new XYZ(recCol, recRow, 0.01);
            TileClass t   = new TileClass();
            Element   e;

            if (clash)
            {
                e       = doc.Create.NewFamilyInstance(xyz, startGame.redSymbol, StructuralType.NonStructural);
                t.color = "Red";
            }
            else
            {
                e       = doc.Create.NewFamilyInstance(xyz, startGame.greenSymbol, StructuralType.NonStructural);
                t.color = "Green";
            }

            t.column        = recCol;
            t.row           = recRow;
            t.element       = e;
            t.parentElement = this.element;
            startGame.HighlightedTiles.Add(t);
        }