public override void Convert() { if (HasRover) { if (HasWater) { #warning needs to only push if amount < max AttachedRover.Data.Water.Push(WaterIn.Get(Matter.Water).Pull(WaterPerTickUnits)); } if (HasOxygen) { #warning needs to only push if amount < max AttachedRover.Data.Oxygen.Push(OxygenIn.Get(Matter.Oxygen).Pull(OxygenPerTickUnits)); } } }
private bool PullWater() { if (WaterIn != null) { float newWater = WaterIn.Get(Matter.Water).Pull(WaterPerSecond * Time.fixedDeltaTime); waterBuffer += newWater; Data.MatterHistory.Consume(Matter.Water, newWater); float waterThisTick = WaterPerSecond * Time.fixedDeltaTime; if (waterBuffer >= waterThisTick) { waterBuffer -= waterThisTick; return(true); } } return(false); }
protected virtual void FarmTick() { if (this.HasPower && this.IsOn && this.FlexData.IsWaterOn && this.FlexData.IsHeatOn) { cropFailureTicks = 0; if (this.WaterIn != null && !this.CanHarvest) { if (Data.Containers[Matter.Water].CurrentAmount < this.WaterConsumptionPerTickInUnits) { Data.Containers[Matter.Water].Push(WaterIn.Get(Matter.Water).Pull(this.WaterConsumptionPerTickInUnits)); } if (Data.Containers[Matter.Water].CurrentAmount >= this.WaterConsumptionPerTickInUnits) { oldBiomass = Data.Containers[Matter.Biomass].CurrentAmount; Data.Containers[Matter.Water].Pull(WaterConsumptionPerTickInUnits); Data.Containers[Matter.Biomass].Push(BiomassProductionPerTickInUnits); CheckForAmountChange(); if (CanHarvest) { ToggleHarvestTrigger(true); } } } } else { if (this.Data.Containers[Matter.Biomass].CurrentAmount > 0f) { float lossAmount = 0; if (!FlexData.IsHeatOn) { lossAmount += BiomassProductionPerTickInUnits * FrostBiomassDamageCoefficient; } if (!FlexData.IsWaterOn) { lossAmount += BiomassProductionPerTickInUnits * DroughtBiomassDamageCoefficient; } oldBiomass = Data.Containers[Matter.Biomass].CurrentAmount; Data.Containers[Matter.Biomass].Pull(lossAmount); CheckForAmountChange(); if (cropFailureTicks == 0) { //GuiBridge.Instance.ComputerAudioSource.PlayOneShot(CropFailure) cropFailureTicks++; } else if (cropFailureTicks > 59 * 2) { cropFailureTicks = 0; } else { cropFailureTicks++; } } } UpdateText(); }