// Persistant Functions // ---------------------------------------------------------------------------- void Start() { seedHandler = GameObject.Find("seedHandler").GetComponent("seedHandler") as seedHandler; Random.seed = seedHandler.currentSeed; seedToModify = Random.Range (0,2048); Generate(false); }
// Use this for initialization void Start() { seedHandler = GameObject.Find("seedHandler").GetComponent("seedHandler") as seedHandler; Random.seed = (int)seedHandler.getPlanetSeed(); namePicked = generateNavigationalInfo(); transform.name = namePicked; }
void Start() { seedHandler = GameObject.Find("seedHandler").GetComponent("seedHandler")as seedHandler; Random.seed = seedHandler.currentSeed; createStarSystem(); }
// Persistant Functions // ---------------------------------------------------------------------------- void Start() { seedHandler = GameObject.Find("seedHandler").GetComponent("seedHandler") as seedHandler; Generate(); }
// Use this for initialization void Start() { seedHandler = GameObject.Find("seedHandler").GetComponent("seedHandler")as seedHandler; updateName (); }
public void Start() { seedHandler = GameObject.Find("seedHandler").GetComponent("seedHandler")as seedHandler; Random.seed = seedHandler.currentSeed; Texture2D texture = new Texture2D(768, 768, TextureFormat.ARGB32, false); // Create a new 1024x1024 texture ARGB32 (32 bit with alpha) and no mipmaps Material skyboxMaterial = new Material (Shader.Find("Mobile/Skybox")); // Create a new material for the skybox. //TODO// /* * Make our own skybox shader of pretty awesome. * * */ string[] skyboxTextures = new string[] {"_FrontTex", "_BackTex", "_LeftTex", "_RightTex", "_UpTex", "_DownTex"}; // The skybox textures names Color color; // Color that will be set for each pixel // Create 6 different textures to use as skybox for (int i = 0;i < 6; i++) { // Loop horizontally on all pixel for(int x = 0; x < texture.width; x++) { // Loop vertically on all pixel for(int y = 0; y < texture.height; y++) { float randomValue = Random.Range (0.0f,1.0f); // Random value between 0 and 1 randomValue = randomValue * (galacticDistance+.1f); if(randomValue < 0.00015f) // 0.1% Of the pixel are set to a grey/white pixel with varying transparency { float colorValue = Random.Range (0.6f,1.0f); //Random value to use as RGB value for color color = new Color(colorValue,colorValue,colorValue,Random.Range (0.5f,(galacticDistance*255))); // Set the pixel to a white/grey color with variying transparency texture.SetPixel(x, y, color); // Set the pixel at (x,y) coordinate as the Color in color } else if(randomValue < 0.00015f && x > 0 && y > 0) // 0.05% Of the pixels that aren't on the first row/column { float colorValue = Random.Range (0.85f,1.0f); //Random value to use as RGB value for color color = new Color(colorValue,colorValue,125f,Random.Range (0.6f,(galacticDistance*255))); // Set the pixel to a yellowish color with variying transparency // Set a square of 4 pixels to the current color. The 3 other pixel have been stepped on earlier so their color won't be modified afterward texture.SetPixel(x, y, color); texture.SetPixel(x-1, y, color); texture.SetPixel(x, y-1, color); texture.SetPixel(x-1, y-1, color); } else if(randomValue > 0.0015f && randomValue < 0.035f && x > 0 && y > 0) { texture.SetPixel(x, y, Color.black); } else if(randomValue > 0.0015f && randomValue < 0.98f) //Create nebula { texture.SetPixel(x, y, Color.black); } else { float colorValue = Random.Range (0.6f,1.0f); //Random value to use as RGB value for color color = new Color(colorValue,colorValue,colorValue,Random.Range (0.0f,galacticDistance)); // Set the pixel to a white/grey color with variying transparency texture.SetPixel(x, y, color); // Set the pixel at (x,y) coordinate as the Color in color } } } // Apply all SetPixel calls texture.Apply(); // Set the current texture on one side of the skybox skyboxMaterial.SetTexture(skyboxTextures[i],texture); } // Set the RenderSettings skybox to the created material RenderSettings.skybox = skyboxMaterial; starfieldHandler.RefreshStars(); }