优化回声描边逻辑

This commit is contained in:
2026-06-28 21:44:33 +08:00
parent 02ac67d338
commit 5c7ffac1bd
12 changed files with 1257 additions and 1328 deletions

View File

@@ -48,8 +48,10 @@ namespace IndianOceanAssets.Engine2_5D
public void Slash()
{
// Play particle and sound effects
swordSlashParticle.Play();
swordSlashSFX.Play();
if (swordSlashParticle != null)
swordSlashParticle.Play();
if (swordSlashSFX != null)
swordSlashSFX.Play();
// Detect and damage enemies within the slash radius
Collider[] enemies = Physics.OverlapSphere(attackPos.position, slashRadius, whatIsEnemy);
@@ -57,7 +59,11 @@ namespace IndianOceanAssets.Engine2_5D
{
foreach (var E in enemies)
{
E.GetComponent<HealthSystem>().Damage(damageAmount);
HealthSystem health = E.GetComponent<HealthSystem>();
if (health != null)
{
health.Damage(damageAmount);
}
}
}
@@ -67,7 +73,11 @@ namespace IndianOceanAssets.Engine2_5D
{
foreach (var P in plantation)
{
P.GetComponent<Plantation>().Cut();
Plantation plant = P.GetComponent<Plantation>();
if (plant != null)
{
plant.Cut();
}
}
}
}