Beispiel #1
0
    public void OnTriggerEnter(Collider other)
    {
        if (_isDead == true)
        {
            return;
        }

        if (other.tag == "Threat")
        {
            Trap trap = other.GetComponent <Trap>();
            // Cas des portes
            if (trap == null)
            {
                trap = other.GetComponentInParent <Trap>();
            }
            if (trap != null)
            {
                if (trap.isActive())
                {
                    Kill();
                }
                trap.ActiveTrapFromPlayer();
            }
            else
            {
                Kill();
            }
        }
        else if (other.tag == "Trigger")
        {
            Trigger trigger = other.GetComponent <Trigger>();
            if (trigger.needAction == false)
            {
                trigger.DoActiveTriggerFromPlayer();
            }
        }
        else if (other.tag == "Room")
        {
            RoomController roomController;

            GameObject[] rooms = GameObject.FindGameObjectsWithTag("Room");
            foreach (GameObject room in rooms)
            {
                roomController = room.GetComponent <RoomController>();
                roomController.DisableLocalAudioSource();
            }

            roomController = other.GetComponent <RoomController>();
            roomController.EnableLocalAudioSource();
        }
    }