private void OnCollisionStay2D(Collision2D collision) { if (collision.gameObject.tag == "Drop" && collecting && !player.maxed) { PlayerDrop drop = GetComponent <PlayerDrop>(); player.AddPoints(drop.dropCost); AudioManager.instance.Play("CollectFX"); Destroy(collision.gameObject); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player") { PlayerDrop playerDrop = collision.gameObject.GetComponent <PlayerDrop>(); PlayerStats player = collision.gameObject.GetComponent <PlayerStats>(); player.hitted = true; if (player.points == 100) { playerDrop.DropIt(); } Destroy(gameObject); } }