public MyGuiControlUseProperties(IMyGuiControlsParent parent, Vector2 position, MyUseProperties useProperties, Vector4 labelColor) : base(parent, position, new Vector2(0.7f, 0.35f), Vector4.Zero, null, MyGuiManager.GetBlankTexture()) { m_labelColor = labelColor; m_useProperties = useProperties; InitControls(); }
public void SaveTo(MyUseProperties useProperties) { useProperties.UseType = MyUseType.None; if (m_useSoloCheckbox.Checked) { useProperties.UseType |= MyUseType.Solo; } if (m_useHUBCheckbox != null && m_useHUBCheckbox.Checked) { useProperties.UseType |= MyUseType.FromHUB; } useProperties.HackType = MyUseType.None; if (m_hackSoloCheckbox.Checked) { useProperties.HackType |= MyUseType.Solo; } if (m_hackHUBCheckbox != null && m_hackHUBCheckbox.Checked) { useProperties.HackType |= MyUseType.FromHUB; } useProperties.HackingTime = (int)double.Parse(m_hackingTimeTextbox.Text.Trim()); useProperties.HackingLevel = m_hackingLevelCombobox.GetSelectedKey(); useProperties.IsHacked = m_isHackedCheckbox.Checked; }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { MyMwcObjectBuilder_PrefabGenerator objectBuilderGenerator = objectBuilder as MyMwcObjectBuilder_PrefabGenerator; UseProperties = new MyUseProperties(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB | MyUseType.Solo); if (objectBuilder.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB | MyUseType.Solo, 1, 4000, false); } else { UseProperties.Init(objectBuilder.UseProperties); } }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { UseProperties = new MyUseProperties(MyUseType.FromHUB | MyUseType.Solo, MyUseType.None); if (objectBuilder.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB | MyUseType.Solo, MyUseType.None, 0, 1, false); } else { UseProperties.Init(objectBuilder.UseProperties); } Enabled = true; }
public void Init(StringBuilder hudLabelText, MyMwcObjectBuilder_Drone droneBuilder, MyModelsEnum?modelCollision = null, MyModelsEnum?modelLod2 = null, float?scale = null) { var modelLod0Enum = GetModelLod0Enum(droneBuilder.DroneType); MyEntity owner = null; base.Init(hudLabelText, modelLod0Enum, null, owner, scale, droneBuilder, modelCollision, modelLod2); SetWorldMatrix(droneBuilder.PositionAndOrientation.GetMatrix()); m_fired = false; m_shipTypeProperties = new MyShipTypeProperties(); m_reflectorProperies = new MyReflectorConfig(this); Faction = droneBuilder.Faction; Save = true; m_function = MyDroneFunction.None; InitWeapons(); InitEntityDetector(); InitPhysics(droneBuilder.DroneType); InitAI(); InitSpoiledHolograms(); InitInventory(droneBuilder.Inventory); // back camera is turned off by default Config.BackCamera.SetOff(); m_droneObjectBuilder = droneBuilder; UseProperties = new MyUseProperties(MyUseType.Solo, MyUseType.None, MyTextsWrapperEnum.NotificationYouCanTake); UseProperties.Init(MyUseType.Solo, MyUseType.None, 0, 1, false); HackingTool = new Tools.MyHackingTool(this, MySession.PlayerShip.HackingTool.HackingLevel); }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { prefabConfiguration = prefabConfig as MyPrefabConfigurationLargeWeapon; MyMwcObjectBuilder_PrefabLargeWeapon largeWeaponBuilder = objectBuilder as MyMwcObjectBuilder_PrefabLargeWeapon; weaponType = largeWeaponBuilder.PrefabLargeWeaponType; UseProperties = new MyUseProperties(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB); if (largeWeaponBuilder.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB, 1, 4000, false); } else { UseProperties.Init(largeWeaponBuilder.UseProperties); } // create & initialize weapon: MyLargeShipGunBase.CreateAloneWeapon(ref m_gun, displayName, Vector3.Zero, Matrix.Identity, largeWeaponBuilder, Activated); AddChild(m_gun); m_gun.PrefabParent = this; m_gun.Enabled = IsWorking(); m_gun.SetRandomRotation(); // if (largeWeaponBuilder.SearchingDistance == 2000) // largeWeaponBuilder.SearchingDistance = 1000; this.LocalMatrix = Matrix.CreateWorld(relativePosition, localOrientation.Forward, localOrientation.Up); m_searchingDistance = MathHelper.Clamp(largeWeaponBuilder.SearchingDistance, MyLargeShipWeaponsConstants.MIN_SEARCHING_DISTANCE, MyLargeShipWeaponsConstants.MAX_SEARCHING_DISTANCE); m_targetDetectorCriterias.Add(new MyEntityDetectorCriterium <MySmallShip>(1, IsPossibleTarget, true)); m_targetsDetector = new MyEntityDetector(true); m_potentialTargetsDetector = new MyEntityDetector(true); m_potentialTargetDetectorCriterias.Add(new MyEntityDetectorCriterium <MySmallShip>(1, IsPotentialTarget, true)); //m_targetsDetector.OnEntityEnter += OnTargetDetected; //m_targetsDetector.OnEntityLeave += OnTargetLost; m_targetsDetector.OnNearestEntityChange += OnNearestTargetChange; m_potentialTargetsDetector.OnNearestEntityChange += OnNearestPotentialTargetChange; //m_targetsDetector.OnEntityPositionChange += OnTargetPositionChanged; InitDetector(Activated); }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { MyMwcObjectBuilder_PrefabBankNode objectBuilderBankNode = objectBuilder as MyMwcObjectBuilder_PrefabBankNode; Cash = objectBuilderBankNode.Cash; UseProperties = new MyUseProperties(MyUseType.None, MyUseType.Solo); if (objectBuilderBankNode.UseProperties == null) { UseProperties.Init(MyUseType.None, MyUseType.Solo, 3, 4000, false); } else { UseProperties.Init(objectBuilderBankNode.UseProperties); } // some default cash for testing if (!UseProperties.IsHacked) { Cash = 8000f; } }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { MyMwcObjectBuilder_PrefabSecurityControlHUB objectBuilderSecurityControlHUB = (MyMwcObjectBuilder_PrefabSecurityControlHUB)objectBuilder; //m_connetectedEntitiesIds.AddRange(objectBuilderSecurityControlHUB.ConnectedEntities); UseProperties = new MyUseProperties(MyUseType.Solo, MyUseType.Solo); if (objectBuilderSecurityControlHUB.UseProperties == null) { UseProperties.Init(MyUseType.Solo, MyUseType.Solo, 1, 4000, false); } else { UseProperties.Init(objectBuilderSecurityControlHUB.UseProperties); } UpdateSound(); m_needsUpdate = true; }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { MyMwcObjectBuilder_PrefabScanner objectBuilderScanner = objectBuilder as MyMwcObjectBuilder_PrefabScanner; UseProperties = new MyUseProperties(MyUseType.FromHUB, MyUseType.FromHUB | MyUseType.Solo); if (objectBuilderScanner.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB | MyUseType.Solo, 3, 4000, false); } else { UseProperties.Init(objectBuilderScanner.UseProperties); } Size = objectBuilderScanner.Size; Color = objectBuilderScanner.Color; ScanningSpeed = objectBuilderScanner.ScanningSpeed; InitScanningPart(); Flags |= EntityFlags.EditableInEditor; }
public void Init() { Init(MyModelsEnum.RemoteCamera, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Camera, MyUniversalLauncherConstants.USE_SPHERE_PHYSICS); // initialize gameplay properties here: m_gameplayProperties = MyGameplayConstants.GetGameplayProperties(MyMwcObjectBuilderTypeEnum.SmallShip_Tool, (int)MyMwcObjectBuilder_SmallShip_Tool_TypesEnum.REMOTE_CAMERA, MyMwcObjectBuilder_FactionEnum.None); Debug.Assert(m_gameplayProperties != null); if (m_gameplayProperties != null) { MaxHealth = m_gameplayProperties.MaxHealth; Health = m_gameplayProperties.MaxHealth; } //Physics.RigidBody.RaiseFlag(RigidBodyFlag.RBF_COLDET_THROUGH_VOXEL_TRIANGLES); m_canByAffectedByExplosionForce = true; UseProperties = new MyUseProperties(MyUseType.Solo, MyUseType.None, MyTextsWrapperEnum.NotificationYouCanTake); UseProperties.Init(MyUseType.Solo, MyUseType.None, 0, 1, false); }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { MyPrefabConfigurationKinematic prefabKinematicConfig = (MyPrefabConfigurationKinematic)prefabConfig; MyMwcObjectBuilder_PrefabKinematic kinematicBuilder = objectBuilder as MyMwcObjectBuilder_PrefabKinematic; MyModel model = MyModels.GetModelOnlyDummies(m_config.ModelLod0Enum); for (int i = 0; i < prefabKinematicConfig.KinematicParts.Count; i++) { MyPrefabConfigurationKinematicPart kinematicPart = prefabKinematicConfig.KinematicParts[i]; MyModelDummy open, close; if (model.Dummies.TryGetValue(kinematicPart.m_open, out open) && model.Dummies.TryGetValue(kinematicPart.m_close, out close)) { float?kinematicPartHealth = kinematicBuilder.KinematicPartsHealth[i]; float?kinematicPartMaxHealth = kinematicBuilder.KinematicPartsMaxHealth[i]; uint? kinematicPartEntityId = kinematicBuilder.KinematicPartsEntityId[i]; // if health is not set or not destroyed, then create part if (kinematicPartHealth == null || kinematicPartHealth != 0) { MyPrefabKinematicPart newPart = new MyPrefabKinematicPart(m_owner); if (kinematicPartEntityId.HasValue) { newPart.EntityId = new MyEntityIdentifier(kinematicPartEntityId.Value); } Parts[i] = newPart; newPart.Init(this, kinematicPart, prefabKinematicConfig.m_openTime, prefabKinematicConfig.m_closeTime, (MyModelsEnum)kinematicPart.m_modelMovingEnum, open.Matrix, close.Matrix, prefabKinematicConfig.MaterialType, prefabKinematicConfig.m_soundLooping, prefabKinematicConfig.m_soundOpening, prefabKinematicConfig.m_soundClosing /*, m_groupMask*/, kinematicPartHealth, kinematicPartMaxHealth, Activated); } } } //make handler m_sensorHandler = new MyPrefabKinematicSensor(this); MySphereSensorElement sensorEl = new MySphereSensorElement(); sensorEl.Radius = DETECT_RADIUS; sensorEl.LocalPosition = new Vector3(0, 0, 0); sensorEl.DetectRigidBodyTypes = MyConstants.RIGIDBODY_TYPE_SHIP; sensorEl.SpecialDetectingAngle = DETECTION_ANGLE; MySensorDesc senDesc = new MySensorDesc(); senDesc.m_Element = sensorEl; senDesc.m_Matrix = WorldMatrix; senDesc.m_SensorEventHandler = m_sensorHandler; m_sensor = new MySensor(); m_sensor.LoadFromDesc(senDesc); MyPhysics.physicsSystem.GetSensorModule().AddSensor(m_sensor); GetOwner().UpdateAABB(); UseProperties = new MyUseProperties(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB); if (kinematicBuilder.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB, MyUseType.FromHUB, 3, 4000, false); } else { UseProperties.Init(kinematicBuilder.UseProperties); } UpdateHudAndCloseStatus(); }
protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig) { prefabConfiguration = prefabConfig as MyPrefabConfigurationLargeWeapon; MyMwcObjectBuilder_PrefabLargeWeapon largeWeaponBuilder = objectBuilder as MyMwcObjectBuilder_PrefabLargeWeapon; weaponType = largeWeaponBuilder.PrefabLargeWeaponType; UseProperties = new MyUseProperties(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB); if (largeWeaponBuilder.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB | MyUseType.Solo, MyUseType.FromHUB, 1, 4000, false); } else { UseProperties.Init(largeWeaponBuilder.UseProperties); } // create & initialize weapon: MyLargeShipGunBase.CreateAloneWeapon(ref m_gun, displayName, Vector3.Zero, Matrix.Identity, largeWeaponBuilder, Activated); AddChild(m_gun); m_gun.PrefabParent = this; m_gun.Enabled = IsWorking(); m_gun.SetRandomRotation(); // if (largeWeaponBuilder.SearchingDistance == 2000) // largeWeaponBuilder.SearchingDistance = 1000; this.LocalMatrix = Matrix.CreateWorld(relativePosition, localOrientation.Forward, localOrientation.Up); m_searchingDistance = MathHelper.Clamp(largeWeaponBuilder.SearchingDistance, MyLargeShipWeaponsConstants.MIN_SEARCHING_DISTANCE, MyLargeShipWeaponsConstants.MAX_SEARCHING_DISTANCE); m_targetDetectorCriterias.Add(new MyEntityDetectorCriterium<MySmallShip>(1, IsPossibleTarget, true)); m_targetsDetector = new MyEntityDetector(true); m_potentialTargetsDetector = new MyEntityDetector(true); m_potentialTargetDetectorCriterias.Add(new MyEntityDetectorCriterium<MySmallShip>(1, IsPotentialTarget, true)); //m_targetsDetector.OnEntityEnter += OnTargetDetected; //m_targetsDetector.OnEntityLeave += OnTargetLost; m_targetsDetector.OnNearestEntityChange += OnNearestTargetChange; m_potentialTargetsDetector.OnNearestEntityChange += OnNearestPotentialTargetChange; //m_targetsDetector.OnEntityPositionChange += OnTargetPositionChanged; InitDetector(Activated); }
public virtual void Init(string hudLabelText, MyMwcObjectBuilder_PrefabContainer objectBuilder, Matrix matrix) { m_intializing = true; StringBuilder hudLabelTextSb = (string.IsNullOrEmpty(hudLabelText) ? null : new StringBuilder(hudLabelText)); base.Init(hudLabelTextSb, null, null, null, null, objectBuilder); DisplayName = objectBuilder.DisplayName; SetWorldMatrix(matrix); Flags |= EntityFlags.EditableInEditor; this.Faction = objectBuilder.Faction; //during container initialization, it is not necessary to check if prefab is outside boundaries, because it cannot be saved that way foreach (MyMwcObjectBuilder_PrefabBase prefabBuilder in objectBuilder.Prefabs) { CreateAndAddPrefab(null, prefabBuilder); } // we must initialize inventory after prefabs, because some prefabs are registered on OnInventoryContentChanged event if (objectBuilder.Inventory != null) { Inventory.Init(objectBuilder.Inventory, MyMwcUtils.GetRandomFloat(1.1f, 2f)); } //Commit(); UpdateAABBHr(); // ----- THIS PHYSICS IS NEEDED BECAUSE ENTITY DETECTOR ----- this.Physics = new MyPhysicsBody(this, 1.0f, UseKinematicPhysics ? RigidBodyFlag.RBF_KINEMATIC : RigidBodyFlag.RBF_RBO_STATIC) { MaterialType = MyMaterialType.METAL }; MyPhysicsObjects physobj = MyPhysics.physicsSystem.GetPhysicsObjects(); MyRBBoxElementDesc boxDesc = physobj.GetRBBoxElementDesc(); boxDesc.SetToDefault(); boxDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(MyMaterialType.METAL).PhysicsMaterial; boxDesc.m_Size = UseKinematicPhysics ? WorldAABBHr.Size() : Vector3.One; boxDesc.m_CollisionLayer = UseKinematicPhysics ? MyConstants.COLLISION_LAYER_DEFAULT : MyConstants.COLLISION_LAYER_UNCOLLIDABLE; MyRBBoxElement boxEl = (MyRBBoxElement)physobj.CreateRBElement(boxDesc); this.Physics.AddElement(boxEl, true); this.Physics.Enabled = true; this.Physics.RigidBody.KinematicLinear = false; // ----- THIS PHYSICS IS NEEDED BECAUSE ENTITY DETECTOR ----- /* * MyRBBoxElementDesc boxDesc = physobj.GetRBBoxElementDesc(); * MyMaterialType materialType = MyMaterialType.METAL; * boxDesc.SetToDefault(); * boxDesc.m_Size = Vector3.One; * boxDesc.m_CollisionLayer = MyConstants.COLLISION_LAYER_UNCOLLIDABLE; * boxDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(materialType).PhysicsMaterial; */ //m_selectionBox = (MyRBBoxElement)physobj.CreateRBElement(boxDesc); m_selectionBox = new BoundingBox(-Vector3.One, Vector3.One); // to be selectable in editor //this.Physics.AddElement(m_selectionBox, true); m_userID = objectBuilder.UserOwnerID; m_faction = objectBuilder.Faction; VisibleInGame = false; // set here later on user id when firstly created object inserted into scene //m_selectionBox = new BoundingBox(m_worldAABB.Min, m_worldAABB.Max); if (OnPrefabContainerInitialized != null) { OnPrefabContainerInitialized(this); } //StringBuilder displayName; //if (!string.IsNullOrEmpty(DisplayName)) //{ // MyHud.ChangeText(this, new StringBuilder(DisplayName), null, 0, MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR); //} m_intializing = false; UpdateGenerators(); UseProperties = new MyUseProperties(MyUseType.FromHUB, MyUseType.FromHUB); if (objectBuilder.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB, MyUseType.FromHUB, 3, 4000, false); } else { UseProperties.Init(objectBuilder.UseProperties); } AlarmOn = objectBuilder.AlarmOn; RefillTime = objectBuilder.RefillTime; // check possible values if (Inventory.TemplateType != null && RefillTime == null) { RefillTime = DEFAULT_REFILL_TIME_IN_SEC; } else if (Inventory.TemplateType == null && RefillTime != null) { RefillTime = null; } }
public virtual void Init(string hudLabelText, MyMwcObjectBuilder_PrefabContainer objectBuilder, Matrix matrix) { m_intializing = true; StringBuilder hudLabelTextSb = (string.IsNullOrEmpty(hudLabelText) ? null : new StringBuilder(hudLabelText)); base.Init(hudLabelTextSb, null, null, null, null, objectBuilder); DisplayName = objectBuilder.DisplayName; SetWorldMatrix(matrix); Flags |= EntityFlags.EditableInEditor; this.Faction = objectBuilder.Faction; //during container initialization, it is not necessary to check if prefab is outside boundaries, because it cannot be saved that way foreach (MyMwcObjectBuilder_PrefabBase prefabBuilder in objectBuilder.Prefabs) { CreateAndAddPrefab(null, prefabBuilder); } // we must initialize inventory after prefabs, because some prefabs are registered on OnInventoryContentChanged event if (objectBuilder.Inventory != null) { Inventory.Init(objectBuilder.Inventory, MyMwcUtils.GetRandomFloat(1.1f, 2f)); } //Commit(); UpdateAABBHr(); // ----- THIS PHYSICS IS NEEDED BECAUSE ENTITY DETECTOR ----- this.Physics = new MyPhysicsBody(this, 1.0f, UseKinematicPhysics ? RigidBodyFlag.RBF_KINEMATIC : RigidBodyFlag.RBF_RBO_STATIC) { MaterialType = MyMaterialType.METAL }; MyPhysicsObjects physobj = MyPhysics.physicsSystem.GetPhysicsObjects(); MyRBBoxElementDesc boxDesc = physobj.GetRBBoxElementDesc(); boxDesc.SetToDefault(); boxDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(MyMaterialType.METAL).PhysicsMaterial; boxDesc.m_Size = UseKinematicPhysics ? WorldAABBHr.Size() : Vector3.One; boxDesc.m_CollisionLayer = UseKinematicPhysics ? MyConstants.COLLISION_LAYER_DEFAULT : MyConstants.COLLISION_LAYER_UNCOLLIDABLE; MyRBBoxElement boxEl = (MyRBBoxElement)physobj.CreateRBElement(boxDesc); this.Physics.AddElement(boxEl, true); this.Physics.Enabled = true; this.Physics.RigidBody.KinematicLinear = false; // ----- THIS PHYSICS IS NEEDED BECAUSE ENTITY DETECTOR ----- /* MyRBBoxElementDesc boxDesc = physobj.GetRBBoxElementDesc(); MyMaterialType materialType = MyMaterialType.METAL; boxDesc.SetToDefault(); boxDesc.m_Size = Vector3.One; boxDesc.m_CollisionLayer = MyConstants.COLLISION_LAYER_UNCOLLIDABLE; boxDesc.m_RBMaterial = MyMaterialsConstants.GetMaterialProperties(materialType).PhysicsMaterial; */ //m_selectionBox = (MyRBBoxElement)physobj.CreateRBElement(boxDesc); m_selectionBox = new BoundingBox(-Vector3.One, Vector3.One); // to be selectable in editor //this.Physics.AddElement(m_selectionBox, true); m_userID = objectBuilder.UserOwnerID; m_faction = objectBuilder.Faction; VisibleInGame = false; // set here later on user id when firstly created object inserted into scene //m_selectionBox = new BoundingBox(m_worldAABB.Min, m_worldAABB.Max); if (OnPrefabContainerInitialized != null) { OnPrefabContainerInitialized(this); } //StringBuilder displayName; //if (!string.IsNullOrEmpty(DisplayName)) //{ // MyHud.ChangeText(this, new StringBuilder(DisplayName), null, 0, MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR); //} m_intializing = false; UpdateGenerators(); UseProperties = new MyUseProperties(MyUseType.FromHUB, MyUseType.FromHUB); if (objectBuilder.UseProperties == null) { UseProperties.Init(MyUseType.FromHUB, MyUseType.FromHUB, 3, 4000, false); } else { UseProperties.Init(objectBuilder.UseProperties); } AlarmOn = objectBuilder.AlarmOn; RefillTime = objectBuilder.RefillTime; // check possible values if (Inventory.TemplateType != null && RefillTime == null) { RefillTime = DEFAULT_REFILL_TIME_IN_SEC; } else if (Inventory.TemplateType == null && RefillTime != null) { RefillTime = null; } }