void GrabObject(GameObject gameObject) { heldObject = gameObject; ShipModule currentModule = gameObject.GetComponent <ShipModule>(); if (currentModule) { if (currentModule.connected) { DisconnectModule(gameObject.GetComponentInParent <ModuleSlot>()); currentModule.shipRB = null; Ship ship = currentModule.GetComponentInParent <Ship>(); if (ship) { ship.UpdateModuleStatus(currentModule, currentModule.moduleType, false); } } FindObjectOfType <Ship>().ToggleModuleSlots(true); } gameObject.transform.parent = transform; gameObject.GetComponent <IMaterializeable>().Dematerialize(dematMaterial); PlayerHUD.instance.ToggleCrosshair(false); PlayerHUD.instance.ToggleUsePrompt(false); PlayerHUD.instance.ToggleDematPrompt(false); PlayerCamera.instance.checkForUsable = false; PlayerCamera.instance.checkForMaterializable = false; energyParticles.Play(); }
void OnTriggerExit(Collider other) { ShipModule module = other.GetComponent <ShipModule>(); if (module && !connectedModule && module.moduleType == slotType && !module.IsMaterialized()) { MatterManipulator matterManipulator = module.GetComponentInParent <MatterManipulator>(); if (matterManipulator) { matterManipulator.AssignModuleSlot(null); } meshRenderer.materials = defaultMaterials; } }