Hello.
I have yet another problem connected to my random generator. Well, technically two generators. You see, my generation scripts work like this:
First one creates random star constellation in which every star takes you to a “system level” after clicking it.
Second one creates random star system via this code (LiczbaPlanet means number of planets):
using UnityEngine;
using System.Collections;
public class Generatorv2 : MonoBehaviour {
public Transform Sun;
public GameObject prefab;
private float currDist = 20f;
private float minDist = 40f; // Minimum distance from the previous planet
private float maxDist = 50f;
private float RandomFloat;
private float LiczbaPlanet;
void Start() {
LiczbaPlanet = Random.Range(1,9);
PlacePlanets();
}
void PlacePlanets() {
for (float i = 0f; i < LiczbaPlanet; i++) {
currDist = currDist + Random.Range(minDist, maxDist);
Vector3 v3 = Vector3.right * currDist;
v3 = Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up) * v3;
v3 += Sun.position;
Instantiate(prefab,new Vector3(v3.x, 0, v3.z), Quaternion.Euler(0,0,0));
}
}
void Update(){
}
}
Here’s an example of randlomly generated system:
Now to the problem/question:
Is there any way in which i could have particular stars (in the star contellation) assigned to one randomly generated star system, so it would work like this:
I click a star and the code generates a random star system, and when i close it and click again on the same star i would have same star system.
I appreciate any kind of help/answar.
-Xentarok
P.S. - My english isn’t very good, so forgive me my mistakes.
P.S.2 - If you have any questions about my question or you want more specific information, ask for it in the comment section.