Refactor event channels and update layer specifications

- Removed StatusEffectEventChannelSO and its associated meta file.
- Updated CreateEventChannelAssets to handle new shield-related events.
- Added CharmModule for managing charm assets in the DataHub.
- Introduced CharmEventChannelSO for charm equipped/unequipped events.
- Changed layer references from "Ground" to "Platform" in various scripts.
- Updated documentation to reflect changes in layer specifications.
- Created new event assets for ShieldBroken, ShieldRestored, StatusEffectApplied, and StatusEffectExpired.
This commit is contained in:
2026-05-21 11:08:14 +08:00
parent 280c7b22f5
commit d09bc95c3f
32 changed files with 1151 additions and 52 deletions

View File

@@ -95,7 +95,7 @@ namespace BaseGames.Editor
Transform groundCheckT = GetOrCreateChild(root.transform, "GroundCheck");
groundCheckT.localPosition = new Vector3(0f, -0.75f, 0f);
AssignReference(playerMovement, "_groundCheck", groundCheckT, report);
AssignLayerMask(playerMovement, "_groundLayer", "Ground", report);
AssignLayerMask(playerMovement, "_groundLayer", "Platform", report);
// ── SkillHitBox_Slot 子节点(技能 HitBox 实例化挂点)────────────────
Transform skillSocketT = GetOrCreateChild(root.transform, "SkillHitBox_Slot");
@@ -129,11 +129,11 @@ namespace BaseGames.Editor
AssignReference(skillManager, "_modifiers", GetOrAddComponent<SkillModifierRegistry>(root), report);
AssignReference(skillManager, "_skillSocket", skillSocketT, report);
// PlayerWallDetector 墙壁检测层Wall + Ground 组合)
// PlayerWallDetector 墙壁检测层Wall + Platform 组合)
{
int wallMask = 0;
int wallL = LayerMask.NameToLayer("Wall");
int groundL = LayerMask.NameToLayer("Ground");
int groundL = LayerMask.NameToLayer("Platform");
if (wallL != -1) wallMask |= 1 << wallL;
if (groundL != -1) wallMask |= 1 << groundL;
if (wallMask != 0)
@@ -143,7 +143,7 @@ namespace BaseGames.Editor
if (wsp != null) { wsp.intValue = wallMask; wso.ApplyModifiedPropertiesWithoutUndo(); }
}
else
report.Add("★ Layer 'Wall'/'Ground' 不存在PlayerWallDetector._wallLayer 未赋值。");
report.Add("★ Layer 'Wall'/'Platform' 不存在PlayerWallDetector._wallLayer 未赋值。");
}
// ── 事件频道(可选,缺失时跳过) ───────────────────────────────────
@@ -169,6 +169,8 @@ namespace BaseGames.Editor
AssignAsset(equipmentManager, "_onAchievementNotchGranted", report, false, "EVT_AchievementNotchGranted");
AssignAsset(statusEffectManager, "_onStatusEffectApplied", report, false, "EVT_StatusEffectApplied");
AssignAsset(statusEffectManager, "_onStatusEffectExpired", report, false, "EVT_StatusEffectExpired");
AssignAsset(shield, "_onShieldBrokenChannel", report, false, "EVT_ShieldBroken");
AssignAsset(shield, "_onShieldRestoredChannel", report, false, "EVT_ShieldRestored");
// ── Config SO 自动查找(资产存在时自动绑定)──────────────────────
Object statsConfig = FindFirstAsset("PLY_PlayerStats");
@@ -178,7 +180,7 @@ namespace BaseGames.Editor
Object shieldConfig = FindFirstAsset("PLY_ShieldConfig");
Object inputReader = FindFirstAsset("InputReader");
Object equipmentConfig = FindFirstAsset("PLY_EquipmentConfig");
Object charmCatalog = FindFirstAsset("PLY_CharmCatalog");
Object charmCatalog = FindFirstAsset("CHM_Catalog");
Object animConfig = FindFirstAsset("PLY_PlayerAnimationConfig");
if (statsConfig != null) AssignReference(playerStats, "_config", statsConfig, report);
@@ -752,7 +754,7 @@ namespace BaseGames.Editor
GameObject go = new GameObject("GroundPlatform");
Undo.RegisterCreatedObjectUndo(go, "Place Ground Platform");
go.transform.position = GetDropPosition();
SetLayer(go, "Ground", report);
SetLayer(go, "Platform", report);
// 2D Sprite用 localScale 设定尺寸,让 SpriteRenderer 和 BoxCollider2D 同步缩放
go.transform.localScale = new Vector3(8f, 0.5f, 1f);
@@ -774,7 +776,7 @@ namespace BaseGames.Editor
GameObject go = new GameObject("MovingPlatform");
Undo.RegisterCreatedObjectUndo(go, "Place Moving Platform");
go.transform.position = GetDropPosition();
SetLayer(go, "Ground", report);
SetLayer(go, "Platform", report);
Rigidbody2D rb = GetOrAddComponent<Rigidbody2D>(go);
rb.bodyType = RigidbodyType2D.Kinematic;
@@ -820,7 +822,7 @@ namespace BaseGames.Editor
GetOrAddComponent<Grid>(gridGo);
GameObject groundGo = GetOrCreateChild(gridGo.transform, "Ground").gameObject;
SetLayer(groundGo, "Ground", report);
SetLayer(groundGo, "Platform", report);
GetOrAddComponent<Tilemap>(groundGo);
GetOrAddComponent<TilemapRenderer>(groundGo);
TilemapCollider2D tilemapCollider = GetOrAddComponent<TilemapCollider2D>(groundGo);
@@ -859,7 +861,7 @@ namespace BaseGames.Editor
GameObject go = new GameObject("Obstacle");
Undo.RegisterCreatedObjectUndo(go, "Place Obstacle");
go.transform.position = GetDropPosition();
SetLayer(go, "Ground", report);
SetLayer(go, "Platform", report);
// 2D Sprite用 localScale 设定尺寸,让 SpriteRenderer 和 BoxCollider2D 同步缩放
go.transform.localScale = new Vector3(1f, 1f, 1f);