Exemple #1
0
 // Use this for initialization
 void Start()
 {
     if (model != null)
     {
         p_radius    = model.getParameter("Chair_radius");
         p_height    = model.getParameter("Chair_height");
         p_thickness = model.getParameter("Chair_thickness");
     }
 }
Exemple #2
0
    void GenerateHouse()
    {
        //ensures houses are created in a horizontal line
        float oldRandX = randX;

        randX = Random.Range(SizeRange.x, SizeRange.y);
        randY = Random.Range(SizeRange.x, SizeRange.y);
        randZ = Random.Range(SizeRange.x, SizeRange.y);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            distX += (10.2f * randX) + (10.2f * oldRandX);
        }

        if (Input.GetKeyDown(KeyCode.RightShift) || Input.GetKeyDown(KeyCode.LeftShift))
        {
            distX  = posX;
            distZ += (27.5f * SizeRange.y);
        }

        //Creates a new house
        AXModel newModel = Instantiate(model, new Vector3(distX, model.transform.position.y, distZ), Quaternion.identity);

        GenerateDesign(newModel);

        //changes the width of the landscape
        newModel.getParameter("Full House_Scale_X").initiateRipple_setFloatValueFromGUIChange(randX);
        //newModel.GetComponentInChildren<TerrainGenerator>().scaleX = randX;
        //field.scaleX = randX;

        //changes the height of the landscape
        newModel.getParameter("Full House_Scale_Y").initiateRipple_setFloatValueFromGUIChange(randY);
        //newModel.GetComponentInChildren<TerrainGenerator>().scaleY = randY;
        //field.scaleY = randY;

        //changes the length of the landscape
        newModel.getParameter("Full House_Scale_Z").initiateRipple_setFloatValueFromGUIChange(randZ);
        //newModel.GetComponentInChildren<TerrainGenerator>().scaleZ = randZ;
        //field.scaleZ = randZ;

        GenerateBackyard(newModel);

        newModel.build();
    }
Exemple #3
0
    void GenerateBackyard(AXModel mod)
    {
        //changes the backyard content
        float choice = Random.Range(0f, 1f);

        mod.getParameter("Chair_Enabled").initiateRipple_setBoolValueFromGUIChange(false);
        mod.getParameter("Pool_Enabled").initiateRipple_setBoolValueFromGUIChange(false);
        mod.getParameter("Statue_Enabled").initiateRipple_setBoolValueFromGUIChange(false);

        if (choice < .4f)
        {
            //changes the position of the chair
            mod.getParameter("Chair_Enabled").initiateRipple_setBoolValueFromGUIChange(true);
            mod.getParameter("Chair_Trans_X").initiateRipple_setFloatValueFromGUIChange(Random.Range(-8.5f, 9.5f));
            mod.getParameter("Chair_Trans_Z").initiateRipple_setFloatValueFromGUIChange(Random.Range(-3.5f, 2.5f));
            mod.getParameter("Chair_Rot_Y").initiateRipple_setFloatValueFromGUIChange(Random.Range(0f, 360f));
        }

        else if (choice < .65f)
        {
            //changes the scale of the pool
            mod.getParameter("Pool_Enabled").initiateRipple_setBoolValueFromGUIChange(true);
            mod.getParameter("Pool_Scale_X").initiateRipple_setFloatValueFromGUIChange(Random.Range(0.5f, 2.5f));
            mod.getParameter("Pool_Scale_Y").initiateRipple_setFloatValueFromGUIChange(Random.Range(0.1f, 1.5f));
            mod.getParameter("Pool_Scale_Z").initiateRipple_setFloatValueFromGUIChange(Random.Range(0.1f, 1f));

            //changes the pool to a new random material
            int index = Random.Range(0, Pool.Count);
            swimmingPool.parametricObject.axMat.mat = Pool[index];
        }

        else
        {
            //changes the scale/position of the statue
            float scaleX = Random.Range(0.5f, 4.5f);
            float scaleZ = Random.Range(0.5f, 1.5f);
            mod.getParameter("Statue_Enabled").initiateRipple_setBoolValueFromGUIChange(true);
            mod.getParameter("Statue_Scale_X").initiateRipple_setFloatValueFromGUIChange(scaleX);
            mod.getParameter("Statue_Scale_Z").initiateRipple_setFloatValueFromGUIChange(scaleZ);
            mod.getParameter("Statue_Rot_Y").initiateRipple_setFloatValueFromGUIChange(Random.Range(0f, 360f));
            mod.getParameter("Statue_Trans_X").initiateRipple_setFloatValueFromGUIChange(Random.Range(-10f + scaleX, 10f - scaleX));
            mod.getParameter("Statue_Trans_Z").initiateRipple_setFloatValueFromGUIChange(Random.Range(-3f + scaleX, 3f - scaleX));

            //changes the statue to a new random material
            int index1 = Random.Range(0, Statue.Count);
            monument.parametricObject.axMat.mat = Statue[index1];
        }
    }