// 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(); }
// 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(); }
// This method creates the solar system view after a star is clicked on in the galaxy view public void CreateSolarSystem(Star star) { 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); } galaxyViewButton.interactable = true; }
// This method creates the solar system view after a star is clicked on in the galaxy view public void CreateSolarSystem(Star star) { GameObject starGO = GameObject.CreatePrimitive(PrimitiveType.Sphere); starGO.transform.position = Vector3.zero; starGO.name = star.starName; starGO.transform.SetParent(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); } }
// This method creates the solar system view after a star is clicked on in the galaxy view public void CreateSolarSystem(Star star) { 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); } galaxyViewButton.interactable = true; }
public void CreateSolarSystem(Star star) { CameraController.Instance.ResetCamera(); Random.InitState(Galaxy.Instance.seedNumber); Galaxy.Instance.GalaxyView = false; Galaxy.Instance.PathView = false; var mainStar = SpaceObjects.CreateSphereObject(star.StarName, Vector3.zero, star.StarSize, this.transform); mainStar.GetComponent <Renderer>().material.color = SpaceObjects.StarColors[star.ColorIndex]; for (int i = 0; i < star.NumberOfPlanets; i++) { PlanetaryObject planet = star.PlanetList[i]; if (planet.PlanetType != "Empty") { var position = PositionMath.PlanetPosition(i); SpaceObjects.CreateSphereObject(planet.PlanetName, position, planet.PlanetSize, this.transform); //var orbit = SpaceObjects.CreateOrbitPath(OrbitSpritePrefab, planet.PlanetName + "Orbit", i + 1, this.transform); var orbit = SpaceObjects.CreateOrbitRing(OrbitCirclePrefab, "Orbit " + i, i + 1, this.transform); var circle = orbit.GetComponent <Circle>(); circle.SetupCircle(); if (i < 3) { circle.SetColor(Color.yellow, Color.yellow); } else if (i == 3) { circle.SetColor(Color.green, Color.green); } else { circle.SetColor(Color.blue, Color.blue); } } } galaxyViewButton.interactable = true; pathViewButton.interactable = false; SystemDetailsText.text = star.Details(2); }