diff --git a/Assets/_DefendNJ/Scenes/Company1Floor.unity b/Assets/_DefendNJ/Scenes/Company1Floor.unity index 88f5c72b..9ae968c0 100644 --- a/Assets/_DefendNJ/Scenes/Company1Floor.unity +++ b/Assets/_DefendNJ/Scenes/Company1Floor.unity @@ -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 diff --git a/Assets/_DefendNJ/Scripts/Behaviors/Actions.cs b/Assets/_DefendNJ/Scripts/Behaviors/Actions.cs index 33e2e017..8ffbba12 100644 --- a/Assets/_DefendNJ/Scripts/Behaviors/Actions.cs +++ b/Assets/_DefendNJ/Scripts/Behaviors/Actions.cs @@ -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; } diff --git a/Assets/_DefendNJ/Scripts/Enemys/Enemy/Enemy.cs b/Assets/_DefendNJ/Scripts/Enemys/Enemy/Enemy.cs index b0a04f75..6def81b6 100644 --- a/Assets/_DefendNJ/Scripts/Enemys/Enemy/Enemy.cs +++ b/Assets/_DefendNJ/Scripts/Enemys/Enemy/Enemy.cs @@ -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 } diff --git a/Assets/_DefendNJ/Scripts/Manager/GameManager.cs b/Assets/_DefendNJ/Scripts/Manager/GameManager.cs index 4a6407f8..d72acb36 100644 --- a/Assets/_DefendNJ/Scripts/Manager/GameManager.cs +++ b/Assets/_DefendNJ/Scripts/Manager/GameManager.cs @@ -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();