跳转至

GFTurnAction

API Reference / Turn Based / 类索引

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

通用回合行动基类。 行动只描述“谁执行、对谁执行、排序值与载荷”,具体效果由子类重写 _resolve()

成员概览

类型 名称 签名
属性 action_id var action_id: StringName = &""
属性 actor var actor: Object = null
属性 targets var targets: Array[Object] = []
属性 payload var payload: Variant = null
属性 priority var priority: int = 0
属性 sort_value var sort_value: float = 0.0
属性 is_cancelled var is_cancelled: bool = false
方法 cancel func cancel() -> void:
方法 _resolve func _resolve(_context: GFTurnContext) -> Variant:

属性

action_id

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

行动标识。

actor

  • API:public
var actor: Object = null

行动发起者。

targets

  • API:public
var targets: Array[Object] = []

行动目标列表。

payload

  • API:public
var payload: Variant = null

行动载荷,框架只存储并传递,不解释其结构。

结构:

  • payload: Variant payload consumed by project-specific action resolvers.

priority

  • API:public
var priority: int = 0

主排序优先级,值越大越先处理。

sort_value

  • API:public
var sort_value: float = 0.0

次排序值,值越大越先处理。

is_cancelled

  • API:public
var is_cancelled: bool = false

是否已取消。

方法

cancel

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

取消行动。

_resolve

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

解析行动时由 GFTurnFlowSystem 调用。

参数:

名称 说明
_context 回合上下文。

返回:可等待结果。

结构:

  • return: Variant that is null or a Signal awaited before action resolution completes.