* feat(blueprint): 添加蓝图触发器系统 - TriggerTypes: 定义触发器类型和上下文接口 - tick/input/collision/message/timer/stateEnter/stateExit/custom - 各类型的上下文接口和工厂函数 - TriggerCondition: 触发条件系统 - ITriggerCondition 接口 - 复合条件 (CompositeCondition, NotCondition) - 通用条件 (AlwaysTrue, AlwaysFalse, TriggerType, EntityId) - 特定类型条件 (InputAction, MessageName, StateName, TimerId, CollisionEntity, CustomEvent) - ConditionBuilder 链式 API - BlueprintTrigger: 触发器核心实现 - IBlueprintTrigger 接口 - BlueprintTrigger 实现类 - TriggerRegistry 触发器注册表 - 各类型触发器工厂函数 - TriggerDispatcher: 触发器调度系统 - ITriggerDispatcher 调度器接口 - TriggerDispatcher 实现 - EntityTriggerManager 实体触发器管理器 * feat(blueprint): 添加触发器相关事件节点 - EventInput: 输入事件节点 (action/value/pressed/released) - EventCollisionEnter/Exit: 碰撞事件节点 - EventMessage: 消息事件节点 - EventTimer: 定时器事件节点 - EventStateEnter/Exit: 状态机事件节点
71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
/**
|
|
* @zh 定时器事件节点 - 定时器触发时调用
|
|
* @en Event Timer Node - Triggered when timer fires
|
|
*/
|
|
|
|
import { BlueprintNodeTemplate, BlueprintNode } from '../../types/nodes';
|
|
import { ExecutionResult } from '../../runtime/ExecutionContext';
|
|
import { INodeExecutor, RegisterNode } from '../../runtime/NodeRegistry';
|
|
|
|
/**
|
|
* @zh EventTimer 节点模板
|
|
* @en EventTimer node template
|
|
*/
|
|
export const EventTimerTemplate: BlueprintNodeTemplate = {
|
|
type: 'EventTimer',
|
|
title: 'Event Timer',
|
|
category: 'event',
|
|
color: '#CC0000',
|
|
description: 'Triggered when a timer fires / 定时器触发时执行',
|
|
keywords: ['timer', 'delay', 'schedule', 'event', 'interval'],
|
|
menuPath: ['Event', 'Timer'],
|
|
inputs: [
|
|
{
|
|
name: 'timerId',
|
|
type: 'string',
|
|
displayName: 'Timer ID',
|
|
defaultValue: ''
|
|
}
|
|
],
|
|
outputs: [
|
|
{
|
|
name: 'exec',
|
|
type: 'exec',
|
|
displayName: ''
|
|
},
|
|
{
|
|
name: 'timerId',
|
|
type: 'string',
|
|
displayName: 'Timer ID'
|
|
},
|
|
{
|
|
name: 'isRepeating',
|
|
type: 'bool',
|
|
displayName: 'Is Repeating'
|
|
},
|
|
{
|
|
name: 'timesFired',
|
|
type: 'int',
|
|
displayName: 'Times Fired'
|
|
}
|
|
]
|
|
};
|
|
|
|
/**
|
|
* @zh EventTimer 节点执行器
|
|
* @en EventTimer node executor
|
|
*/
|
|
@RegisterNode(EventTimerTemplate)
|
|
export class EventTimerExecutor implements INodeExecutor {
|
|
execute(node: BlueprintNode): ExecutionResult {
|
|
return {
|
|
nextExec: 'exec',
|
|
outputs: {
|
|
timerId: node.data?.timerId ?? '',
|
|
isRepeating: false,
|
|
timesFired: 0
|
|
}
|
|
};
|
|
}
|
|
}
|