Example #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.TryGetComponent <Player>(out Player player) && !IsTaken)
     {
         _isTaken = true;
         _collectAudio.Play();
         _moneyCounter?.CheckMoneyRemain();
         _playerCollision.Invoke();
         _sprite.color = Color.clear;
     }
 }