Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 void resetScore()
 {
     score = 0;
     OnPlayerScore?.Invoke(score);
 }
Exemplo n.º 3
0
 public void incrementScore()
 {
     score++;
     OnPlayerScore?.Invoke(score);
 }