[jass]
globals
udg_Hash = InitHashtable()
endglobals
function RectilinearMotion takes unit mover, real v,real s returns nothing
local timer t = CreateTimer()
call SaveUnitHandle(udg_Hash, GetHandleId(t), 0, mover)
call SaveReal(udg_Hash, GetHandleId(t), 1, v/100)
call SaveInteger(udg_Hash, GetHandleId(t), 2, R2I(s/v*100))
call SaveInteger(udg_Hash, GetHandleId(t), 3, 0)
call TimerStart(t, 0.01, true, function RectilinearMotionTimer)
endfunction
function RectilinearMotionTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit mover = LoadUnitHandle(udg_Hash, GetHandleId(t), 0)
local real v = LoadReal(udg_Hash, GetHandleId(t), 1)
if LoadInteger(udg_Hash, GetHandleId(t), 3)<LoadInteger(udg_Hash, GetHandleId(t), 2) then
call SetUnitX(mover, GetUnitX(mover)+ v*Cos(GetUnitFacing(mover)*bj_DEGTORAD))
call SetUnitY(mover, GetUnitY(mover)+ v*Sin(GetUnitFacing(mover)*bj_DEGTORAD))
else
call FlushChildHashtable(udg_Hash, GetHandleId(t))
call DestroyTimer(t)
endif
endfunction
[/jass]
JassHelper报错“Undefined function RectilinearMotionTimer”,求解为何 |