예제 #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //se hvis objektet er tagget som interObject
        //if (other.gameObject.tag =="interObject")
        //{
        //    Debug.Log(other.gameObject.name);
        //}

        if (other.CompareTag("interObject"))
        {
            //Debug.Log(other.name);
            currentInterObj       = other.gameObject;
            currentInterObjScript = currentInterObj.GetComponent <InteractionObjects>();
        }

        if (other.CompareTag("PortalDoor"))
        {
            Debug.Log("interacting with: " + other.name);
        }

        //For Mini Game
        if (other.CompareTag("Coin"))
        {
            Debug.Log("interacting with: " + other.name);
        }

        if (other.CompareTag("GateKeeper"))
        {
            Debug.Log("interacting with: " + other.name);
            dialog.SetActive(true);
        }
    }
예제 #2
0
 //store info object that Player collides
 //reach into current item and store the script (saves time)
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("InterObject"))
     {
         Debug.Log(other.name);
         currentInterObj       = other.gameObject;
         currentInterObjScript = currentInterObj.GetComponent <InteractionObjects> ();
     }
 }