修复问题,优化bug和游戏,resource资源拆迁
This commit is contained in:
@@ -176,6 +176,20 @@ public class GfxController : MonoBehaviour
|
||||
// 触发受击震动效果
|
||||
TriggerShake(target, isEnemy);
|
||||
|
||||
GameObject visualParent = null;
|
||||
if (isEnemy && enemyObject != null)
|
||||
{
|
||||
visualParent = enemyObject;
|
||||
}
|
||||
else if (!isEnemy)
|
||||
{
|
||||
visualParent = ResolveGfxMountPoint(target);
|
||||
}
|
||||
if (visualParent == null)
|
||||
{
|
||||
visualParent = parent != null ? parent : ResolveGfxMountPoint(target);
|
||||
}
|
||||
|
||||
// 如果是敌人,触发闪红效果 (使用 teamUIController 已有的逻辑)
|
||||
if (isEnemy && teamUIController.Instance != null)
|
||||
{
|
||||
@@ -203,9 +217,6 @@ public class GfxController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 尝试自动解析挂载点,如果未提供 parent
|
||||
GameObject visualParent = parent != null ? parent : ResolveGfxMountPoint(target);
|
||||
|
||||
// 根据身份选择参数
|
||||
float offsetX = isEnemy ? enemyOffsetX : allyOffsetX;
|
||||
float offsetY = isEnemy ? enemyOffsetY : allyOffsetY;
|
||||
@@ -348,7 +359,7 @@ public class GfxController : MonoBehaviour
|
||||
// 在源物体位置实例化
|
||||
GameObject projectile = Instantiate(projectileFX, startTransform.position, Quaternion.identity);
|
||||
|
||||
// 如果是在 UI 环境下,设置正确的父物体(通常是 GfxController 所在的 Canvas 层级)
|
||||
// --- 核心修正:挂载到 GfxController (即当前脚本所在的 Canvas 层级物体) ---
|
||||
projectile.transform.SetParent(this.transform, true);
|
||||
projectile.transform.localScale = Vector3.one * projectileScale;
|
||||
|
||||
@@ -746,16 +757,9 @@ public class GfxController : MonoBehaviour
|
||||
/// <returns>是否成功启动弹道逻辑。如果返回 false,调用方应执行保底扣血。</returns>
|
||||
public bool PlayEnemyAttackOnMiss(int allySlotIndex, float damageAmount, AllyCombatant allyInstance)
|
||||
{
|
||||
// 尝试自动寻找敌人挂载点,如果未分配
|
||||
if (enemyObject == null || !enemyObject.activeInHierarchy)
|
||||
{
|
||||
var enemy = GameObject.Find("thisEnemy");
|
||||
if (enemy != null) enemyObject = enemy;
|
||||
}
|
||||
|
||||
if (enemyObject == null || !enemyObject.activeInHierarchy)
|
||||
{
|
||||
Debug.LogWarning("[GfxController] enemyObject 为空且未能在场景中找到 'thisEnemy',无法播放 Miss 攻击特效。");
|
||||
Debug.LogWarning("[GfxController] enemyObject 为空或未激活,无法播放 Miss 攻击特效。");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -775,7 +779,7 @@ public class GfxController : MonoBehaviour
|
||||
|
||||
// 生成弹道
|
||||
GameObject projectile = Instantiate(projectilePrefab, enemyObject.transform.position, Quaternion.identity);
|
||||
projectile.transform.SetParent(this.transform, true);
|
||||
projectile.transform.SetParent(enemyObject.transform, true);
|
||||
projectile.transform.localScale = Vector3.one * enemyAttackProjectileScale;
|
||||
|
||||
// 应用层级
|
||||
|
||||
Reference in New Issue
Block a user