internal override void Execute() { Level Level = this.Device.GameMode.Level; Building Building = (Building)Level.GameObjectManager.Filter.GetGameObjectById(this.BuildingId); if (Building != null) { if (Globals.CollectAllResourcesAtOnce) { List <GameObject> Buildings = Level.GameObjectManager.Filter.GetGameObjectsByData(Building.Data); for (int i = 0; i < Buildings.Count; i++) { Building building = (Building)Buildings[i]; if (!building.Constructing) { ResourceProductionComponent ResourceProductionComponent = building.ResourceProductionComponent; ResourceProductionComponent?.CollectResources(); } } } else { ResourceProductionComponent ResourceProductionComponent = Building.ResourceProductionComponent; ResourceProductionComponent?.CollectResources(); } } }
/// <summary> /// Executes this instance. /// </summary> internal override void Execute(Level Level) { Building Building = (Building)Level.GameObjectManager.Filter.GetGameObjectById(this.Id); if (Building != null) { if (Globals.CollectAllResourcesAtOnce) { List <GameObject> Buildings = Level.GameObjectManager.Filter.GetGameObjectsByData(Building.Data); Buildings.ForEach(GameObject => { Building building = (Building)GameObject; if (!building.Constructing) { ResourceProductionComponent ResourceProductionComponent = building.ResourceProductionComponent; if (ResourceProductionComponent != null) { ResourceProductionComponent.CollectResources(); } } }); } else { ResourceProductionComponent ResourceProductionComponent = Building.ResourceProductionComponent; if (ResourceProductionComponent != null) { ResourceProductionComponent.CollectResources(); } } } }