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"); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "Monster") { gameLogic.AddCoin(); } if (collision.gameObject.name == "Monster") { Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag("Player")) { if (gameLogic != null) { gameLogic.AddCoin(); Destroy(this.gameObject); } } }