public PlanetController TryCreateRandomPlanet(Transform parent) { float scale = Random.Range(planetScaleRange.x, planetScaleRange.y); PlanetController planet = CreatePlanet(); PlanetSettings settings = planet.GetSettings(); settings.Scale = scale; settings.ShipsAmount = (int)Random.Range(planeEscadrilleAmountRange.x, planeEscadrilleAmountRange.y); settings.OwnerID = 0; planet.Setup(settings); Vector3 point; if (TryGetSpawnPoint(planet, out point)) { planet.transform.position = point; planet.transform.parent = parent; return(planet); } else { DeletePlanet(planet); return(null); } }
private void PlayerOwnedPlanet(PlanetController planet) { PlanetSettings settings = planet.GetSettings(); settings._Color = playerColor; settings.ShipsProductionRate = playerShipsProductionRate; settings.OwnerID = 1; planet.Setup(settings); playersPlanets.Add(planet); }
private void GenerateGame() { GenerateMap(); PlanetController rndPlanet = planetFactory.GetRandomPlanet(); playersPlanets = new List <PlanetController>(); PlayerOwnedPlanet(rndPlanet); PlanetSettings settings = rndPlanet.GetSettings(); settings.ShipsAmount = playerBaseShips; rndPlanet.Setup(settings); }