PlacePlayer
This commit is contained in:
@@ -60,7 +60,7 @@ namespace BaseGames.Editor
|
||||
// 动画组件(AnimancerComponent 需要 Animator 存在;PlayerController
|
||||
// [RequireComponent(typeof(AnimancerComponent))] 保证其存在)
|
||||
GetOrAddComponent<Animator>(root);
|
||||
GetOrAddComponent<AnimancerComponent>(root);
|
||||
AnimancerComponent animancer = GetOrAddComponent<AnimancerComponent>(root);
|
||||
|
||||
SetupSpriteRenderer(root);
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace BaseGames.Editor
|
||||
PlayerWallDetector wallDetector = GetOrAddComponent<PlayerWallDetector>(root);
|
||||
EquipmentManager equipmentManager = GetOrAddComponent<EquipmentManager>(root);
|
||||
GetOrAddComponent<SkillModifierRegistry>(root);
|
||||
GetOrAddComponent<StatusEffectManager>(root);
|
||||
StatusEffectManager statusEffectManager = GetOrAddComponent<StatusEffectManager>(root);
|
||||
// PlayerController 最后添加:RequireComponent 会拉取上方已加好的组件
|
||||
PlayerController playerController = GetOrAddComponent<PlayerController>(root);
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace BaseGames.Editor
|
||||
HurtBox hurtBox = GetOrAddComponent<HurtBox>(hurtBoxT.gameObject);
|
||||
|
||||
// ── [WeaponSocket] 子节点(WeaponManager 动态实例化武器 HitBox 的挂点)
|
||||
GetOrCreateChild(root.transform, "[WeaponSocket]");
|
||||
Transform weaponSocketT = GetOrCreateChild(root.transform, "[WeaponSocket]");
|
||||
|
||||
// ── GroundCheck 子节点(地面检测 Transform)────────────────────────
|
||||
Transform groundCheckT = GetOrCreateChild(root.transform, "GroundCheck");
|
||||
@@ -98,7 +98,7 @@ namespace BaseGames.Editor
|
||||
AssignLayerMask(playerMovement, "_groundLayer", "Ground", report);
|
||||
|
||||
// ── SkillHitBox_Slot 子节点(技能 HitBox 实例化挂点)────────────────
|
||||
GetOrCreateChild(root.transform, "SkillHitBox_Slot");
|
||||
Transform skillSocketT = GetOrCreateChild(root.transform, "SkillHitBox_Slot");
|
||||
|
||||
// ── CameraFollowTarget 子节点(CinemachineCamera.Follow 目标)────────
|
||||
GetOrCreateChild(root.transform, "CameraFollowTarget");
|
||||
@@ -118,6 +118,34 @@ namespace BaseGames.Editor
|
||||
AssignReference(playerCombat, "_weaponManager", weaponManager, report);
|
||||
AssignReference(springSystem, "_stats", playerStats, report);
|
||||
|
||||
// WeaponManager 内部引用
|
||||
AssignReference(weaponManager, "_formController", formController, report);
|
||||
AssignReference(weaponManager, "_weaponSocket", weaponSocketT, report);
|
||||
|
||||
// SkillManager 内部引用(技能系统核心依赖)
|
||||
AssignReference(skillManager, "_stats", playerStats, report);
|
||||
AssignReference(skillManager, "_animancer", animancer, report);
|
||||
AssignReference(skillManager, "_formController", formController, report);
|
||||
AssignReference(skillManager, "_modifiers", GetOrAddComponent<SkillModifierRegistry>(root), report);
|
||||
AssignReference(skillManager, "_skillSocket", skillSocketT, report);
|
||||
|
||||
// PlayerWallDetector 墙壁检测层(Wall + Ground 组合)
|
||||
{
|
||||
int wallMask = 0;
|
||||
int wallL = LayerMask.NameToLayer("Wall");
|
||||
int groundL = LayerMask.NameToLayer("Ground");
|
||||
if (wallL != -1) wallMask |= 1 << wallL;
|
||||
if (groundL != -1) wallMask |= 1 << groundL;
|
||||
if (wallMask != 0)
|
||||
{
|
||||
var wso = new SerializedObject(wallDetector);
|
||||
var wsp = wso.FindProperty("_wallLayer");
|
||||
if (wsp != null) { wsp.intValue = wallMask; wso.ApplyModifiedPropertiesWithoutUndo(); }
|
||||
}
|
||||
else
|
||||
report.Add("★ Layer 'Wall'/'Ground' 不存在,PlayerWallDetector._wallLayer 未赋值。");
|
||||
}
|
||||
|
||||
// ── 事件频道(可选,缺失时跳过) ───────────────────────────────────
|
||||
AssignAsset(playerStats, "_onHPChanged", report, false, "EVT_HPChanged");
|
||||
AssignAsset(playerStats, "_onMaxHPChanged", report, false, "EVT_MaxHPChanged");
|
||||
@@ -133,6 +161,14 @@ namespace BaseGames.Editor
|
||||
AssignAsset(hurtBox, "_onHitConfirmed", report, false, "EVT_HitConfirmed");
|
||||
AssignAsset(springSystem, "_onEnemyDied", report, false, "EVT_EnemyDied");
|
||||
AssignAsset(parrySystem, "_onParrySuccess", report, false, "EVT_ParrySuccess");
|
||||
AssignAsset(formController, "_onFormChanged", report, false, "EVT_FormChanged");
|
||||
AssignAsset(formController, "_onSkillSetChanged", report, false, "EVT_SkillSetChanged");
|
||||
AssignAsset(equipmentManager, "_onCharmEquipped", report, false, "EVT_CharmEquipped");
|
||||
AssignAsset(equipmentManager, "_onCharmUnequipped", report, false, "EVT_CharmUnequipped");
|
||||
AssignAsset(equipmentManager, "_onEquipmentChanged", report, false, "EVT_EquipmentChanged");
|
||||
AssignAsset(equipmentManager, "_onAchievementNotchGranted", report, false, "EVT_AchievementNotchGranted");
|
||||
AssignAsset(statusEffectManager, "_onStatusEffectApplied", report, false, "EVT_StatusEffectApplied");
|
||||
AssignAsset(statusEffectManager, "_onStatusEffectExpired", report, false, "EVT_StatusEffectExpired");
|
||||
|
||||
// ── Config SO 自动查找(资产存在时自动绑定)──────────────────────
|
||||
Object statsConfig = FindFirstAsset("PLY_PlayerStats");
|
||||
@@ -143,6 +179,7 @@ namespace BaseGames.Editor
|
||||
Object inputReader = FindFirstAsset("InputReader");
|
||||
Object equipmentConfig = FindFirstAsset("PLY_EquipmentConfig");
|
||||
Object charmCatalog = FindFirstAsset("PLY_CharmCatalog");
|
||||
Object animConfig = FindFirstAsset("PLY_PlayerAnimationConfig");
|
||||
|
||||
if (statsConfig != null) AssignReference(playerStats, "_config", statsConfig, report);
|
||||
if (movConfig != null)
|
||||
@@ -158,16 +195,22 @@ namespace BaseGames.Editor
|
||||
}
|
||||
if (parryConfig != null) AssignReference(parrySystem, "_config", parryConfig, report);
|
||||
if (shieldConfig != null) AssignReference(shield, "_config", shieldConfig, report);
|
||||
if (inputReader != null) AssignReference(playerController, "_inputReader", inputReader, report);
|
||||
if (animConfig != null) AssignReference(playerController, "_animConfig", animConfig, report);
|
||||
if (inputReader != null)
|
||||
{
|
||||
AssignReference(playerController, "_inputReader", inputReader, report);
|
||||
AssignReference(formController, "_input", inputReader, report);
|
||||
AssignReference(skillManager, "_input", inputReader, report);
|
||||
}
|
||||
if (equipmentConfig != null) AssignReference(equipmentManager, "_config", equipmentConfig, report);
|
||||
if (charmCatalog != null) AssignReference(equipmentManager, "_charmCatalog", charmCatalog, report);
|
||||
|
||||
report.Add("★ 需手动绑定:PlayerController._animConfig(PLY_PlayerAnimationConfig)");
|
||||
if (animConfig == null) report.Add("★ 需创建并绑定:PlayerController._animConfig(PLY_PlayerAnimationConfig)");
|
||||
if (statsConfig == null) report.Add("★ 需创建并绑定:PlayerStats._config(PlayerStatsSO)");
|
||||
if (inputReader == null) report.Add("★ 需手动绑定:PlayerController._inputReader(InputReaderSO)");
|
||||
if (inputReader == null) report.Add("★ 需手动绑定:PlayerController._inputReader / FormController._input / SkillManager._input(InputReaderSO)");
|
||||
if (equipmentConfig == null) report.Add("★ 需创建并绑定:EquipmentManager._config(EquipmentConfigSO)");
|
||||
if (charmCatalog == null) report.Add("★ 需创建并绑定:EquipmentManager._charmCatalog(CharmCatalogSO)");
|
||||
report.Add("SkillManager 技能槽 SO 需手动填入。");
|
||||
report.Add("SkillManager._formSkillSets 技能槽 SO 需手动填入。");
|
||||
|
||||
Selection.activeGameObject = root;
|
||||
MarkDirtyAndLog("Player", root, report);
|
||||
|
||||
Reference in New Issue
Block a user