private void UpdateMass() { float massEmpty = QPatch.Configuration.Config.CollectorEmptyMass; float massFull = QPatch.Configuration.Config.CollectorFullMass; if (GaspodCollectorStorage != null) { this.rigidbody.mass = (massFull - massEmpty) * (GaspodCollectorStorage.GetStorageAmount() / (float)QPatch.Configuration.Config.StorageLimit) + massEmpty; } }
internal void Save(SaveData saveData) { var prefabIdentifier = GetComponent <PrefabIdentifier>(); var id = prefabIdentifier.Id; if (_savedData == null) { _savedData = new SaveDataEntry(); } _savedData.ID = id; _savedData.GaspodAmount = GaspodCollectorStorage.GetStorageAmount(); _savedData.BodyColor = ColorManager.GetColor().ColorToVector4(); _savedData.Batteries = PowerManager.GetBatteries(); saveData.Entries.Add(_savedData); }
public override bool CanDeconstruct(out string reason) { if (IsBeaconAttached()) { reason = GaspodCollectorBuildable.RemoveBeacon(); return(false); } if (GaspodCollectorStorage != null && GaspodCollectorStorage.GetStorageAmount() > 0) { reason = GaspodCollectorBuildable.NotEmpty(); return(false); } if (PowerManager != null && PowerManager.HasPower()) { reason = GaspodCollectorBuildable.HasBatteries(); return(false); } reason = string.Empty; return(true); }