Ejemplo n.º 1
0
    public void GenerateStarSystemHUD(PlanetData[] planets)
    {
        orbitHUDs = new OrbitHUD[planets.Length];

        for (int i = 0; i < orbitHUDs.Length; i++)
        {
            PlanetData planet = planets[i];

            // generate the paths
            GameObject instantiatedHUD = Instantiate(orbitHUDPrefab);

            int orbitRadius = planet.orbitRadius;
            instantiatedHUD.transform.localScale = new Vector3(orbitRadius, orbitRadius, orbitRadius);

            orbitHUDs[i] = instantiatedHUD.GetComponent <OrbitHUD>();
            orbitHUDs[i].SetRadius(orbitRadius);
            orbitHUDs[i].planetData = planet;

            // generate the planet objects
            GameObject instantiatedPlanetHUD = Instantiate(planetHUDPrefab);

            // set the planet size
            float planetRadius = planet.GetRadius();
            instantiatedPlanetHUD.transform.localScale = new Vector3(planetRadius, planetRadius, planetRadius);

            // set the orbit height
            instantiatedPlanetHUD.GetComponent <Orbit>().orbitRadius = planet.orbitRadius;
        }
    }