public void Generate(float galaxySize, float armVal, float armInc, float armDensity, string newName) { float center = 512 + (12.00f * (galaxySize / 3.00f)); float x = (20.00f) * (6.00f + galaxySize / 12.00f); float y = (12.00f) * (6.00f + galaxySize / 12.00f); float z = (256.00f) * (6.00f + galaxySize / 12.00f); z *= Random.Range(-1.00f, 1.01f); x *= Random.Range(-1.00f, 1.01f); y *= Random.Range(-1.00f, 1.01f); //Creates a space in the center for a supermassive if (z >= 0) { z += center; } else if (z < 0) { z -= center; } Vector3 startPos = new Vector3(x, y, z); star_Type = (starType)Determine_Star_Type(); int spriteIndex = (int)star_Type; sprite.sprite = Galaxy_Generator.Get_Star_Sprite(spriteIndex); name = newName; Initialize_Name(); InitializeScale((starType)spriteIndex); SetStarEffectColors((starType)spriteIndex); InitializeOrbitalCenter(); rect.localPosition = startPos; rDistance = Vector3.Magnitude(new Vector3(rect.localPosition.x, 0, rect.localPosition.z)); float percent = (360.00000f * armVal); float roll = Random.Range(0.00000f, armDensity); float maxVal = (360.00000f * armInc) * roll; percent += Random.Range(0.00000f, maxVal); IEnumerator thing = RotateAroundGalaxyCenter(percent); StartCoroutine(thing); InitializeMovement(); for (int i = 0; i < 240; i++) { RotateAroundGalaxyCenter(256 * movement); } Generate_Solar_System(); }
private void SetStarEffectColors(starType sType) { Color32 glowColor = Icon_Controller.Get_Star_Haze_Color(sType); Color32 hazeColor = Icon_Controller.Get_Star_Glow_Color(sType); glowColor.a -= 4; effects.Set_Glow(glowColor); effects.Set_Haze(hazeColor); }
private void InitializeScale(starType sType) { int t = (int)sType; float scaleMult = 1; float scaler = Random.Range(.5f, 1.01f); if (t == 0) { scaleMult = .40f; } //Black Hole else if (t == 1) { scaleMult = .50f; } //Blue else if (t == 2) { scaleMult = .80f; } //Blue Super else if (t == 3) { scaleMult = .70f; } //Pulsar else if (t == 4) { scaleMult = .25f; } //Red Dwarf else if (t == 5) { scaleMult = .85f; } //Red Giant else if (t == 6) { scaleMult = .25f; } //White Dwarf else if (t == 7) { scaleMult = .40f; } //Yellow scaler *= scaleMult; sprite.transform.localScale *= scaler; scale = sprite.transform.localScale.x; }