コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "collectibleHp")
        {
            Debug.Log("colidiu com caixa de hp");
            if (playerComponent != null)
            {
                Debug.Log("PLAYER NOT NULL, SHOULD EXECUTE");
                //playerComponent.collisionHP();
                playerComponent.collectibleHPEvent();
            }
            Destroy(other.gameObject);
        }
        if (other.tag == "collectibleSpecial")
        {
            Debug.Log("colidiu com caixa de especial");
            if (playerComponent != null)
            {
                //playerComponent.collisionSpecial();
                playerComponent.collectibleSpecialEvent();
            }
            Destroy(other.gameObject);
        }
        if (other.tag == "bullet" || other.tag == "bullet2")
        {
            //Debug.Log("atingido por tiro");
            //if (takeDamage)
            //{
            //health -= 0.1f;
            //healthImage.fillAmount = health;
            StartCoroutine(flashColor());
            if (playerComponent != null)
            {
                playerComponent.receiveDamage();
            }
            //GetComponentInChildren<playerMove>().receiveDamage();
            //}

            Destroy(other.gameObject);
        }
        //Debug.Log(other.name);
    }