优化回声描边逻辑
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user