概览
minecraft:behavior.timer_flag_1 是一个实体组件:写在自定义生物的 components 对象中,或其中某个组件组里。 通用计时器目标:开始时触发一个事件,运行一段时间后,在结束或被打断时再触发另一个事件。运行期间 query.timer_flag_1 返回 1,可以用来驱动动画。共有三个(timer_flag_1 到 3),可以分别运行独立的计时器。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
duration_range | FloatRange | {"max":0,"min":0} | 目标运行的随机时长(秒)。 |
cooldown_range | FloatRange | {"max":0,"min":0} | 目标再次运行前的随机等待时间(秒)。设置后,第一次运行前也会等待。 |
on_start | ActorDefinitionTrigger | {"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"} | 目标开始时触发的事件。 |
on_end | ActorDefinitionTrigger | {"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"} | 目标结束或被打断时触发的事件。 |
priority | integer | 0 | 多个目标同时想运行时决定谁优先:数字越小越先运行。范围:0 到 … |
control_flags | Goal's control flags[] | 无 | 列出这个目标要控制的身体部分(比如移动、看向或跳跃),这样需要同一部分的目标就不会同时运行。 |
示例
写在 BP/entities/<name>.json 的 components 对象中(值为默认值或占位值):
BP/entities/<name>.json
{
"minecraft:behavior.timer_flag_1": {
"duration_range": {
"max": 0,
"min": 0
},
"cooldown_range": {
"max": 0,
"min": 0
},
"on_start": {
"event": "",
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"target": "self"
},
"on_end": {
"event": "",
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"target": "self"
},
"priority": 0,
"control_flags": []
}
}