Files
loneseDocument/Content/Blueprints/BP_TestMode.md
meishibiezb 29a3f77908 init
2026-06-04 21:44:13 +08:00

48 lines
2.6 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.
# BP_TestMode
## 基本信息
- **类型**: Blueprint (GameMode)
- **父类**: GameModeBase
- **源文件**: /Game/Blueprints/BP_TestMode.BP_TestMode
- **模块**: Content
## 功能概述
BP_TestMode 是项目的 GameMode 蓝图,配置默认的 Pawn、PlayerController 和 HUD 类,将项目的所有核心类串联起来。
## 设计用意
作为项目唯一的 GameModeBP_TestMode 将分散的蓝图类通过引擎框架连接在一起。它将 BP_TestChar 设为默认 Pawn、BP_TestCtl 设为玩家控制器、BP_Hud 设为 HUD 类,形成一个完整的游戏运行时配置。这样所有核心类型的替换只需要修改这一个地方。
## 职责范围
BP_TestMode 负责配置默认游戏类和串联项目核心类型之间的关系。具体的角色行为、控制器逻辑、UI 管理分别由各自对应的类负责。
## 项目内依赖
| 依赖项 | 关系 | 源文件 |
|--------|------|--------|
| BP_TestChar | DefaultPawn | /Game/Blueprints/BP_TestChar |
| BP_TestCtl | PlayerController | /Game/Blueprints/BP_TestCtl |
| BP_Hud | HUD | /Game/Blueprints/BP_Hud |
## 对外接口
- **继承自 AGameModeBase 的标准接口**
- GameMode 生命周期事件:`InitGame``PreLogin``PostLogin``Logout``RestartPlayer``SpawnDefaultPawnAtTransform` 等,均可在蓝图 EventGraph 中覆盖EventGraph 中 event_count=2, node_count=2
- `GetDefaultPawnClassForController` -- 返回配置的 DefaultPawnClass
- GameMode 的标准函数和事件均继承可用
- **编辑器配置属性**(通过 GameMode 基类继承):
- `DefaultPawnClass` = BP_TestChar -- 默认 Pawn 类型
- `PlayerControllerClass` = BP_TestCtl -- 玩家控制器类型
- `HUDClass` = BP_Hud -- HUD 类型
- 其他 GameMode 标准配置属性GameStateClass、SpectatorClass 等)
## 使用方法
- 在关卡的世界设置World Settings中将 `GameMode Override` 设置为 BP_TestMode
- 或在项目设置中将其设为默认 GameMode应用于所有关卡
- 配置三个核心 class 属性,将 BP_TestChar、BP_TestCtl、BP_Hud 串联为一个完整游戏框架
- EventGraph 中无额外蓝图逻辑node_count=2纯配置型蓝图所有替换只需修改此文件中的属性值
- 项目有且仅有一个 GameMode所有核心类型的替换集中在此处管理
## 用例
- 关卡 World Settings 的 `GameMode Override`,引擎启动时加载
- `DefaultPawnClass=BP_TestChar` -- 新玩家进入时自动生成该 Pawn
- `PlayerControllerClass=BP_TestCtl` -- 新玩家连接时自动创建该控制器
- `HUDClass=BP_Hud` -- 创建控制器时自动生成该 HUD