void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Player") { scoreManager.AddGem(GemValue); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D c) { Debug.Log(c.tag); if (c.tag == "Hazard") { TakeDamage(); Destroy(c.gameObject); SoundManager.PlaySound(SoundManager.Instance.BadGemSound); } else if (c.tag == "GoodGem") { Handheld.Vibrate(); GoodGem g = c.GetComponent <GoodGem>(); ScoreManager.AddGem(g); Destroy(c.gameObject); SoundManager.PlaySound(SoundManager.Instance.GoodGemSound); } }