protected override void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "Player") { if (playerWallet.GetCoins() < 999) { playerWallet.AddCoin(); DoPickupAnimation(); Destroy(gameObject); return; } DoCancelPickupAnimation(); } }
private void Update() { text.text = playerWallet.GetCoins().ToString("000"); }