void RegenerateCavern() { C_GeneratedOnce = true; CaveGeneratorScript MapGen = C_CurrCavern.GetComponent <CaveGeneratorScript>(); MapGen.height = C_height; MapGen.width = C_width; MapGen.seed = C_seed; MapGen.generateRandomSeed = C_isRandomSeed; MapGen.fillPercent = C_randomFillPercent; MapGen.GenerateAtRunTime = GenerateInRunTime; MapGen.borderSize = C_borderSize; // MapGen.smoothness = C_smoothness; MapGen.generateEntrance = C_generateEntrance; MapGen.generateExits = C_generateExits; MapGen.generateGround = C_generateGround; GameObject w = C_CurrCavern.transform.Find("Walls").gameObject; w.GetComponent <MeshRenderer>().material = C_WallMat; GameObject c = C_CurrCavern.transform.Find("Cave").gameObject; c.GetComponent <MeshRenderer>().material = C_WallMat; GameObject gr = C_CurrCavern.transform.Find("CaveGround").gameObject; gr.GetComponent <MeshRenderer>().material = C_GroundMat; MapGen.meshGenerator.texTiling = C_texTiling; MapGen.meshGenerator.walls = w.GetComponent <MeshFilter>(); //C_Mesh; MapGen.meshGenerator.ground = gr.GetComponent <MeshFilter>(); MapGen.meshGenerator.cave = c.GetComponent <MeshFilter>(); if (!GenerateInRunTime) { MapGen.GenerateMap(); } }
void GenereateNewCavern() { C_GeneratedOnce = true; C_NumberofPresses++; //Make Game Object GameObject g = new GameObject(C_Name.ToString()); g.transform.position = C_Pos; //g.AddComponent<MeshFilter>(); //g.AddComponent<MeshRenderer>(); g.AddComponent <CaveGeneratorScript>(); g.AddComponent <CaveMeshGeneratorScript>(); CaveGeneratorScript MapGen = g.GetComponent <CaveGeneratorScript>(); MapGen.height = C_height; MapGen.width = C_width; MapGen.seed = C_seed; MapGen.generateRandomSeed = C_isRandomSeed; MapGen.fillPercent = C_randomFillPercent; MapGen.GenerateAtRunTime = GenerateInRunTime; MapGen.borderSize = C_borderSize; // MapGen.smoothness = C_smoothness; MapGen.generateEntrance = C_generateEntrance; MapGen.generateExits = C_generateExits; MapGen.generateGround = C_generateGround; MapGen.meshGenerator = g.AddComponent <CaveMeshGeneratorScript>(); GameObject w = new GameObject("Walls"); w.transform.parent = g.transform; w.transform.position = C_Pos; w.AddComponent <MeshFilter>(); w.AddComponent <MeshRenderer>(); w.GetComponent <MeshRenderer>().material = C_WallMat; GameObject c = new GameObject("Cave"); c.transform.parent = g.transform; c.transform.position = C_Pos; c.AddComponent <MeshFilter>(); c.AddComponent <MeshRenderer>(); c.GetComponent <MeshRenderer>().material = C_WallMat; GameObject gr = new GameObject("CaveGround"); gr.transform.parent = g.transform; gr.transform.position = C_Pos; gr.AddComponent <MeshFilter>(); gr.AddComponent <MeshRenderer>(); gr.GetComponent <MeshRenderer>().material = C_GroundMat; MapGen.meshGenerator.texTiling = C_texTiling; MapGen.meshGenerator.walls = w.GetComponent <MeshFilter>(); //C_Mesh; MapGen.meshGenerator.ground = gr.GetComponent <MeshFilter>(); MapGen.meshGenerator.cave = c.GetComponent <MeshFilter>(); if (!GenerateInRunTime) { MapGen.GenerateMap(); } C_CurrCavern = g; }