convert game playing..

This commit is contained in:
2026-09-23 12:53:52 +09:00
parent 37c7942b71
commit 5d11288a6f
136 changed files with 15856 additions and 299 deletions
@@ -1,5 +1,6 @@
using BumpCombat.Player;
using BumpCombat.Core;
using BumpCombat.Stage;
using UnityEngine;
namespace BumpCombat.Enemies
@@ -82,6 +83,8 @@ namespace BumpCombat.Enemies
}
bool hitTarget = false;
float targetDistance = float.PositiveInfinity;
float blockerDistance = float.PositiveInfinity;
if (distance > 0f)
{
RaycastHit2D[] hits = Physics2D.CircleCastAll(
@@ -92,12 +95,28 @@ namespace BumpCombat.Enemies
Physics2D.AllLayers);
for (int i = 0; i < hits.Length; i++)
{
if (hits[i].collider != null
&& hits[i].collider.GetComponentInParent<PlayerHealth>() == target)
Collider2D collider = hits[i].collider;
if (collider == null || collider.isTrigger)
{
hitTarget = true;
break;
continue;
}
if (collider.GetComponentInParent<PlayerHealth>() == target)
{
targetDistance = Mathf.Min(targetDistance, hits[i].distance);
}
else if (IsTerrainBlocker(collider))
{
blockerDistance = Mathf.Min(blockerDistance, hits[i].distance);
}
}
hitTarget = targetDistance < blockerDistance;
if (!hitTarget && blockerDistance < float.PositiveInfinity)
{
resolved = true;
Destroy(gameObject);
return;
}
}
else
@@ -134,6 +153,14 @@ namespace BumpCombat.Enemies
}
}
private static bool IsTerrainBlocker(Collider2D collider)
{
return collider != null
&& (collider.GetComponentInParent<StageObstacle>() != null
|| collider.name.StartsWith("Wall_")
|| collider.gameObject.name.Contains("Wall"));
}
private void OnDisable()
{
resolved = true;