예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        MyTrigger trigger = other.GetComponent <MyTrigger>();

        if (trigger == null)
        {
            return;
        }
        if (CompareTag("NPC") && trigger.CompareTag("Goal"))
        {
            return;
        }
        trigger.On();
    }
예제 #2
0
    public void OnTriggerExit(Collider other)
    {
        MyTrigger trigger = other.GetComponent <MyTrigger>();

        if (trigger == null)
        {
            return;
        }
        if (CompareTag("NPC") && trigger.CompareTag("Goal"))
        {
            return;
        }
        trigger.Off();
    }