Files
ChildHood/.claude/agent-memory/game-dev/interaction-effect-architecture.md
T

32 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: interaction-effect-architecture
description: 交互系统 v1.0 Effect/Action 数据驱动架构决策记录
metadata:
type: project
---
## 交互系统架构决策(v1.0 重构,2026-06-11)
### 核心架构:Effect/Action 数据驱动
交互物不关心"交互后发生什么",只配置 Effect(由 Action 组成)交给 EffectManager 执行。
**Why:** v0.1 用 switch(Type) 硬编码,新增交互类型需改代码。v1.0 配数据即可。
### Manager 归属
- FInteractionManager / FEffectManager 是普通 C++ 类,不是 UObject
- 由 ASystemDriver (AInfo) 持有,随 World 生灭
- 不依赖 UE Subsystem 生命周期,显式控制创建顺序和 Tick 顺序
- 所有 UObject 引用用 TWeakObjectPtr,回调用 TFunction
- GameInstance 不持有任何交互系统对象,只有 UPersistenceSubsystem 跨 World
### 分层规则
- 表现层只读 Manager 缓存(getter),不碰 Component
- Manager 在选择变化时从 Component 读一次并缓存
- 逻辑事件仅用于 "A 影响 B"(如 Consume → Persistence)
### 协调方式
- Character 输入回调通过 ASystemDriver::Get(World) 访问两个 Manager
- Driver::BeginPlay 中 TFunction 连线 EffectManager.OnEffectComplete → Manager.OnInteractionFinished
- PromptComponent 通过 Driver 获取 Manager,只读缓存