Skip to content

Game_Variables

Kind: global class

  • Game_Variables
    • new Game_Variables()
    • .initialize()
    • .clear()
    • .value(variableId) ⇒ number
    • .setValue(variableId, value)
    • .onChange()

new Game_Variables()

管理游戏中所有变量的数值,变量用于存储数值数据和控制游戏逻辑


game_Variables.initialize()

初始化变量对象并清空所有数据

Kind: instance method of Game_Variables


game_Variables.clear()

清空所有变量数据,重置为初始状态

Kind: instance method of Game_Variables


game_Variables.value(variableId) ⇒ number

获取指定变量的数值

Kind: instance method of Game_Variables
Returns: number - 变量的数值(如果未设置则返回 0)

ParamTypeDescription
variableIdnumber变量 ID

game_Variables.setValue(variableId, value)

设置指定变量的数值,自动向下取整并触发变化事件

Kind: instance method of Game_Variables

ParamTypeDescription
variableIdnumber变量 ID
valuenumber要设置的数值

game_Variables.onChange()

当变量数值发生变化时调用,请求地图刷新以更新相关事件

Kind: instance method of Game_Variables


贡献者

暂无相关贡献者

页面历史

暂无最近变更历史
最近更新