void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Player") { if (m_enableCoin) { PlayerScore score = col.gameObject.GetComponent <PlayerScore>(); if (score != null) { score.AddScorePoints(m_value); } DisableCoin(); if (CoinEvent != null) { CoinEvent(); } } } }
private void GetComponents() { m_controller = GetComponent <PlayerController>(); m_health = GetComponent <PlayerHealth>(); m_score = GetComponent <PlayerScore>(); }