Exemple #1
0
        //internal void Process(Game game, List<StarSystem> systems, int deltaSeconds)
        //{
        //    if (game.CurrentDateTime - _lastRun < game.Settings.EconomyCycleTime)
        //    {
        //        return;
        //    }

        //    _lastRun = game.CurrentDateTime;

        //    if (game.Settings.EnableMultiThreading ?? false)
        //    {
        //        Parallel.ForEach(systems, system => ProcessSystem(system));
        //    }
        //    else
        //    {
        //        foreach (var system in systems) //TODO thread this
        //        {
        //            ProcessSystem(system);
        //        }
        //    }
        //}

        internal static void ProcessSystem(EntityManager manager)
        {
            Game game = manager.Game;

            //Action<StarSystem> economyMethod = ProcessSystem;
            //system.SystemSubpulses.AddSystemInterupt(system.Game.CurrentDateTime + system.Game.Settings.EconomyCycleTime, economyMethod);
            manager.ManagerSubpulses.AddSystemInterupt(manager.Game.CurrentDateTime + manager.Game.Settings.EconomyCycleTime, PulseActionEnum.EconProcessor);


            TechProcessor.ProcessSystem(manager, game);

            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyMinesDB>())
            {
                MineProcessor.MineResources(colonyEntity);
            }
            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyRefiningDB>())
            {
                RefiningProcessor.RefineMaterials(colonyEntity, game);
            }
            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyConstructionDB>())
            {
                ConstructionProcessor.ConstructStuff(colonyEntity, game);
            }
            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyInfoDB>())
            {
                PopulationProcessor.GrowPopulation(colonyEntity);
            }
        }
Exemple #2
0
 public void OnComponentInstallation(Entity parentEntity, ComponentInstance componentInstance)
 {
     if (!parentEntity.HasDataBlob <ConstructionDB>())
     {
         parentEntity.SetDataBlob(new ConstructionDB());
     }
     ConstructionProcessor.ReCalcConstructionRate(parentEntity);
 }
Exemple #3
0
        public override void OnNewBatchJob()
        {
            ComponentDesign        componentInfo  = _factionInfo.ComponentDesigns[NewJobSelectedItem];
            int                    buildpointCost = componentInfo.BuildPointCost;
            Dictionary <Guid, int> mineralCost    = componentInfo.MineralCosts;
            Dictionary <Guid, int> materialCost   = componentInfo.MaterialCosts;
            Dictionary <Guid, int> componentCost  = componentInfo.ComponentCosts;

            ConstructionJob newjob = new ConstructionJob(NewJobSelectedItem, componentInfo.ConstructionType, NewJobBatchCount, buildpointCost, NewJobRepeat,
                                                         mineralCost, materialCost, componentCost);

            ConstructionProcessor.AddJob(_factionInfo, _colonyEntity_, newjob);
            Refresh();
        }
Exemple #4
0
 public void ProcessEntity(Entity entity, int deltaSeconds)
 {
     ConstructionProcessor.ConstructStuff(entity);
 }