Exemplo n.º 1
0
 void OnCollisionExit(Collision coll)
 {
     if (coll.transform.name == "trashMenu" && ID == 0)
     {
         coll.transform.GetComponent <trashcan>().setReady(false);
         if (manipulatorObjScript != null)
         {
             manipulatorObjScript.hapticPulse(1000);
         }
         else if (otherHandle.manipulatorObjScript != null)
         {
             otherHandle.manipulatorObjScript.hapticPulse(1000);
         }
         curTrash   = null;
         trashReady = false;
         soundUtils.SetupMaterialWithBlendMode(mat, soundUtils.BlendMode.Opaque);
     }
 }
Exemplo n.º 2
0
 void OnCollisionEnter(Collision coll)
 {
     if (coll.transform.name == "trashMenu" && (curState == manipState.grabbed || otherHandle.curState == manipState.grabbed) && ID == 0)
     {
         curTrash = coll.transform.GetComponent <trashcan>();
         curTrash.setReady(true);
         if (manipulatorObjScript != null)
         {
             manipulatorObjScript.hapticPulse(1000);
         }
         else if (otherHandle.manipulatorObjScript != null)
         {
             otherHandle.manipulatorObjScript.hapticPulse(1000);
         }
         trashReady = true;
         soundUtils.SetupMaterialWithBlendMode(mat, soundUtils.BlendMode.Fade);
     }
 }
Exemplo n.º 3
0
    public override void setState(manipState state)
    {
        if (curState == state)
        {
            return;
        }

        if (curState == manipState.grabbed && state != manipState.grabbed)
        {
            if (curTrash != null)
            {
                if (curTrash.gameObject.activeSelf)
                {
                    curTrash.trashEvent();
                }
                else
                {
                    curTrash.setReady(false);
                    curTrash   = null;
                    trashReady = false;
                    soundUtils.SetupMaterialWithBlendMode(mat, soundUtils.BlendMode.Opaque);
                }
            }
            else if (otherHandle.curTrash != null)
            {
                if (otherHandle.curTrash.gameObject.activeSelf)
                {
                    otherHandle.curTrash.trashEvent();
                }
                else
                {
                    otherHandle.curTrash.setReady(false);
                    otherHandle.curTrash   = null;
                    otherHandle.trashReady = false;
                    soundUtils.SetupMaterialWithBlendMode(mat, soundUtils.BlendMode.Opaque);
                }
            }
            else
            {
                otherHandle.trashReady = false;
                trashReady             = false;
                soundUtils.SetupMaterialWithBlendMode(mat, soundUtils.BlendMode.Opaque);
            }

            if (trashReady || otherHandle.trashReady)
            {
                if (masterObj.gameObject.GetComponentInChildren <tape>())
                {
                    masterObj.gameObject.GetComponentInChildren <tape>().Eject();
                }
                Destroy(masterObj.gameObject);
            }
            else
            {
                masterObj.parent = masterObjParent;
            }

            if (!masterControl.instance.handlesEnabled)
            {
                toggleHandles(false);
                otherHandle.toggleHandles(false);
            }
        }

        curState = state;

        if (ID == 0)
        {
            if (curState == manipState.none)
            {
                if (otherHandle.curState == manipState.none)
                {
                    highlight.SetActive(false);
                }
            }
            if (curState == manipState.selected)
            {
                highlight.SetActive(true);
                highlightMat.SetFloat("_EmissionGain", .35f);
            }
            if (curState == manipState.grabbed)
            {
                highlight.SetActive(true);
                highlightMat.SetFloat("_EmissionGain", .45f);
            }
        }
        else
        {
            if (curState == manipState.none)
            {
                if (otherHandle.curState == manipState.none)
                {
                    otherHandle.highlight.SetActive(false);
                }
            }
            if (curState == manipState.selected)
            {
                otherHandle.highlight.SetActive(true);
                otherHandle.highlightMat.SetFloat("_EmissionGain", .35f);
            }
            if (curState == manipState.grabbed)
            {
                otherHandle.highlight.SetActive(true);
                otherHandle.highlightMat.SetFloat("_EmissionGain", .45f);
            }
        }
        if (curState == manipState.grabbed)
        {
            masterObj.parent = manipulatorObj.parent;
            doublePosRot     = false;
        }
    }