Thinker函数

From Valve Developer Community
< Dota 2 Workshop Tools:zh-cn‎ | Scripting:zh-cn
Revision as of 07:38, 12 September 2014 by Cs italy (talk | contribs) (Created page with "{{otherlang2 |title = Thinker函数 |en = Dota_2_Workshop_Tools/Scripting/ThinkerFunctions }} Think可以随时通过<code>SetThink</code>来注册。多个think函数可以...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
English

Think可以随时通过SetThink来注册。多个think函数可以同时在一个实体上同时运行,但是为了避免覆盖这需要think函数各自命名.

使用方法

SetThink( "ThinkerFunction", self, "thinkerNameString", 1 )


  • ThinkerFunction - 这可以是一个要调用的方法的字符串, 或者是一个方法对象。

以下参数是可选的:

  • ThinkerFunctionScope - 这可以是一个表,使在这对象上为ThinkerFunction附以索引。类似think的调回,这样可以得到成员方法。
  • thinkerNameString - thinker的名字。使用这个可以控制多个thinker。
  • 1 - 在thinker开始计时之前设定延迟多少秒的数字。

返回nil的话可以注销thinker并且使它停止。返回一个数字来设定下一次think的时间。