public void UpdateConstructionSite(float deltaTime) { if (TransitionToDeconstructionStage) { if (ConstructionStorage.IsWaitingForResources() == false) { DeconstructionStorage = new Storage(Building, ConstructionStorage.Resources, true); ConstructionStorage = new StorageWithRequirements(Building, null); doNotLoadDeconstructionResources = true; if (Stage == ConstructionStage.Construction) { if (Prototype.ConstructionWithoutScaffolding) { Stage = ConstructionStage.Deconstruction; stageTimeLeft = constructionTime - stageTimeLeft; } else { if (GetStageCompletionPercentage() < 0.05f) { Stage = ConstructionStage.ScaffoldingDeconstruction; stageTimeLeft = StaticData.ScaffoldingConstructionTime; } else { Stage = ConstructionStage.Deconstruction; stageTimeLeft = StaticData.ScaffoldingConstructionTime - stageTimeLeft; } } } else if (Stage == ConstructionStage.ScaffoldingConstruction) { Stage = ConstructionStage.ScaffoldingDeconstruction; stageTimeLeft = constructionTime - stageTimeLeft; } TransitionToDeconstructionStage = false; } return; } if (WorkingCharacter == null) { jobReservationTimer -= deltaTime; if (jobReservationTimer < 0f) { jobReservation = null; } } if (timeWithoutWork > 0.2f) { WorkingCharacter = null; } timeWithoutWork += deltaTime; }
public Service(Building building) { Building = building; InputStorage = new StorageWithRequirements(building, Prototype.ConsumedResources); NeedFulfilled = Prototype.NeedFulfilled; NeedFulfillmentPerSecond = Prototype.NeedFulfillmentPerSecond; serviceDuration = Prototype.ServiceDuration; }
bool Consume() { if (InputStorage.AreRequirementsMet) { InputStorage = new StorageWithRequirements(Building, Prototype.ConsumedResources); GameManager.Instance.World.UnregisterResources(Prototype.ConsumedResources); return(true); } else { return(false); } }
public ConstructionSite(Building building, BuildingPrototype buildingPrototype, bool deconstruction) { Building = building; Prototype = buildingPrototype; world = GameManager.Instance.World; constructionTime = Prototype.ConstructionTime; Halted = false; if (deconstruction) { CanAbort = false; Stage = ConstructionStage.Deconstruction; stageTimeLeft = constructionTime; } else { CanAbort = true; if (Prototype.ConstructionWithoutScaffolding) { Stage = ConstructionStage.Construction; LoadRequiredResourcesForConstruction(); stageTimeLeft = constructionTime; } else { Stage = ConstructionStage.ScaffoldingConstruction; LoadRequiredResourcesForScaffoldingConstruction(); stageTimeLeft = StaticData.ScaffoldingConstructionTime; } } if (ConstructionStorage == null) { ConstructionStorage = new StorageWithRequirements(Building, null); } if (DeconstructionStorage == null) { DeconstructionStorage = new Storage(Building, null, true); } }
public Factory(Building building) { Building = building; productionTime = Prototype.ProductionTime; ProductionStarted = false; ProducesRobot = Prototype.ProducesRobot; IsNaturalDeposit = Prototype.IsNaturalDeposit; if (Prototype.ProductionCyclesLimitMax < 0) { RemainingProductionCycles = -1; } else { RemainingProductionCycles = UnityEngine.Random.Range(Prototype.ProductionCyclesLimitMin, Prototype.ProductionCyclesLimitMax + 1); } StartingProductionCycles = RemainingProductionCycles; InputStorage = new StorageWithRequirements(Building, Prototype.ConsumedResources); OutputStorage = new Storage(Building, null); }
void LoadResourcesFromDeconstruction() { ConstructionStorage = new StorageWithRequirements(Building, null); DeconstructionStorage = new Storage(Building, Prototype.ResourcesFromDeconstruction, true); }
void LoadRequiredResourcesForScaffoldingConstruction() { ConstructionStorage = new StorageWithRequirements(Building, Prototype.ResourcesForScaffoldingConstruction); DeconstructionStorage = new Storage(Building, null); }