增加失败后,停止敌人和角色的所有行动
This commit is contained in:
@@ -71,17 +71,34 @@ namespace GameFramework
|
|||||||
// 等待一帧,让 HUD 先更新血量显示
|
// 等待一帧,让 HUD 先更新血量显示
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
// 1. 查找玩家并禁用控制
|
// 1. 禁用所有敌人 AI 和控制
|
||||||
|
DisableAllEnemyAI();
|
||||||
|
|
||||||
|
// 2. 查找玩家并禁用一切控制
|
||||||
var player = GameObject.FindGameObjectWithTag("Player");
|
var player = GameObject.FindGameObjectWithTag("Player");
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
|
// 移动/翻滚/输入
|
||||||
var playerController = player.GetComponent<PlayerController>();
|
var playerController = player.GetComponent<PlayerController>();
|
||||||
if (playerController != null) playerController.enabled = false;
|
if (playerController != null) playerController.enabled = false;
|
||||||
|
|
||||||
|
// 近战攻击(点击)
|
||||||
|
var swordAttack = player.GetComponent<IndianOceanAssets.Engine2_5D.SwordAttack>();
|
||||||
|
if (swordAttack != null) swordAttack.enabled = false;
|
||||||
|
|
||||||
|
// 远程攻击(点击)
|
||||||
|
var projectileShooter = player.GetComponent<IndianOceanAssets.Engine2_5D.ProjectileShooter>();
|
||||||
|
if (projectileShooter != null) projectileShooter.enabled = false;
|
||||||
|
|
||||||
|
// 技能:唤魂灯笼
|
||||||
|
var lanternSystem = player.GetComponent<IndianOceanAssets.Engine2_5D.SpiritLanternSystem>();
|
||||||
|
if (lanternSystem != null) lanternSystem.enabled = false;
|
||||||
|
|
||||||
|
// 相机跟随
|
||||||
var camFollow = Camera.main != null ? Camera.main.GetComponent<CameraFollow>() : null;
|
var camFollow = Camera.main != null ? Camera.main.GetComponent<CameraFollow>() : null;
|
||||||
if (camFollow != null) camFollow.enabled = false;
|
if (camFollow != null) camFollow.enabled = false;
|
||||||
|
|
||||||
// 2. 光源缩小至完全不可见
|
// 3. 光源缩小至完全不可见
|
||||||
var lightSource = player.GetComponent<LightSource>();
|
var lightSource = player.GetComponent<LightSource>();
|
||||||
if (lightSource != null)
|
if (lightSource != null)
|
||||||
{
|
{
|
||||||
@@ -112,10 +129,28 @@ namespace GameFramework
|
|||||||
yield return new WaitForSecondsRealtime(lightShrinkDuration);
|
yield return new WaitForSecondsRealtime(lightShrinkDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 淡出黑色 + 显示失败叠加层(不切场景)
|
// 4. 淡出黑色 + 显示失败叠加层(不切场景)
|
||||||
yield return StartCoroutine(ShowLostOverlay());
|
yield return StartCoroutine(ShowLostOverlay());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 禁用场景中所有敌人相关的 AI 和控制组件。
|
||||||
|
/// </summary>
|
||||||
|
private void DisableAllEnemyAI()
|
||||||
|
{
|
||||||
|
// 禁用所有 EnemyAI
|
||||||
|
var enemyAIs = FindObjectsOfType<IndianOceanAssets.Engine2_5D.EnemyAI>();
|
||||||
|
foreach (var ai in enemyAIs)
|
||||||
|
ai.enabled = false;
|
||||||
|
|
||||||
|
// 禁用 EnemyManager(停止生成/管理逻辑)
|
||||||
|
var enemyManager = FindObjectOfType<IndianOceanAssets.Engine2_5D.EnemyManager>();
|
||||||
|
if (enemyManager != null)
|
||||||
|
enemyManager.enabled = false;
|
||||||
|
|
||||||
|
Debug.Log($"[GameManager] 已禁用 {enemyAIs.Length} 个 EnemyAI + EnemyManager");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 胜利过场协程:光源扩大 → 淡出 → 跳转 Scoring。
|
/// 胜利过场协程:光源扩大 → 淡出 → 跳转 Scoring。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user