·
This commit is contained in:
parent
6e6a687071
commit
2e038ca10e
@ -308,7 +308,7 @@ public class Shot : MonoBehaviour
|
||||
// 4. 设置枪口火焰父对象(可选)
|
||||
muzzleObj.SetParent(gun);
|
||||
muzzleObj.gameObject.SetActive(true);
|
||||
muzzleObj.transform.LookAt(gun.forward);
|
||||
muzzleObj.transform.LookAt(lockEnemy != null ? lockEnemy.transform.position : gun.forward);
|
||||
}
|
||||
|
||||
// 7. 获取子弹组件并重置状态
|
||||
@ -360,6 +360,7 @@ public class Shot : MonoBehaviour
|
||||
if (currentDistance < hitDistance)
|
||||
{
|
||||
var lockTargetPosition = lockTarget.transform.position;
|
||||
bulletComp.currentHitPosition = lockTargetPosition;
|
||||
bool isDestroyed = lockTarget.TakeDamage(bulletComp.power);
|
||||
Vector3 targetDir = (bulletObj.transform.position - lockTargetPosition).normalized;
|
||||
bulletComp.InitImpact(lockTargetPosition, targetDir);//爆炸效果
|
||||
@ -519,7 +520,7 @@ public class Shot : MonoBehaviour
|
||||
continue;
|
||||
}
|
||||
float distance = Vector3.Distance(enemy.transform.position, targetPosition);
|
||||
if (distance < minDistance && distance <= shotDistance && (ringManager == null || distance > ringManager.radius * 1.2f))// && !Global.LockedEnemies.ContainsKey(enemy.GetHashCode()))
|
||||
if (distance < minDistance && distance <= shotDistance)// && (ringManager == null || distance > ringManager.radius * 1.2f))// && !Global.LockedEnemies.ContainsKey(enemy.GetHashCode()))
|
||||
{
|
||||
minDistance = distance;
|
||||
result = enemy;
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user