首页
在线玩
找游戏
我的
游戏圈
新闻资讯
游戏单封面

金币收集

发布者
东风寄千愁
玩梗
using UnityEngine; using UnityEngine.UI; public class CoinCollect : MonoBehaviour { public int coinScore = 10; public Text scoreText; private int currentScore; void Start() { currentScore = 0; UpdateUI(); } void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { currentScore += coinScore; Destroy(gameObject); // 收集后销毁金币 UpdateUI(); } } void UpdateUI() { scoreText.te
玩过 0/0 款游戏