Exemple #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         PlayerWallet currentWallet = other.GetComponent <PlayerWallet>();
         if (currentWallet)
         {
             currentWallet.AddCoin(coinCost);
             gameObject.SetActive(false);
         }
     }
 }
    protected override void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.tag == "Player")
        {
            if (playerWallet.GetCoins() < 999)
            {
                playerWallet.AddCoin();
                DoPickupAnimation();
                Destroy(gameObject);

                return;
            }

            DoCancelPickupAnimation();
        }
    }