|
我希望这视角能支援多位玩家
[jass]function GetChangeDegree takes real r1,real r2 returns real
local real rMin=RMinBJ(r1,r2)
local real rMax=RMaxBJ(r1,r2)
local real r=rMin-rMax+360.0
if RAbsBJ(r1-r2)>= rMin-rMax+360.0 then
if rMin==r1 then
return r1+360.0-r2
else
return r1-r2-360.0
endif
else
return r1-r2
endif
return 0.0
endfunction
function ChangeZ takes nothing returns nothing
local integer tmIndex=GetTimerIndex(GetExpiredTimer())
local real x1
local real y1
local real x2=GetUnitX(SYS_TimerData_U00[tmIndex])
local real y2=GetUnitY(SYS_TimerData_U00[tmIndex])
local real r1
local real r2=CameraSetupGetField(GetCurrentCameraSetup(),CAMERA_FIELD_ROTATION)
local real r3
if SYS_TimerData_U00[tmIndex]==null then
call ReleaseTimer(GetExpiredTimer())
return
endif
if udg_tu[GetConvertedPlayerId(Player(SYS_TimerData_I00[tmIndex]))]!=null then
set x1=GetUnitX(udg_tu[GetConvertedPlayerId(Player(SYS_TimerData_I00[tmIndex]))])
set y1=GetUnitY(udg_tu[GetConvertedPlayerId(Player(SYS_TimerData_I00[tmIndex]))])
set r1=bj_RADTODEG*Atan2(y1-y2,x1-x2)+30.0
else
set r1=GetUnitFacing(SYS_TimerData_U00[tmIndex])
endif
set r3=GetChangeDegree(r1,r2)
if r3>0.0 and r3<=60.0 then
call SetCameraFieldForPlayer(Player(SYS_TimerData_I00[tmIndex]),CAMERA_FIELD_ROTATION,r2+r3/250.0,0)
elseif RAbsBJ(r3)>-60.0 and r3<=0.0 then
call SetCameraFieldForPlayer(Player(SYS_TimerData_I00[tmIndex]),CAMERA_FIELD_ROTATION,r2+r3/150.0,0)
elseif RAbsBJ(r3)>60.0 and RAbsBJ(r3)<=120.0 then
call SetCameraFieldForPlayer(Player(SYS_TimerData_I00[tmIndex]),CAMERA_FIELD_ROTATION,r2+r3/150.0,0)
elseif RAbsBJ(r3)>120.0 and RAbsBJ(r3)<=180.0 then
call SetCameraFieldForPlayer(Player(SYS_TimerData_I00[tmIndex]),CAMERA_FIELD_ROTATION,r2+r3/200.0,0)
endif
set x1=GetCameraTargetPositionX()
set y1=GetCameraTargetPositionY()
set r1=SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
if r1<10.0 then
call PanCameraToTimed(GetUnitX(SYS_TimerData_U00[tmIndex]),GetUnitY(SYS_TimerData_U00[tmIndex]),0)
else
set r2=Atan2(y2-y1,x2-x1)
if r1<200 then
set x1=x1+4*Cos(r2)
set y1=y1+4*Sin(r2)
call PanCameraToTimed(x1,y1,0)
elseif r1>=200 and r1<400 then
set x1=x1+10*Cos(r2)
set y1=y1+10*Sin(r2)
call PanCameraToTimed(x1,y1,0)
elseif r1>=400 and r1<800 then
set x1=x1+17*Cos(r2)
set y1=y1+17*Sin(r2)
call PanCameraToTimed(x1,y1,0)
elseif r1>=800 then
set x1=x1+30*Cos(r2)
set y1=y1+30*Sin(r2)
call PanCameraToTimed(x1,y1,0)
endif
endif
endfunction
function ChangeCamera takes integer pleayerid,unit tru returns nothing
local integer tmIndex=GetTimerIndex(GetTimer())
set SYS_TimerData_I00[tmIndex]=pleayerid
set SYS_TimerData_U00[tmIndex]=tru
call TimerStart(SYS_Timer[tmIndex],0.025,true,function ChangeZ)
endfunction[/jass] |
|