feat(game): 删除弓箭手相关资源文件

删除了弓箭手预制体(Arrow.prefab)及其元文件,
同时移除了对应的白色箭矢材质(ArrowProjectile_White.mat)及元文件,
清理了项目中不再使用的箭矢相关资源。
```
This commit is contained in:
huadexuan committed 2026-08-28 18:10:47 +08:00
1 parent 840867963d
commit 2728c1d2cc
44 files changed
+5116 -110

No files matched your search

+11 -1
View File
@@ -8,6 +8,7 @@ public class Projectile : MonoBehaviour
private float speed;
private float lifetime;
private bool initialized;
private bool hasHit;
public void Initialize(
GameObject targetObject,
@@ -22,6 +23,7 @@ public class Projectile : MonoBehaviour
speed = moveSpeed;
lifetime = lifeTime;
initialized = true;
hasHit = false;
if (lifetime > 0f)
{
@@ -42,7 +44,9 @@ public class Projectile : MonoBehaviour
return;
}
// 目标根节点位于脚底,只取水平差值,让箭保持当前高度平行飞行。
Vector3 offset = target.transform.position - transform.position;
offset.y = 0f;
if (offset.sqrMagnitude <= 0.01f)
{
HitTarget(target);
@@ -82,7 +86,7 @@ public class Projectile : MonoBehaviour
private void TryHit(GameObject hitObject)
{
if (!initialized || hitObject == null || IsOwner(hitObject))
if (!initialized || hitObject == null || target == null || IsOwner(hitObject))
{
return;
}
@@ -95,12 +99,18 @@ public class Projectile : MonoBehaviour
private void HitTarget(GameObject hitObject)
{
if (hasHit)
{
return;
}
WorldHealthBar healthBar = hitObject.GetComponentInParent<WorldHealthBar>();
if (healthBar == null)
{
return;
}
hasHit = true;
healthBar.TakeDamage(damage);
if (owner != null)
{