Update CollectCoins

This commit is contained in:
xixu-me committed 2025-03-21 10:33:21 +08:00
1 parent d6fc1f2857
commit aef8e2238b
51 files changed
+146 -11

No files matched your search

@@ -5,6 +5,9 @@ public class InventoryScript : MonoBehaviour {
// Use this for initialization
public AudioClip pickupSound;
public static int coinCount = 0;
public GUIText coinCountText;
public GUITexture coinPic;
void Start () {
}
@@ -17,5 +20,16 @@ public class InventoryScript : MonoBehaviour {
void pickup()
{
AudioSource.PlayClipAtPoint(pickupSound, transform.position);
coinCount++;
}
void showCoinCount()
{
if (!coinPic.enabled)
{
coinPic.enabled = true;
coinCountText.enabled = true;
}
coinCountText.text = coinCount.ToString();
}
}