tạo bóng rổ assest tạo bóng ném

This commit is contained in:
2026-04-29 10:13:09 +07:00
parent 3e9c60d83d
commit 6b83ac05d5
529 changed files with 130558 additions and 110 deletions

View File

@@ -0,0 +1,25 @@
using UnityEngine;
using TMPro; // Dùng UnityEngine.UI nếu bạn xài Text thường
public class ScoreManager : MonoBehaviour
{
public TextMeshProUGUI scoreText; // Kéo UI Text điểm số vào đây
private int currentScore = 0;
private void OnTriggerEnter(Collider other)
{
// Kiểm tra xem vật lọt qua rổ có phải là bóng không
if (other.CompareTag("Ball"))
{
currentScore += 2; // Cộng 2 điểm
UpdateScoreUI();
// (Tùy chọn) Thêm hiệu ứng âm thanh hoặc Particle vào đây
}
}
void UpdateScoreUI()
{
scoreText.text = "Score: " + currentScore;
}
}