Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float x;
- float z;
- float theta = 0;
- float r = 4;
- float rIncrement = 1;
- List<Planet> planets = new List<Planet>();
- do
- {
- if(Random.Range(0,10) <= 7)
- {
- float t = Mathf.Deg2Rad*theta;
- Transform planet = Transform.Instantiate(PlanetPrefab) as Transform;
- x = Mathf.Sin(t)*r;
- z = Mathf.Cos(t)*r;
- planets.Add (p);
- }
- theta += Random.Range(18, 36*5);
- if(theta >= Mathf.PI)
- {
- theta-=Mathf.PI;
- r+=rIncrement;
- if(r >= 50)
- rIncrement = -1;
- if(r <= 5)
- rIncrement = +1;
- }
- }while(planets.Count < 50);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement