Пример #1
0
    void Start()
    {
        Vector3[] pts1 = initShape1();

        Polygon pg1 = new Polygon(pts1);

        Extrusion f1 = pg1.Extrude(new Vector3(0, 40, 0));
        //ShapeObject so = ShapeObject.CreateMeshable(f1);
        //so.name = "A";

        ShapeObject so       = SOPoint.CreatePoint();
        Building    building = new Building();

        g1 = new Grammar();
        building.AddGrammar(g1);
        g1.name = "g1";
        so.SetGrammar(g1);

        //g1.AddRule(new Rules.CreateBox("A", new Vector3(0, 0, 0), new Vector3(10, 10, 10), new Vector3(0,0,0)));
        g1.AddRule(new Rules.CreateOperableBox("A", new Vector3(30, 60, 20)));
        g1.AddRule(new Rules.SizeBuilding3D("A", "A", new Vector3(40, 30, 20)));

        g1.AddRule(new Rules.ApartmentLoadFilter("A", "SL", "DL", "CV"));
        g1.AddRule(new Rules.SingleLoaded("SL", "APT"));
        g1.AddRule(new Rules.DoubleLoaded("DL", "APT"));
        g1.AddRule(new Rules.CentralVoid("CV", "APT", "APT2"));


        Grammar g2 = new Grammar();

        g2.name = "AptFormA";
        g2.AddRule(new Rules.Bisect("APT", new string[] { "APT", "C" }, 0.4f, 0), false);
        g2.AddRule(new Rules.Bisect("C", new string[] { "C", "APT" }, 0.25f, 2), false);
        g2.AddRule(new Rules.Scale3D("C", "APT", new Vector3(1.3f, 0.7f, 1.6f), null, Alignment.NE), false);


        g2.inputs.names.Add("APT");



        g1.AddRule(g2);
        //g1.AddRule(new Rules.DivideTo("APT", "APTL", 4, 1));
        //g1.AddRule(new Rules.DivideTo("APT2", "APTL", 4, 1));

        g1.AddRule(new Rules.DcpFace2("APT", new string[] { "APT", "APT" }));
        g1.AddRule(new Rules.DcpFace2("APT2", new string[] { "APT", "APT" }));


        //g1.AddRule(new Rules.DivideToFTFH("APT2", "APTL", 4));
        //g1.AddRule(new Rules.DivideToFTFH("APT", "APTL", 4));
        //g1.AddRule(new Rules.DcpFace2("APTL", new string[] { "Top", "Side" }));

        g1.Execute();
        SceneManager.SelectedGrammar = g1;
    }
Пример #2
0
        public void OnSelectGrammarClicked(string grammarName)
        {
            Debug.Log("onSelect GrammarClicked");
            if (SceneManager.selectedShape == null)
            {
                return;
            }
            ShapeObject so = SceneManager.selectedShape;
            Grammar     g  = new Grammar();

            //g.assignedObjects.Add(so);
            //so.grammar = g;
            g.Load(grammarName, false);
            //notworking
            so.SetGrammar(g, true);
        }
Пример #3
0
    void Passed_CreateBuilding(ShapeObject so)
    {
        Grammar            g  = new Grammar();
        BuildingProperties bp = new BuildingProperties();

        bp.AddGrammar(g);
        so.SetGrammar(g);

        float h = Random.Range(9, 30);

        g.AddRule(new Rules.CreateOperableBox("A", new Vector3(30, 60, 20)));
        g.AddRule(new Rules.SizeBuilding3D("A", "A", new Vector3(30, h, 20)));
        g.AddRule(new Rules.ApartmentLoadFilter("A", "SL", "DL", "CV"));
        g.AddRule(new Rules.SingleLoaded("SL", "APT"));
        g.AddRule(new Rules.DoubleLoaded("DL", "APT"));
        g.AddRule(new Rules.CentralVoid("CV", "APT", "APT2"));
    }
Пример #4
0
    ShapeObject createBuilding()
    {
        ShapeObject so = SOPoint.CreatePoint();
        Grammar     g  = new Grammar();
        Building    bp = new Building();

        bp.AddGrammar(g);
        so.SetGrammar(g);

        float h = Random.Range(9, 80);
        float w = Random.Range(30, 50);
        float d = Random.Range(15, 25);

        if (h < 30)
        {
            w = Random.Range(40, 60);
            d = Random.Range(30, 50);
        }
        g.AddRule(new Rules.CreateOperableBox("A", new Vector3(30, 60, 20)));
        g.AddRule(new Rules.SizeBuilding3D("A", "A", new Vector3(w, h, d)));
        g.AddRule(new Rules.ApartmentLoadFilter("A", "SL", "DL", "CV"));
        g.AddRule(new Rules.SingleLoaded("SL", "APT"));
        g.AddRule(new Rules.DoubleLoaded("DL", "APT"));
        g.AddRule(new Rules.CentralVoid("CV", "APT", "APT2"));


        Grammar g2 = new Grammar();

        g2.category = GraphNode.Category.Bd_Massing;
        g2.name     = "AptFormA";
        g2.inputs.names.Add("APT");
        g2.AddRule(new Rules.Bisect("APT", new string[] { "APT", "C" }, 0.4f, 0), false);
        g2.AddRule(new Rules.Bisect("C", new string[] { "C", "APT" }, 0.25f, 2), false);
        g2.AddRule(new Rules.Scale3D("C", "APT", new Vector3(1.3f, 0.7f, 1.6f), null, Alignment.NE), false);


        g.AddRule(g2);
        //g.AddRule(new Rules.ExtractFace(new string[] { "APT" }, "TOP", "TOP"), false);
        //g.AddRule(new Rules.DivideToFTFH("APT", "APTL", 4));
        //g.AddRule(new Rules.DivideToFTFH("APT2", "APTL", 4));

        //g.AddRule(new Rules.DcpA("A", 9, 3));
        return(so);
    }