예제 #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject == playerDetect.closestEnemy)
        {
            rcChar.stop();
        }

        if (col.gameObject.tag == "Wall")
        {
            rcChar.stop();
        }
    }
예제 #2
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "MonsterHitbox")
     {
         rcCharacter.stop();
     }
 }
예제 #3
0
    void OnTriggerEnter2D(Collider2D col)
    {
        //-----Town door icon/trigger
        if (col.gameObject.tag == "Bardoor" || col.gameObject.tag == "Blacksmithdoor" || col.gameObject.tag == "Dungeondoor" || col.gameObject.tag == "Insidebar" || col.gameObject.tag == "Insidefactory")
        {
            if (col.gameObject.tag == "Bardoor")
            {
                Bardoor = true;
                baricon.SetActive(true);
            }
            if (col.gameObject.tag == "Insidebar")
            {
                Insidebar = true;
                interactIcon.SetActive(true);
            }
            if (col.gameObject.tag == "Insidefactory")
            {
                Insidefactory = true;
                interactIcon.SetActive(true);
            }
            if (col.gameObject.tag == "Blacksmithdoor")
            {
                Blacksmithdoor = true;
                factoryicon.SetActive(true);
            }
            if (col.gameObject.tag == "Dungeondoor")
            {
                Dungeondoor = true;
                ballon.SetActive(true);
            }
            if (col.gameObject.tag == "weapons")
            {
                shopicon.SetActive(true);
                shop = true;
            }
        }
        //-----interactable icons
        if (col.gameObject.tag == "Interact")
        {
            interactIcon.SetActive(true);
        }

        //-----Door icon & triggers
        if (col.gameObject.tag == "TopDoor" && !monstersTemplates.doorClosed)
        {
            DoorIcon.SetActive(true);
            if (!keyEntered)
            {
                Ttrigger = true;
            }
            rcPlayer.stop();
        }
        if (col.gameObject.tag == "RightDoor" && !monstersTemplates.doorClosed)
        {
            if (!keyEntered)
            {
                Rtrigger = true;
            }
            DoorIcon.SetActive(true);
            rcPlayer.stop();
        }
        if (col.gameObject.tag == "BottomDoor" && !monstersTemplates.doorClosed)
        {
            if (!keyEntered)
            {
                Btrigger = true;
            }
            DoorIcon.SetActive(true);
            rcPlayer.stop();
        }
        if (col.gameObject.tag == "LeftDoor" && !monstersTemplates.doorClosed)
        {
            if (!keyEntered)
            {
                Ltrigger = true;
            }
            DoorIcon.SetActive(true);
            rcPlayer.stop();
        }
    }