Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Item")
        {
            //Point
            if (collision.gameObject.name.Contains("Bronze")) //~.Contains(""); 포함하고 있습니까? bool값 반환
            {
                gameManager.stagePoint += 1;
            }
            else if (collision.gameObject.name.Contains("Silver"))
            {
                gameManager.stagePoint += 2;
            }
            else if (collision.gameObject.name.Contains("Gold"))
            {
                gameManager.stagePoint += 3;
            }

            //Deactive Item
            collision.gameObject.SetActive(false);

            //Sound
            PlayeSound(audioItem);
        }
        else if (collision.tag == "Finish") //Finish
        {
            //Next Stage
            gameManager.NextStage();
        }
    }