public override void OnInspectorGUI() { DrawDefaultInspector(); GeneratePlanet myScript = (GeneratePlanet)target; if (GUILayout.Button("Create Planet")) { myScript.CreatePlanet(); } }
/* * Create a planet creation button on the inspector */ public override void OnInspectorGUI() { EditorGUILayout.HelpBox("GenerateMapRange value must be less than the PlanetDetail value!", MessageType.Warning); DrawDefaultInspector(); if (GUILayout.Button("GeneratePlanet")) { GeneratePlanet generatePlanet = (GeneratePlanet)target; generatePlanet._GeneratePlanet(); } }
// Use this for initialization void Start() { chunklength = localVars.chunklength; GetPlayers(); ChunkListReady = false; thisx = (int)this.transform.position.x; thisy = (int)this.transform.position.y; thisz = (int)this.transform.position.z; loadRangeSq = loadRange * loadRange; planetSize = GetPlanetSize(PlanetType); planetchunks = new PlanetChunk[(planetSize / chunklength) + 1, (planetSize / chunklength) + 1, (planetSize / chunklength) + 1]; length = (planetSize / chunklength) + 1; ischunkloaded = new bool[(planetSize / chunklength) + 1, (planetSize / chunklength) + 1, (planetSize / chunklength) + 1]; planetSeed = GetPlanetSeed(); path = Application.persistentDataPath + "/Planet " + planetSeed + "/Chunks/"; StarDistance = GetDistanceFromStar(); GetPlanetType(); Temperature = GetPlanetTemperature(Temperature); Generator = new GeneratePlanet(); for (int x = 1; x <= planetSize / chunklength; x++) { for (int y = 1; y <= planetSize / chunklength; y++) { for (int z = 1; z <= planetSize / chunklength; z++) { ischunkloaded[x, y, z] = false; } } } }
private void Awake() { generate = this; }