Example #1
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (scene.actualPhase == playerPhase)
        {
            if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
            {
                if (collision.gameObject.tag == "NPC")
                {
                    npc = collision.GetComponent <MerchantController>();

                    if (!npc.bocadillo.gameObject.activeSelf)
                    {
                        npc.bocadillo.gameObject.SetActive(true);
                    }

                    npc.Interaction();
                }
                else if (collision.gameObject.tag == "Tree")
                {
                    aple = collision.GetComponent <ApplleController>();

                    aple.Interaction();
                }
                else if (collision.gameObject.tag == "Star")
                {
                    star = collision.GetComponent <StarController>();

                    star.Interaction();
                }
            }
        }
    }