예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <MTK_InteractHand>())
        {
            m_inputHand = other.GetComponent <MTK_InteractHand>();

            CorrectEntry = GetTriggerNormal(other.transform.position) == Vector3.up;
            CanSpawn     = false;
        }
    }
예제 #2
0
 private void OnTriggerExit(Collider other)
 {
     if (other.attachedRigidbody)
     {
         MTK_InteractHand hand = other.attachedRigidbody.GetComponent <MTK_InteractHand>();
         if (hand)
         {
             RegisterHand(hand, false);
         }
     }
 }
예제 #3
0
    void Awake()
    {
        m_inputManager = GetComponentInParent <MTK_InputManager>();
        m_inputManager.m_onTrigger.AddListener(TriggerAttract);

        m_lastPos = transform.position;

        m_hand = GetComponentInParent <MTK_InteractHand>();
        m_hand.m_onTouchInteractable.AddListener(GrabIfTarget);

        m_interactiblesManager = MTK_InteractiblesManager.Instance;

        m_fxManager = GetComponentInChildren <FXManager>();
    }
예제 #4
0
    private void Update()
    {
        if (m_placingEnabled)
        {
            for (int i = 0; i < m_handsInTrigger.Count; ++i)
            {
                MTK_InteractHand hand = m_handsInTrigger[i].First;
                Hologram         holo = m_handsInTrigger[i].Second;

                if (hand.m_grabbed != null)
                {
                    if (hand.m_grabbed != m_dropzone.catchedObject)
                    {
                        if (!holo)
                        {
                            holo = CreateHologram(hand.m_grabbed.gameObject);
                            m_handsInTrigger[i].Second = holo;
                        }
                        holo.gameObject.SetActive(true);
                        DrawHologram(holo, hand.m_grabbed.transform);
                    }
                }
                else
                {
                    if (holo)
                    {
                        if (holo.isActiveAndEnabled)
                        {
                            AnchorHologram(holo);
                        }

                        hand.GetComponentInParent <MTK_InputManager>().Haptic(1);
                        AkSoundEngine.PostEvent("Play_Pose", gameObject);

                        m_handsInTrigger[i].Second = null;
                        Destroy(holo.gameObject);
                    }
                }
            }
        }
    }
예제 #5
0
 void RegisterHand(MTK_InteractHand hand, bool state)
 {
     if (state)
     {
         m_handsInTrigger.Add(new Pair <MTK_InteractHand, Hologram>(hand, null));
     }
     else
     {
         for (int i = 0; i < m_handsInTrigger.Count; i++)
         {
             if (m_handsInTrigger[i].First == hand)
             {
                 if (m_handsInTrigger[i].Second)
                 {
                     Destroy(m_handsInTrigger[i].Second.gameObject);
                 }
                 m_handsInTrigger.RemoveAt(i);
                 break;
             }
         }
     }
 }
예제 #6
0
 private void Awake()
 {
     m_interactHand       = GetComponent <MTK_InteractHand>();
     m_collider           = GetComponent <Collider>();
     m_telekinesisPointer = GetComponent <TelekinesisPointer>();
 }
예제 #7
0
 protected void OnEnable()
 {
     m_interractHand = GetComponentInChildren <MTK_InteractHand>();
 }