Merge commit 'ce4551d58fe529f1c6f77a4866b92c5516edaa60' into main_ZYT

# Conflicts:
#	ProjectSettings/EditorBuildSettings.asset
#	ProjectSettings/ProjectSettings.asset
This commit is contained in:
ZYT
2025-10-14 11:00:05 +08:00
4 changed files with 7 additions and 21 deletions

View File

@@ -4660,6 +4660,7 @@ MonoBehaviour:
- {fileID: 1599712599002999753, guid: 826c1da759c837947aa834c8e376c077, type: 3}
- {fileID: 2619052377131353835, guid: 8ae6490bbf8843544aed084b4b86a6fe, type: 3}
- {fileID: 6741804555444110058, guid: 58e8b46ed444f964bbd4e6ac70f62bc0, type: 3}
- {fileID: 5909601087269182702, guid: 25fe4ae8dff91c646a136c20ee24e7ca, type: 3}
snapshotSettings:
bufferTimeMultiplier: 2
bufferLimit: 32

View File

@@ -98,7 +98,6 @@ public class Actions
return TaskStatus.Failure;
// 计算目标距离
float distance = Vector3.Distance(transform.position, target.transform.position);
Debug.Log("距离:"+distance);
if (distance <= 4f)
{
playerAi.ai.isStopped = true;
@@ -245,7 +244,6 @@ public class Actions
if (playerAi == null) return TaskStatus.Failure;
if (target.Value != null)
targetPos = target.Value.transform.position;
transform.LookAt(new Vector3(targetPos.Value.x, transform.position.y, targetPos.Value.z));
playerAi.DoAttack(targetPos.Value);
return TaskStatus.Running;
}

View File

@@ -237,6 +237,7 @@ public class Enemy : Agent
target=(GameObject)behaviorTree.GetVariable("target").GetValue();
}
if (target != null)
{
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(target.transform.position.ReflectVectorXOZ() - transform.position), Time.deltaTime * 10f);
@@ -334,7 +335,7 @@ public class Enemy : Agent
}
// Server 上播放受击(广播给所有客户端)
RpcPlayHit(hitPoint);
//RpcPlayHit(hitPoint);
// 伤害计算:默认返回原始值;若你需要韧性(toughness)生效,可在这里调整
// 例如value = Mathf.Max(0f, value - toughness);
@@ -507,19 +508,5 @@ public class Enemy : Agent
}
}
}
#endregion
#region Debug Gizmos
void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, 1.5f); // 可替换为攻击范围的字段
if (target != null)
{
Gizmos.color = Color.yellow;
Gizmos.DrawLine(transform.position, target.transform.position);
}
}
#endregion
}

View File

@@ -247,7 +247,7 @@ public class GameManager : NetworkBehaviour
// 延迟1s后给所有人发放武器
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
{
GivePistol();
GivePistol(GunType.Pistol);
}, 1f);
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
{
@@ -257,10 +257,10 @@ public class GameManager : NetworkBehaviour
}
[ClientRpc]
public void GivePistol()
public void GivePistol(GunType type)
{
Debug.Log("创建武器中...");
GameLocal.Ins.self.PickUpGun(GunType.Pistol, -999);
GameLocal.Ins.self.PickUpGun(type, -999);
}
[Server]
@@ -288,7 +288,7 @@ public class GameManager : NetworkBehaviour
{
Debug.LogError("开启End事件");
gameState = GameState.EndEvent;
GameLocal.Ins.self.PickUpGun(GunType.MeleeWeapon, -999);
GivePistol(GunType.MeleeWeapon);
foreach (var item in PlayerAiList.Values)
{
item.EndEvent();