diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index dcc68136..77eafcac 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -3,8 +3,12 @@ import { defineConfig } from 'astro/config'; import starlight from '@astrojs/starlight'; import vue from '@astrojs/vue'; import tailwindcss from '@tailwindcss/vite'; +import rehypeRaw from 'rehype-raw'; export default defineConfig({ + markdown: { + rehypePlugins: [rehypeRaw], + }, integrations: [ starlight({ title: 'ESEngine', diff --git a/docs/package.json b/docs/package.json index 567b7949..d68346de 100644 --- a/docs/package.json +++ b/docs/package.json @@ -15,6 +15,7 @@ "@astrojs/vue": "^5.1.3", "@tailwindcss/vite": "^4.1.18", "astro": "^5.6.1", + "rehype-raw": "^7.0.0", "sharp": "^0.34.2", "tailwindcss": "^4.1.18", "vue": "^3.5.26" diff --git a/docs/src/content/docs/en/modules/blueprint/nodes.md b/docs/src/content/docs/en/modules/blueprint/nodes.md index 3a29cbc9..5c5a5a4d 100644 --- a/docs/src/content/docs/en/modules/blueprint/nodes.md +++ b/docs/src/content/docs/en/modules/blueprint/nodes.md @@ -1,192 +1,609 @@ --- title: "ECS Node Reference" -description: "Blueprint built-in ECS operation nodes" +description: "Blueprint built-in ECS operation nodes - complete reference with visual examples" --- +This document provides a complete reference for all built-in blueprint nodes with visual examples. + + + +## Pin Type Legend + +
+
Execution Flow
+
Entity
+
Component
+
Number
+
String
+
Boolean
+
+ ## Event Nodes Lifecycle events as blueprint entry points: -| Node | Description | -|------|-------------| -| `EventBeginPlay` | Triggered when blueprint starts | -| `EventTick` | Triggered each frame, receives deltaTime | -| `EventEndPlay` | Triggered when blueprint stops | +| Node | Description | Outputs | +|------|-------------|---------| +| `EventBeginPlay` | Triggered when blueprint starts | Exec, Self (Entity) | +| `EventTick` | Triggered each frame | Exec, Delta Time | +| `EventEndPlay` | Triggered when blueprint stops | Exec | + +### Example: Game Initialization + +
+ +
+
+ + Event BeginPlay + +
+
+
+ + Self +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Message + "Game Started!" +
+
+
+
+ +### Example: Per-Frame Movement + +
+ +
+
+ + Event Tick + +
+
+
+ + Delta Time +
+
+
+
+
Multiply
+
+
+ + A +
+
+ + B + 100 +
+
+ + Result +
+
+
+
+
Set Property
+
+
+ + Exec +
+
+ + Target +
+
+ + x +
+
+
+
## Entity Nodes -ECS entity operations: +Manipulate ECS entities: | Node | Description | Type | |------|-------------|------| -| `Get Self` | Get entity owning this blueprint | Pure | -| `Create Entity` | Create new entity in scene | Execution | -| `Destroy Entity` | Destroy specified entity | Execution | -| `Destroy Self` | Destroy self entity | Execution | +| `Get Self` | Get the entity owning this blueprint | Pure | +| `Create Entity` | Create a new entity in the scene | Exec | +| `Destroy Entity` | Destroy specified entity | Exec | +| `Destroy Self` | Destroy the owning entity | Exec | | `Is Valid` | Check if entity is valid | Pure | | `Get Entity Name` | Get entity name | Pure | -| `Set Entity Name` | Set entity name | Execution | -| `Get Entity Tag` | Get entity tag | Pure | -| `Set Entity Tag` | Set entity tag | Execution | -| `Set Active` | Set entity active state | Execution | -| `Is Active` | Check if entity is active | Pure | +| `Set Entity Name` | Set entity name | Exec | | `Find Entity By Name` | Find entity by name | Pure | -| `Find Entities By Tag` | Find all entities by tag | Pure | -| `Get Entity ID` | Get entity unique ID | Pure | -| `Find Entity By ID` | Find entity by ID | Pure | +| `Find Entities By Tag` | Find all entities with tag | Pure | + +### Example: Create Bullet + +
+ +
+
+ + Event BeginPlay + +
+
+
+ + Self +
+
+
+
+
Create Entity
+
+
+ + Exec +
+
+ + Exec +
+
+ + Entity +
+
+
+
+
Add Transform
+
+
+ + Exec +
+
+ + Entity +
+
+
+
## Component Nodes -ECS component operations: +Read and write component properties: | Node | Description | Type | |------|-------------|------| +| `Get Component` | Get component of specified type from entity | Pure | | `Has Component` | Check if entity has specified component | Pure | -| `Get Component` | Get component from entity | Pure | -| `Get All Components` | Get all components from entity | Pure | -| `Remove Component` | Remove component | Execution | -| `Get Component Property` | Get component property value | Pure | -| `Set Component Property` | Set component property value | Execution | -| `Get Component Type` | Get component type name | Pure | -| `Get Owner Entity` | Get owning entity from component | Pure | +| `Add Component` | Add component to entity | Exec | +| `Remove Component` | Remove component from entity | Exec | +| `Get Property` | Get component property value | Pure | +| `Set Property` | Set component property value | Exec | + +### Example: Modify Position + +
+ +
+
Get Self
+
+
+ + Entity +
+
+
+
+
Get Component
+
+
+ + Entity +
+
+ + Transform +
+
+
+
+
Get Property
+
+
+ + Target +
+
+ + x +
+
+
+
## Flow Control Nodes -Control execution flow: +Control blueprint execution flow: | Node | Description | |------|-------------| -| `Branch` | Conditional branch (if/else) | -| `Sequence` | Execute multiple outputs in sequence | -| `For Loop` | Loop execution | -| `For Each` | Iterate array | -| `While Loop` | Conditional loop | +| `Branch` | Conditional branching (if/else) | +| `Sequence` | Execute multiple branches in order | +| `For Loop` | Loop specified number of times | +| `For Each` | Iterate over array elements | +| `While Loop` | Loop while condition is true | | `Do Once` | Execute only once | -| `Flip Flop` | Alternate between two branches | -| `Gate` | Toggleable execution gate | +| `Flip Flop` | Alternate between A and B | +| `Gate` | Gate switch control | + +### Example: Conditional Branch + +
+ +
+
Condition
+
+
+ + Exec +
+
+ + Result +
+
+
+
+
Branch
+
+
+ + Exec +
+
+ + Cond +
+
+ + True +
+
+ + False +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Msg + "Yes" +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Msg + "No" +
+
+
+
+ +### Example: For Loop + +
+ +
+
+ + Event BeginPlay + +
+
+
+
For Loop
+
+
+ + Exec +
+
+ + First + 0 +
+
+ + Last + 10 +
+
+ + Body +
+
+ + Index +
+
+ + Done +
+
+
+
## Time Nodes -| Node | Description | Type | -|------|-------------|------| -| `Delay` | Delay execution | Execution | -| `Get Delta Time` | Get frame delta time | Pure | -| `Get Time` | Get total runtime | Pure | +| Node | Description | Output | +|------|-------------|--------| +| `Delay` | Delay execution by specified seconds | Exec | +| `Get Delta Time` | Get frame delta time | Float | +| `Get Time` | Get total runtime | Float | + +### Example: Delayed Execution + +
+ +
+
+ + Event BeginPlay + +
+
+
+
Delay
+
+
+ + Exec +
+
+ + Duration + 2.0 +
+
+ + Done +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Msg + "After 2s" +
+
+
+
## Math Nodes -Basic Operations: +### Basic Operations + +| Node | Description | Inputs | Output | +|------|-------------|--------|--------| +| `Add` | Addition | A, B | A + B | +| `Subtract` | Subtraction | A, B | A - B | +| `Multiply` | Multiplication | A, B | A × B | +| `Divide` | Division | A, B | A / B | +| `Modulo` | Modulo | A, B | A % B | + +### Math Functions + +| Node | Description | Inputs | Output | +|------|-------------|--------|--------| +| `Abs` | Absolute value | Value | \|Value\| | +| `Sqrt` | Square root | Value | √Value | +| `Pow` | Power | Base, Exp | Base^Exp | +| `Floor` | Floor | Value | ⌊Value⌋ | +| `Ceil` | Ceiling | Value | ⌈Value⌉ | +| `Round` | Round | Value | round(Value) | +| `Clamp` | Clamp to range | Value, Min, Max | min(max(V, Min), Max) | +| `Lerp` | Linear interpolation | A, B, Alpha | A + (B-A) × Alpha | +| `Min` | Minimum | A, B | min(A, B) | +| `Max` | Maximum | A, B | max(A, B) | + +### Trigonometric Functions | Node | Description | |------|-------------| -| `Add` / `Subtract` / `Multiply` / `Divide` | Basic arithmetic | -| `Modulo` | Modulo operation (%) | -| `Negate` | Negate value | -| `Abs` | Absolute value | -| `Sign` | Sign (+1, 0, -1) | -| `Min` / `Max` | Minimum/Maximum | -| `Clamp` | Clamp to range | -| `Wrap` | Wrap value to range | +| `Sin` | Sine | +| `Cos` | Cosine | +| `Tan` | Tangent | +| `Asin` | Arc sine | +| `Acos` | Arc cosine | +| `Atan` | Arc tangent | +| `Atan2` | Two-argument arc tangent | -Power & Roots: +### Random Numbers -| Node | Description | -|------|-------------| -| `Power` | Power (A^B) | -| `Sqrt` | Square root | +| Node | Description | Inputs | Output | +|------|-------------|--------|--------| +| `Random` | Random float [0, 1) | - | Float | +| `Random Range` | Random in range | Min, Max | Float | +| `Random Int` | Random integer | Min, Max | Int | -Rounding: +### Comparison Nodes -| Node | Description | -|------|-------------| -| `Floor` | Round down | -| `Ceil` | Round up | -| `Round` | Round to nearest | +| Node | Description | Output | +|------|-------------|--------| +| `Equal` | A == B | Boolean | +| `Not Equal` | A != B | Boolean | +| `Greater` | A > B | Boolean | +| `Greater Or Equal` | A >= B | Boolean | +| `Less` | A < B | Boolean | +| `Less Or Equal` | A <= B | Boolean | -Trigonometry: +### Example: Clamp Value -| Node | Description | -|------|-------------| -| `Sin` / `Cos` / `Tan` | Sine/Cosine/Tangent | -| `Asin` / `Acos` / `Atan` | Inverse trig functions | -| `Atan2` | Two-argument arctangent | -| `DegToRad` / `RadToDeg` | Degree/Radian conversion | +
+ +
+
Random Range
+
+
+ + Min + 0 +
+
+ + Max + 100 +
+
+ + Result +
+
+
+
+
Clamp
+
+
+ + Value +
+
+ + Min + 20 +
+
+ + Max + 80 +
+
+ + Result +
+
+
+
-Interpolation: +## Variable Nodes -| Node | Description | -|------|-------------| -| `Lerp` | Linear interpolation | -| `InverseLerp` | Inverse linear interpolation | +Blueprint-defined variables automatically generate Get and Set nodes: -Random: +| Node | Description | Type | +|------|-------------|------| +| `Get ` | Read variable value | Pure | +| `Set ` | Set variable value | Exec | -| Node | Description | -|------|-------------| -| `Random Range` | Random float in range | -| `Random Int` | Random integer in range | +### Example: Counter -## Logic Nodes - -Comparison: - -| Node | Description | -|------|-------------| -| `Equal` | Equal (==) | -| `Not Equal` | Not equal (!=) | -| `Greater Than` | Greater than (>) | -| `Greater Or Equal` | Greater than or equal (>=) | -| `Less Than` | Less than (<) | -| `Less Or Equal` | Less than or equal (<=) | -| `In Range` | Check if value is in range | - -Logical Operations: - -| Node | Description | -|------|-------------| -| `AND` | Logical AND | -| `OR` | Logical OR | -| `NOT` | Logical NOT | -| `XOR` | Exclusive OR | -| `NAND` | NOT AND | - -Utility: - -| Node | Description | -|------|-------------| -| `Is Null` | Check if value is null | -| `Select` | Choose A or B based on condition (ternary) | +
+ +
+
+ + Event Tick + +
+
+
+ + Delta +
+
+
+
+
Get Count
+
+
+ + Value +
+
+
+
+
Add
+
+
+ + Exec +
+
+ + A +
+
+ + B + 1 +
+
+ + Result +
+
+
+
+
Set Count
+
+
+ + Exec +
+
+ + Value +
+
+ + Exec +
+
+
+
## Debug Nodes | Node | Description | |------|-------------| -| `Print` | Print to console | +| `Print` | Output message to console | -## Auto-generated Component Nodes +## Related Documentation -Components marked with `@BlueprintExpose` decorator auto-generate nodes: - -```typescript -@ECSComponent('Transform') -@BlueprintExpose({ displayName: 'Transform', category: 'core' }) -export class TransformComponent extends Component { - @BlueprintProperty({ displayName: 'X Position' }) - x: number = 0; - - @BlueprintProperty({ displayName: 'Y Position' }) - y: number = 0; - - @BlueprintMethod({ displayName: 'Translate' }) - translate(dx: number, dy: number): void { - this.x += dx; - this.y += dy; - } -} -``` - -Generated nodes: -- **Get Transform** - Get Transform component -- **Get X Position** / **Set X Position** - Access x property -- **Get Y Position** / **Set Y Position** - Access y property -- **Translate** - Call translate method +- [Blueprint Editor Guide](./editor-guide) - Learn how to use the editor +- [Custom Nodes](./custom-nodes) - Create custom nodes +- [Blueprint VM](./vm) - Runtime API diff --git a/docs/src/content/docs/modules/blueprint/nodes.md b/docs/src/content/docs/modules/blueprint/nodes.md index 18f7221c..a058778e 100644 --- a/docs/src/content/docs/modules/blueprint/nodes.md +++ b/docs/src/content/docs/modules/blueprint/nodes.md @@ -1,17 +1,117 @@ --- title: "ECS 节点参考" -description: "蓝图内置 ECS 操作节点" +description: "蓝图内置 ECS 操作节点完整参考" --- +本文档提供蓝图系统所有内置节点的完整参考,包含可视化示例。 + +## 引脚类型说明 + +
+
执行流 (Exec)
+
实体 (Entity)
+
组件 (Component)
+
数值 (Float)
+
字符串 (String)
+
布尔 (Boolean)
+
+ ## 事件节点 生命周期事件,作为蓝图执行的入口点: -| 节点 | 说明 | -|------|------| -| `EventBeginPlay` | 蓝图启动时触发 | -| `EventTick` | 每帧触发,接收 deltaTime | -| `EventEndPlay` | 蓝图停止时触发 | +| 节点 | 说明 | 输出 | +|------|------|------| +| `EventBeginPlay` | 蓝图启动时触发 | Exec, Self (Entity) | +| `EventTick` | 每帧触发 | Exec, Delta Time | +| `EventEndPlay` | 蓝图停止时触发 | Exec | + +### 示例:游戏初始化 + +
+ +
+
+ + Event BeginPlay + +
+
+
+ + Self +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Message + "游戏开始!" +
+
+
+
+ +### 示例:每帧移动 + +
+ +
+
+ + Event Tick + +
+
+
+ + Delta Time +
+
+
+
+
Multiply
+
+
+ + A +
+
+ + B + 100 +
+
+ + Result +
+
+
+
+
Set Property
+
+
+ + Exec +
+
+ + Target +
+
+ + x +
+
+
+
## 实体节点 (Entity) @@ -26,167 +126,415 @@ description: "蓝图内置 ECS 操作节点" | `Is Valid` | 检查实体是否有效 | 纯节点 | | `Get Entity Name` | 获取实体名称 | 纯节点 | | `Set Entity Name` | 设置实体名称 | 执行节点 | -| `Get Entity Tag` | 获取实体标签 | 纯节点 | -| `Set Entity Tag` | 设置实体标签 | 执行节点 | -| `Set Active` | 设置实体激活状态 | 执行节点 | -| `Is Active` | 检查实体是否激活 | 纯节点 | | `Find Entity By Name` | 按名称查找实体 | 纯节点 | | `Find Entities By Tag` | 按标签查找所有实体 | 纯节点 | -| `Get Entity ID` | 获取实体唯一 ID | 纯节点 | -| `Find Entity By ID` | 按 ID 查找实体 | 纯节点 | + +### 示例:创建子弹 + +
+ +
+
+ + Event BeginPlay + +
+
+
+ + Self +
+
+
+
+
Create Entity
+
+
+ + Exec +
+
+ + Exec +
+
+ + Entity +
+
+
+
+
Add Transform
+
+
+ + Exec +
+
+ + Entity +
+
+
+
## 组件节点 (Component) -操作 ECS 组件: +读写组件属性: | 节点 | 说明 | 类型 | |------|------|------| -| `Has Component` | 检查实体是否有指定组件 | 纯节点 | -| `Get Component` | 获取实体的组件 | 纯节点 | -| `Get All Components` | 获取实体所有组件 | 纯节点 | -| `Remove Component` | 移除组件 | 执行节点 | -| `Get Component Property` | 获取组件属性值 | 纯节点 | -| `Set Component Property` | 设置组件属性值 | 执行节点 | -| `Get Component Type` | 获取组件类型名称 | 纯节点 | -| `Get Owner Entity` | 从组件获取所属实体 | 纯节点 | +| `Get Component` | 从实体获取指定类型组件 | 纯节点 | +| `Has Component` | 检查实体是否拥有指定组件 | 纯节点 | +| `Add Component` | 为实体添加组件 | 执行节点 | +| `Remove Component` | 从实体移除组件 | 执行节点 | +| `Get Property` | 获取组件属性值 | 纯节点 | +| `Set Property` | 设置组件属性值 | 执行节点 | -## 流程控制节点 (Flow) +### 示例:修改位置 -控制执行流程: +
+ +
+
Get Self
+
+
+ + Entity +
+
+
+
+
Get Component
+
+
+ + Entity +
+
+ + Transform +
+
+
+
+
Get Property
+
+
+ + Target +
+
+ + x +
+
+
+
+ +## 流程控制节点 + +控制蓝图执行流程: | 节点 | 说明 | |------|------| -| `Branch` | 条件分支 (if/else) | -| `Sequence` | 顺序执行多个输出 | -| `For Loop` | 循环执行 | -| `For Each` | 遍历数组 | +| `Branch` | 条件分支(if/else) | +| `Sequence` | 按顺序执行多个分支 | +| `For Loop` | 指定次数循环 | +| `For Each` | 遍历数组元素 | | `While Loop` | 条件循环 | -| `Do Once` | 只执行一次 | -| `Flip Flop` | 交替执行两个分支 | -| `Gate` | 可开关的执行门 | +| `Do Once` | 仅执行一次 | +| `Flip Flop` | 交替执行 A/B | +| `Gate` | 门控开关 | -## 时间节点 (Time) +### 示例:条件分支 + +
+ +
+
Condition
+
+
+ + Exec +
+
+ + Result +
+
+
+
+
Branch
+
+
+ + Exec +
+
+ + Cond +
+
+ + True +
+
+ + False +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Msg + "是" +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Msg + "否" +
+
+
+
+ +### 示例:For 循环 + +
+ +
+
+ + Event BeginPlay + +
+
+
+
For Loop
+
+
+ + Exec +
+
+ + First + 0 +
+
+ + Last + 10 +
+
+ + Body +
+
+ + Index +
+
+ + Done +
+
+
+
+ +## 时间节点 + +| 节点 | 说明 | 输出 | +|------|------|------| +| `Delay` | 延迟执行指定秒数 | Exec | +| `Get Delta Time` | 获取帧间隔时间 | Float | +| `Get Time` | 获取运行总时间 | Float | + +### 示例:延迟执行 + +
+ +
+
+ + Event BeginPlay + +
+
+
+
Delay
+
+
+ + Exec +
+
+ + Duration + 2.0 +
+
+ + Done +
+
+
+
+
Print
+
+
+ + Exec +
+
+ + Msg + "2秒后" +
+
+
+
+ +## 数学节点 + +### 基础运算 + +| 节点 | 说明 | 输入 | 输出 | +|------|------|------|------| +| `Add` | 加法 | A, B | A + B | +| `Subtract` | 减法 | A, B | A - B | +| `Multiply` | 乘法 | A, B | A × B | +| `Divide` | 除法 | A, B | A / B | +| `Modulo` | 取模 | A, B | A % B | + +### 数学函数 + +| 节点 | 说明 | 输入 | 输出 | +|------|------|------|------| +| `Abs` | 绝对值 | Value | \|Value\| | +| `Sqrt` | 平方根 | Value | √Value | +| `Pow` | 幂运算 | Base, Exp | Base^Exp | +| `Floor` | 向下取整 | Value | ⌊Value⌋ | +| `Ceil` | 向上取整 | Value | ⌈Value⌉ | +| `Round` | 四舍五入 | Value | round(Value) | +| `Clamp` | 区间钳制 | Value, Min, Max | min(max(V, Min), Max) | +| `Lerp` | 线性插值 | A, B, Alpha | A + (B-A) × Alpha | +| `Min` | 取最小值 | A, B | min(A, B) | +| `Max` | 取最大值 | A, B | max(A, B) | + +### 三角函数 + +| 节点 | 说明 | +|------|------| +| `Sin` | 正弦 | +| `Cos` | 余弦 | +| `Tan` | 正切 | +| `Asin` | 反正弦 | +| `Acos` | 反余弦 | +| `Atan` | 反正切 | +| `Atan2` | 二参数反正切 | + +### 随机数 + +| 节点 | 说明 | 输入 | 输出 | +|------|------|------|------| +| `Random` | 随机浮点数 [0, 1) | - | Float | +| `Random Range` | 范围内随机数 | Min, Max | Float | +| `Random Int` | 随机整数 | Min, Max | Int | + +### 比较节点 + +| 节点 | 说明 | 输出 | +|------|------|------| +| `Equal` | A == B | Boolean | +| `Not Equal` | A != B | Boolean | +| `Greater` | A > B | Boolean | +| `Greater Or Equal` | A >= B | Boolean | +| `Less` | A < B | Boolean | +| `Less Or Equal` | A <= B | Boolean | + +### 示例:钳制数值 + +
+ +
+
Random Range
+
+
+ + Min + 0 +
+
+ + Max + 100 +
+
+ + Result +
+
+
+
+
Clamp
+
+
+ + Value +
+
+ + Min + 20 +
+
+ + Max + 80 +
+
+ + Result +
+
+
+
+ +## 变量节点 + +蓝图定义的变量会自动生成 Get 和 Set 节点: | 节点 | 说明 | 类型 | |------|------|------| -| `Delay` | 延迟执行 | 执行节点 | -| `Get Delta Time` | 获取帧间隔时间 | 纯节点 | -| `Get Time` | 获取运行总时间 | 纯节点 | +| `Get <变量名>` | 读取变量值 | 纯节点 | +| `Set <变量名>` | 设置变量值 | 执行节点 | -## 数学节点 (Math) - -基础运算: +## 调试节点 | 节点 | 说明 | |------|------| -| `Add` / `Subtract` / `Multiply` / `Divide` | 四则运算 | -| `Modulo` | 取模运算 (%) | -| `Negate` | 取负 | -| `Abs` | 绝对值 | -| `Sign` | 符号 (+1, 0, -1) | -| `Min` / `Max` | 最小/最大值 | -| `Clamp` | 限制在范围内 | -| `Wrap` | 循环限制在范围内 | +| `Print` | 输出消息到控制台 | -幂与根: +## 相关文档 -| 节点 | 说明 | -|------|------| -| `Power` | 幂运算 (A^B) | -| `Sqrt` | 平方根 | - -取整: - -| 节点 | 说明 | -|------|------| -| `Floor` | 向下取整 | -| `Ceil` | 向上取整 | -| `Round` | 四舍五入 | - -三角函数: - -| 节点 | 说明 | -|------|------| -| `Sin` / `Cos` / `Tan` | 正弦/余弦/正切 | -| `Asin` / `Acos` / `Atan` | 反三角函数 | -| `Atan2` | 两参数反正切 | -| `DegToRad` / `RadToDeg` | 角度与弧度转换 | - -插值: - -| 节点 | 说明 | -|------|------| -| `Lerp` | 线性插值 | -| `InverseLerp` | 反向线性插值 | - -随机数: - -| 节点 | 说明 | -|------|------| -| `Random Range` | 范围内随机浮点数 | -| `Random Int` | 范围内随机整数 | - -## 逻辑节点 (Logic) - -比较运算: - -| 节点 | 说明 | -|------|------| -| `Equal` | 等于 (==) | -| `Not Equal` | 不等于 (!=) | -| `Greater Than` | 大于 (>) | -| `Greater Or Equal` | 大于等于 (>=) | -| `Less Than` | 小于 (<) | -| `Less Or Equal` | 小于等于 (<=) | -| `In Range` | 检查值是否在范围内 | - -逻辑运算: - -| 节点 | 说明 | -|------|------| -| `AND` | 逻辑与 | -| `OR` | 逻辑或 | -| `NOT` | 逻辑非 | -| `XOR` | 异或 | -| `NAND` | 与非 | - -工具节点: - -| 节点 | 说明 | -|------|------| -| `Is Null` | 检查值是否为空 | -| `Select` | 根据条件选择 A 或 B (三元运算) | - -## 调试节点 (Debug) - -| 节点 | 说明 | -|------|------| -| `Print` | 输出到控制台 | - -## 自动生成的组件节点 - -使用 `@BlueprintExpose` 装饰器标记的组件会自动生成节点: - -```typescript -@ECSComponent('Transform') -@BlueprintExpose({ displayName: '变换', category: 'core' }) -export class TransformComponent extends Component { - @BlueprintProperty({ displayName: 'X 坐标' }) - x: number = 0; - - @BlueprintProperty({ displayName: 'Y 坐标' }) - y: number = 0; - - @BlueprintMethod({ displayName: '移动' }) - translate(dx: number, dy: number): void { - this.x += dx; - this.y += dy; - } -} -``` - -生成的节点: -- **Get Transform** - 获取 Transform 组件 -- **Get X 坐标** / **Set X 坐标** - 访问 x 属性 -- **Get Y 坐标** / **Set Y 坐标** - 访问 y 属性 -- **移动** - 调用 translate 方法 +- [蓝图编辑器指南](./editor-guide) - 学习如何使用编辑器 +- [自定义节点](./custom-nodes) - 创建自定义节点 +- [蓝图虚拟机](./vm) - 运行时 API