《UDK游戏开发:玩家控制、武器与物理碰撞详解》
1. 玩家控制器与武器功能添加
在玩家控制器类 ExampleCh31PC
的 SwipeZoneCallback()
函数中,需要添加控制玩家武器开火和停火的命令。当发生触摸事件时,调用 StartFire(0)
开始开火;当触摸结束时,调用 StopFire(0)
停止开火。以下是具体代码:
function bool SwipeZoneCallback(MobileInputZone Zone,
float DeltaTime,
int Handle,
EZoneTouchEvent EventType,
Vector2D TouchLocation)
{
local bool retval = true;
if (EventType == ZoneEvent_Touch)
{
WorldInfo.Game.Broadcast(self,"You touched the screen at = "
@ TouchLocation.x @ " , "