跳转至

GFTurnPhase

API Reference / Turn Based / 类索引

  • 路径:addons/gf/extensions/turn_based/resources/gf_turn_phase.gd
  • 模块:Turn Based
  • 继承:Resource
  • API:public
  • 类别:协议与扩展点 (protocol)
  • 首次版本:3.17.0

通用回合阶段基类。 阶段只提供 _enter/_execute/_exit 生命周期和完成信号, 不绑定任何具体游戏流程。

成员概览

类型 名称 签名
信号 finished signal finished
属性 phase_id var phase_id: StringName = &""
属性 auto_finish var auto_finish: bool = true
属性 is_finished var is_finished: bool = false
方法 finish func finish() -> void:
方法 reset func reset() -> void:
方法 _enter func _enter(_context: GFTurnContext) -> void:
方法 _execute func _execute(_context: GFTurnContext) -> Variant:
方法 _exit func _exit(_context: GFTurnContext) -> void:

信号

finished

  • API:public
signal finished

阶段完成时发出。

属性

phase_id

  • API:public
var phase_id: StringName = &""

阶段标识。

auto_finish

  • API:public
var auto_finish: bool = true

_execute() 返回后是否自动完成阶段。

is_finished

  • API:public
var is_finished: bool = false

当前阶段是否已经完成。

方法

finish

  • API:public
func finish() -> void:

标记阶段完成。

reset

  • API:public
func reset() -> void:

重置阶段运行状态。

_enter

  • API:protected
func _enter(_context: GFTurnContext) -> void:

进入阶段时由 GFTurnFlowSystem 调用。

参数:

名称 说明
_context 回合上下文。

_execute

  • API:protected
func _execute(_context: GFTurnContext) -> Variant:

执行阶段逻辑时由 GFTurnFlowSystem 调用。

参数:

名称 说明
_context 回合上下文。

返回:可等待结果。

结构:

  • return: Variant that is null or a Signal awaited before phase completion.

_exit

  • API:protected
func _exit(_context: GFTurnContext) -> void:

退出阶段时由 GFTurnFlowSystem 调用。

参数:

名称 说明
_context 回合上下文。