示例#1
0
    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;
        }
    }
示例#2
0
 void SnapModule()
 {
     if (Vector3.Distance(connectedModule.transform.localPosition, Vector3.zero) > 0.05f || Quaternion.Angle(connectedModule.transform.localRotation, Quaternion.identity) > 1f)
     {
         connectedModule.transform.localPosition = Vector3.Lerp(connectedModule.transform.localPosition, Vector3.zero, moduleSnapSpeed * Time.fixedDeltaTime);
         connectedModule.transform.localRotation = Quaternion.Slerp(connectedModule.transform.localRotation, Quaternion.identity, moduleSnapSpeed * Time.fixedDeltaTime);
     }
     else
     {
         if (!connectedModule.IsMaterialized())
         {
             connectedModule.transform.localPosition = Vector3.zero;
             connectedModule.transform.localRotation = Quaternion.identity;
             connectedModule.Materialize();
         }
     }
 }