Exemple #1
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.CompareTag("Player"))
        {
            if (gameLogic != null)
            {
                gameLogic.AddCoin();
                Destroy(this.gameObject);
                Debug.Log("Gamelogic!=null");
            }
            else
            {
                Debug.Log("Gamelogic=null");
            }


            Debug.Log("playercollision");
        }
        else if (col.CompareTag("Ground"))
        {
            if (gameLogic == null)
            {
                Debug.Log("Gamelogic=null22");
                return;
            }
            Destroy(this.gameObject);
            Debug.Log("groundcollision");
        }
    }
Exemple #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.name == "Monster")
     {
         gameLogic.AddCoin();
     }
     if (collision.gameObject.name == "Monster")
     {
         Destroy(gameObject);
     }
 }
Exemple #3
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.CompareTag("Player"))
     {
         if (gameLogic != null)
         {
             gameLogic.AddCoin();
             Destroy(this.gameObject);
         }
     }
 }