public static void Create() { GameObject objSpace = MonoBehaviour.Instantiate(SceneDataHandler.GetPrefab(SpaceObjectPrefab.Space), new Vector3(0, 0, 0), Quaternion.identity); objSpace.name = "Space"; objSpace.transform.SetParent(SceneDataHandler.Scene.transform); Space _space = objSpace.GetComponent <Space>(); //_space.Coordinates = Sector[] _sectors = SectorGenerator.Create(_space, 1); _space.SetChild(_sectors); //space.index = GenerateIndex(); }
public static Moon[] Create(Planet planet, int amount) { _moons = new Moon[amount]; for (int index = 1, i = 0; i < amount; index++, i++) { GameObject objMoon = MonoBehaviour.Instantiate(SceneDataHandler.GetPrefab(SpaceObjectPrefab.Moon), new Vector3(0, 0, 0), Quaternion.identity); _moons[i] = objMoon.GetComponent <Moon>(); //sectors[i].index = GenerateIndex(index.ToString()); _moons[i].SetPosition(new Coordinates(Random.Range(50, 100), 0, 0, 5, planet.Position.scale)); //sectors[i].Name = objMoon.name = "Moon:"; // + sectors[i].index; objMoon.transform.SetParent(planet.transform); } return(_moons); }
public static Planet[] Create(Star star, int amount) { _planets = new Planet[amount]; for (int index = 1, i = 0; i < amount; index++, i++) { GameObject objPlanet = MonoBehaviour.Instantiate(SceneDataHandler.GetPrefab(SpaceObjectPrefab.Planet), new Vector3(0, 0, 0), Quaternion.identity); _planets[i] = objPlanet.GetComponent <Planet>(); //sectors[i].index = GenerateIndex(index.ToString()); _planets[i].SetPosition(new Coordinates(Random.Range(100, 500), 0, 0, 10, star.Position.scale)); //sectors[i].Name = Moon[] _moon = MoonGenerator.Create(_planets[i], 2); _planets[i].SetChild(_moon); objPlanet.name = "Planet:"; // + sectors[i].index; objPlanet.transform.SetParent(star.transform); } return(_planets); }
public static Star[] Create(Sector sector, int amount) { _stars = new Star[amount]; for (int index = 1, i = 0; i < amount; index++, i++) { GameObject objStar = MonoBehaviour.Instantiate(SceneDataHandler.GetPrefab(SpaceObjectPrefab.Star), new Vector3(0, 0, 0), Quaternion.identity); _stars[i] = objStar.GetComponent <Star>(); //sectors[i].index = GenerateIndex(index.ToString()); _stars[i].SetPosition(new Coordinates(0, 0, 0, 100, sector.Position.scale)); //sectors[i].Name = Planet[] _planet = PlanetGenerator.Create(_stars[i], 2); _stars[i].SetChild(_planet); objStar.name = "Star:"; // + sectors[i].index; objStar.transform.SetParent(sector.transform); } sector.SetChild(_stars); return(_stars); }
public static Sector[] Create(Space space, int amount) { _sectors = new Sector[amount]; for (int index = 1, i = 0; i < amount; index++, i++) { GameObject objSector = MonoBehaviour.Instantiate(SceneDataHandler.GetPrefab(SpaceObjectPrefab.Sector), new Vector3(0, 0, 0), Quaternion.identity); _sectors[i] = objSector.GetComponent <Sector>(); //sectors[i].index = GenerateIndex(index.ToString()); _sectors[i].SetPosition(new Coordinates(0, 0, 0, 10000)); //sectors[i].Name = Star[] _stars = StarGenerator.Create(_sectors[i], 1); _sectors[i].SetChild(_stars); objSector.name = "Sector:"; // + sectors[i].index; objSector.transform.SetParent(space.transform); } space.SetChild(_sectors); return(_sectors); }