コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }