private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.GetComponent <CollectableObject>() != null) { CollectableObject _Collectable = collision.gameObject.GetComponent <CollectableObject>(); playerScore += _Collectable.scorePoints; OnPlayerScoreHandler?.Invoke(playerId, playerScore); // Send event signal to UI that gets point on collision _getPointSFX.Play(); Destroy(collision.gameObject); } }
void resetScore() { score = 0; OnPlayerScore?.Invoke(score); }
public void incrementScore() { score++; OnPlayerScore?.Invoke(score); }