Ejemplo n.º 1
0
    // This method creates the solar system view after a star is clicked on in the galaxy view
    public void CreateSolarSystem(Star star)
    {
        CameraController.cameraController.ResetCamera();

        Galaxy.GalaxyInstance.selectionIcon.SetActive(false);

        Random.InitState(Galaxy.GalaxyInstance.seedNumber);

        Galaxy.GalaxyInstance.galaxyView = false;

        SpaceObjects.CreateSphereObject(star.starName, Vector3.zero, this.transform);

        for (int i = 0; i < star.planetList.Count; i++)
        {
            Planet planet = star.planetList[i];

            Vector3 planetPos = PositionMath.PlanetPosition(i);

            SpaceObjects.CreateSphereObject(planet.planetName, planetPos, this.transform);

            GameObject orbit = SpaceObjects.CreateOrbitPath(OrbitSpritePrefab, planet.planetName + " Orbit", i + 1, this.transform);
        }

        galaxyViewButton.interactable = true;
        buildShipButton.interactable  = true;

        storeMaxZoom = CameraController.cameraController.maxZoom;
        CameraController.cameraController.maxZoom = solarSystemZoom;

        fleetManager.EnableFleets();
    }
Ejemplo n.º 2
0
    // This method creates the solar system view after a star is clicked on in the galaxy view
    public void CreateSolarSystem(Star star)
    {
        planetToGameObjectMap = new Dictionary <Planet, GameObject>();

        CameraController.cameraController.ResetCamera();

        Galaxy.GalaxyInstance.selectionIcon.SetActive(false);

        Random.InitState(Galaxy.GalaxyInstance.seedNumber);

        Galaxy.GalaxyInstance.galaxyView = false;

        GameObject starGO = SpaceObjects.CreateSphereObject(star.starName, Vector3.zero, this.transform);

        if (star.starOwned == true)
        {
            starGO.GetComponent <MeshRenderer>().material = starOwnedMaterial;
        }

        for (int i = 0; i < star.planetList.Count; i++)
        {
            Planet planet = star.planetList[i];

            Vector3 planetPos = PositionMath.PlanetPosition(i);

            GameObject planetGO = SpaceObjects.CreateSphereObject(planet.planetName, planetPos, this.transform);

            if (planet.planetColonised == true)
            {
                planetGO.GetComponent <MeshRenderer>().material = planetColonisedMaterial;
            }

            GameObject orbit = SpaceObjects.CreateOrbitPath(OrbitSpritePrefab, planet.planetName + " Orbit", i + 1, this.transform);

            if (planet.planetColonised == true && planet.starBase == null)
            {
                BuildStarBase(planet, planetGO);
            }
            else if (planet.planetColonised == true && planet.starBase != null)
            {
                CreateStarBase(planet, planetGO);
            }

            planetToGameObjectMap.Add(planet, planetGO);
        }

        galaxyViewButton.interactable = true;
        buildShipButton.interactable  = true;

        storeMaxZoom = CameraController.cameraController.maxZoom;
        CameraController.cameraController.maxZoom = solarSystemZoom;

        fleetManager.EnableFleets();
    }