|
发表于 2010-9-5 14:31:46
|
显示全部楼层
[jass]globals
gamecache GC=InitGameCache("GC.w3v")
endglobals
function H2I takes handle h returns integer
return h
return 0
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function yidong takes nothing returns nothing
local timer tm = GetExpiredTimer()
local string BNI=I2S(H2I(tm))
local unit u=I2U(GetStoredInteger(GC,BNI,"beijitui"))
local real angle=GetStoredReal(GC,BNI,"angle")
local integer c=GetStoredInteger(GC,BNI,"Count")
local real x1=GetUnitX(u)+Cos(angle)*15
local real y1=GetUnitY(u)+Sin(angle)*15
call SetUnitFacing(u,angle/3.14159*180+180)
call SetUnitPosition(u,x1,y1)
set c=c-1
call StoreInteger(GC, BNI, "Count", c)
if c==0 then
call PauseTimer(tm)
call FlushStoredMission(GC,BNI)
call DestroyTimer(tm)
endif
set tm=null
set u=null
endfunction
function jitui takes unit beijitui, unit jituizhe, real timeout,integer Count returns nothing
local timer tm = CreateTimer()
local string BNI=I2S(H2I(tm))
local real angle=Atan2(GetUnitY(beijitui)-GetUnitY(jituizhe),GetUnitX(beijitui)-GetUnitX(jituizhe))
call StoreInteger(GC, BNI, "beijitui",H2I(beijitui))
call StoreReal(GC, BNI, "angle", angle)
call StoreInteger(GC, BNI, "Count", Count)
call TimerStart(tm, timeout, true, function yidong)
set tm = null
endfunction[/jass] |
|