Пример #1
0
        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);
            }
        }
Пример #2
0
        private void PlayerOwnedPlanet(PlanetController planet)
        {
            PlanetSettings settings = planet.GetSettings();

            settings._Color = playerColor;
            settings.ShipsProductionRate = playerShipsProductionRate;
            settings.OwnerID             = 1;
            planet.Setup(settings);

            playersPlanets.Add(planet);
        }
Пример #3
0
        private void GenerateGame()
        {
            GenerateMap();
            PlanetController rndPlanet = planetFactory.GetRandomPlanet();

            playersPlanets = new List <PlanetController>();
            PlayerOwnedPlanet(rndPlanet);

            PlanetSettings settings = rndPlanet.GetSettings();

            settings.ShipsAmount = playerBaseShips;
            rndPlanet.Setup(settings);
        }
Пример #4
0
        public void Setup(PlanetSettings settings)
        {
            planetImg.color = settings._Color;

            planetImg.transform.localScale      =
                glowEffect.transform.localScale = Vector3.one * settings.Scale;
            planetCollider.radius = cachedColliderSize * settings.Scale;

            ShipsAmount         = settings.ShipsAmount;
            ShipsProductionRate = settings.ShipsProductionRate;

            txtMesh.color = settings.TxtColor;
            OwnerID       = settings.OwnerID;
        }
Пример #5
0
 public PlanetSettingsBuilder()
 {
     settings = new PlanetSettings();
 }