This commit is contained in:
manhduyhoang90
2026-05-09 09:00:14 +07:00
parent 48fa714dec
commit 4fc787e83f
50 changed files with 4057 additions and 7 deletions

45
Assets/Scripts/Bullet.cs Normal file
View File

@@ -0,0 +1,45 @@
using UnityEngine;
public class Bullet : MonoBehaviour
{
public float speed = 10f;
void Update()
{
transform.position += transform.forward * speed * Time.deltaTime;
}
private void OnTriggerEnter(Collider other)
{
// Trúng khiên
if (other.CompareTag("Shield"))
{
Destroy(gameObject);
return;
}
// Trúng đầu
if (other.CompareTag("BluePlayer"))
{
HitBox hit = other.GetComponent<HitBox>();
if (hit != null)
{
hit.blueplayer.Die();
}
Destroy(gameObject);
}
if (other.CompareTag("RedPlayer"))
{
HitBox hit = other.GetComponent<HitBox>();
if (hit != null)
{
hit.redplayer.Die();
}
Destroy(gameObject);
}
}
}