Beyond_Beyaan.Planet.SetCleanup C# (CSharp) Метод

SetCleanup() публичный Метод

public SetCleanup ( ) : void
Результат void
        public void SetCleanup()
        {
            float cleanupNeeded = Waste; //Start with any leftover waste from last turn
            float factoriesOperated = TotalPopulation > (Factories / Owner.TechnologyManager.RoboticControls)
                                        ? Factories
                                        : (TotalPopulation * Owner.TechnologyManager.RoboticControls);
            cleanupNeeded += factoriesOperated * _owner.TechnologyManager.IndustryWasteRate;
            if (cleanupNeeded > _populationMax - 10)
            {
                cleanupNeeded = _populationMax - 10;
            }
            float amountOfProductionUsed = (cleanupNeeded / (ActualProduction * _owner.TechnologyManager.IndustryCleanupPerBC)) * 100;
            int percentage = (int)amountOfProductionUsed + ((amountOfProductionUsed - (int)amountOfProductionUsed) > 0 ? 1 : 0);

            //Check if we need to set the minimum environment cleanup
            if (EnvironmentAmount < percentage ||
                (TotalPopulation >= TotalMaxPopulation &&
                ((EnvironmentBonus == PLANET_ENVIRONMENT_BONUS.HOSTILE && !_owner.TechnologyManager.HasAtmosphericTerraform) ||
                (EnvironmentBonus == PLANET_ENVIRONMENT_BONUS.AVERAGE && !_owner.TechnologyManager.HasSoilEnrichment) ||
                (EnvironmentBonus != PLANET_ENVIRONMENT_BONUS.GAIA && EnvironmentBonus != PLANET_ENVIRONMENT_BONUS.HOSTILE && !_owner.TechnologyManager.HasAdvancedSoilEnrichment))))
            {
                //Only set it if it's below the desired amount
                SetOutputAmount(OUTPUT_TYPE.ENVIRONMENT, percentage, true);
            }
        }

Usage Example

Пример #1
0
 public void SetHomeSystem(StarSystem homeSystem, Planet homePlanet)
 {
     selectedSystem = homeSystem;
     lastSelectedSystem = homeSystem;
     PlanetManager.AddOwnedPlanet(homePlanet);
     FleetManager.SetupStarterFleet(homeSystem);
     homePlanet.ShipBeingBuilt = FleetManager.CurrentDesigns[0];
     homePlanet.SetCleanup();
     homePlanet.UpdateOutputs();
 }