21
This commit is contained in:
@@ -125,8 +125,8 @@ public class BullitMove : MonoBehaviour
|
||||
|
||||
if (isLock)
|
||||
{
|
||||
// 目标无效 → 解除锁定
|
||||
if (target == null || targetTra == null || !target.gameObject.activeInHierarchy || !targetTra.gameObject.activeInHierarchy)
|
||||
// 目标无效或已死亡 → 解除锁定
|
||||
if (target == null || target.isDead || targetTra == null || !target.gameObject.activeInHierarchy || !targetTra.gameObject.activeInHierarchy)
|
||||
{
|
||||
NotLock();
|
||||
return;
|
||||
@@ -175,6 +175,10 @@ public class BullitMove : MonoBehaviour
|
||||
{
|
||||
if (collision.transform.tag == "Fish")
|
||||
{
|
||||
// ⭐ 已死亡的鱼(死亡特效播放窗口期)不可被命中,子弹穿透继续飞
|
||||
var hitMonster = collision.transform.GetComponentInParent<MonsterContral>();
|
||||
if (hitMonster != null && hitMonster.isDead) return;
|
||||
|
||||
isTriggerFirst = false;
|
||||
if (effectPrefab != null)
|
||||
{
|
||||
@@ -183,9 +187,8 @@ public class BullitMove : MonoBehaviour
|
||||
|
||||
if (userid == GameManager.Instance.user.id)
|
||||
{
|
||||
var monster = collision.transform.GetComponentInParent<MonsterContral>();
|
||||
monster.monsterData.charactersHealth.OnHurt(10, CharacterHurtType.none);
|
||||
Destroy(monster.gameObject);
|
||||
hitMonster.monsterData.charactersHealth.OnHurt(10, CharacterHurtType.none);
|
||||
Destroy(hitMonster.gameObject);
|
||||
}
|
||||
BulletPool.Instance.Return(gameObject);
|
||||
}
|
||||
@@ -209,8 +212,11 @@ public class BullitMove : MonoBehaviour
|
||||
{
|
||||
if (collision.tag == "Fish")
|
||||
{
|
||||
isTriggerFirst = false;
|
||||
// ⭐ 已死亡的鱼(死亡特效播放窗口期)不可被命中,子弹穿透继续飞
|
||||
var monster = collision.transform.GetComponentInParent<MonsterContral>();
|
||||
if (monster != null && monster.isDead) return;
|
||||
|
||||
isTriggerFirst = false;
|
||||
AttackFish(monster);
|
||||
}
|
||||
else if (collision.tag == "Wall")
|
||||
@@ -242,6 +248,13 @@ public class BullitMove : MonoBehaviour
|
||||
|
||||
private void AttackFish(MonsterContral monster)
|
||||
{
|
||||
// ⭐ 兜底:已死亡的鱼(死亡特效播放窗口期)不可被命中,子弹回池不结算
|
||||
if (monster == null || monster.isDead)
|
||||
{
|
||||
BulletPool.Instance.Return(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
if (effectPrefab != null)
|
||||
{
|
||||
EffectPool.Instance.Get(effectPrefab, transform.position, Quaternion.identity, transform.parent);
|
||||
|
||||
Reference in New Issue
Block a user