Example #1
0
 void OnTriggerExit(Collider other)
 {
     if (other.gameObject.tag == "SlidingElement")
     {
         SimpleMovableElement element = other.gameObject.GetComponentInParent <SimpleMovableElement>();
         element.SetPlayerOnTop(false);
         transform.parent = element.getLevel().transform;
     }
 }
Example #2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "SlidingElement")
        {
            SimpleMovableElement element = other.gameObject.GetComponentInParent <SimpleMovableElement>();
            transform.parent = element.transform;
            element.SetPlayerOnTop(true);
        }

        if (other.gameObject.tag == "EndScreen")
        {
            int clicks = GameManager.GetInstance().GetTotalClicks();
            UIManager.GetInstance().showEndPanel(clicks);
        }

        if (other.gameObject.tag == "Gate")
        {
            Gate gate = other.gameObject.GetComponentInParent <Gate>();
            if (gate != null)
            {
                gate.TryToOpen();
            }
        }

        if (other.gameObject.tag == "LevelEntry")
        {
            LevelEntryDoor door = other.gameObject.GetComponentInParent <LevelEntryDoor>();
            if (door != null)
            {
                door.startLevel();
            }
        }

        if (other.gameObject.tag == "LevelDoor")
        {
            LevelDoor door = other.gameObject.GetComponentInParent <LevelDoor>();
            if (door != null)
            {
                door.startLevel();
            }
        }

        if (other.gameObject.tag == "Key")
        {
            Key key = other.gameObject.GetComponent <Key> ();
            if (key != null)
            {
                key.setFound();
                key.GetComponent <PathElement> ().SetActive(false);
            }
        }
    }