예제 #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        //Debug.Log(col.gameObject.name);

        //Debug.Log(col.gameObject.GetComponent<RecyclingItem>().ItemType);

        if (col && col.gameObject && col.gameObject.GetComponent <RecyclingItem>())
        {
            if (BinType == col.gameObject.GetComponent <RecyclingItem>().ItemType)
            {
                Debug.Log("SCORE!");
                binManager.Collected(col.gameObject.GetComponent <DragAndDrop>().Timer);
                this.GetComponent <AudioSource>().Play();
            }
            else
            {
                Life.GetComponent <LifeManager>().LoseHealth();
                binManager.Trashed();
            }


            Destroy(col.gameObject);
        }
    }