Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 16, 2016
0 parents commit 62f2d4f
Show file tree
Hide file tree
Showing 88 changed files with 7,301 additions and 0 deletions.
Binary file added 9781430240358.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions Beginning iOS 3D Unreal Games Dev/Ch02/Classes/ExampleCh2Game.uc
@@ -0,0 +1,31 @@
class ExampleCh2Game extends FrameworkGame;

event OnEngineHasLoaded()
{
WorldInfo.Game.Broadcast(self,"ExampleCh2Game Type Active - Engine Has Loaded !!!!");
}

function bool PreventDeath(Pawn KilledPawn, Controller Killer, class<DamageType> DamageType, vector HitLocation)
{
return true;
}

static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
return super.SetGameType(MapName, Options, Portal);
}

defaultproperties
{
PlayerControllerClass=class'ExampleCh2.ExampleCh2PC'

DefaultPawnClass=class'UDKBase.SimplePawn'
HUDType=class'UDKBase.UDKHUD'

bRestartLevel=false
bWaitingToStartMatch=true
bDelayedStart=false
}



114 changes: 114 additions & 0 deletions Beginning iOS 3D Unreal Games Dev/Ch02/Classes/ExampleCh2PC.uc
@@ -0,0 +1,114 @@
class ExampleCh2PC extends SimplePC;


var float PickDistance;


function Actor PickActor(Vector2D PickLocation, out Vector HitLocation, out TraceHitInfo HitInfo)
{
local Vector TouchOrigin, TouchDir;
local Vector HitNormal;
local Actor PickedActor;
local vector Extent;

//Transform absolute screen coordinates to relative coordinates
PickLocation.X = PickLocation.X / ViewportSize.X;
PickLocation.Y = PickLocation.Y / ViewportSize.Y;

//Transform to world coordinates to get pick ray
LocalPlayer(Player).Deproject(PickLocation, TouchOrigin, TouchDir);

//Perform trace to find touched actor
Extent = vect(0,0,0);
PickedActor = Trace(HitLocation,
HitNormal,
TouchOrigin + (TouchDir * PickDistance),
TouchOrigin,
True,
Extent,
HitInfo);


//Return the touched actor for good measure
return PickedActor;
}


// OnProcessInputDelegate [Zone] [DeltaTime] [Handle] [EventType] [TouchLocation] -
// Called when any input event occurs within the zone allowing completely custom input handling for any
// zone or for input in a zone to be handled by other classes. Return TRUE to acknowledge the input as
// being handled. Returning FALSE will pass the input on, processing it in the ProcessTouch() function
// according to the type of zone.
//
// Zone - A reference to the Zone the delegate belongs to.
// DeltaTime - The amount of time since the last input event for the zone.
// Handle - The unique identifier of the touch responsible for the input event.
// EventType - The EZoneTouchEvent type of the input event.
// TouchLocation - The Vector2D specifying the horizontal and vertical location of the touch event in pixel screen coordinates.

function bool SwipeZoneCallback(MobileInputZone Zone,
float DeltaTime,
int Handle,
EZoneTouchEvent EventType,
Vector2D TouchLocation)
{
local bool retval;

local Actor PickedActor;
local Vector HitLocation;
local TraceHitInfo HitInfo;


retval = true;


if (EventType == ZoneEvent_Touch)
{
// If screen touched then pick actor
PickedActor = PickActor(TouchLocation,HitLocation,HitInfo);

WorldInfo.Game.Broadcast(self,"PICKED ACTOR = " @
PickedActor @
", HitLocation = " @ HitLocation @
", Zone Touched = " @ Zone);
}
else
if(EventType == ZoneEvent_Update)
{

}
else
if (EventType == ZoneEvent_UnTouch)
{

}


return retval;
}

function SetupZones()
{
Super.SetupZones();

// If we have a game class, configure the zones
if (MPI != None && WorldInfo.GRI.GameClass != none)
{
LocalPlayer(Player).ViewportClient.GetViewportSize(ViewportSize);

if (FreeLookZone != none)
{
FreeLookZone.OnProcessInputDelegate = SwipeZoneCallback;
}
}

}

defaultproperties
{
PickDistance = 10000;
}




@@ -0,0 +1,30 @@
class ExampleCh31Game extends FrameworkGame;


event OnEngineHasLoaded()
{
WorldInfo.Game.Broadcast(self,"ExampleCh31Game Type Active - Engine Has Loaded !!!!");
}

function bool PreventDeath(Pawn KilledPawn, Controller Killer, class<DamageType> DamageType, vector HitLocation)
{
return true;
}

static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
return super.SetGameType(MapName, Options, Portal);
}

defaultproperties
{
PlayerControllerClass=class'ExampleCh31.ExampleCh31PC'

DefaultPawnClass=class'Jazz1Pawn'
HUDType=class'UDKBase.UDKHUD'

bRestartLevel=false
bWaitingToStartMatch=true
bDelayedStart=false
}

@@ -0,0 +1,67 @@
class ExampleCh31PC extends SimplePC;


function bool SwipeZoneCallback(MobileInputZone Zone,
float DeltaTime,
int Handle,
EZoneTouchEvent EventType,
Vector2D TouchLocation)
{
local bool retval;


retval = true;


if (EventType == ZoneEvent_Touch)
{
WorldInfo.Game.Broadcast(self,"You touched the screen at = " @
TouchLocation.x @ " , " @ TouchLocation.y @
", Zone Touched = " @ Zone);


// Start Firing pawn's weapon
StartFire(0);
}
else
if(EventType == ZoneEvent_Update)
{

}
else
if (EventType == ZoneEvent_UnTouch)
{
// Stop Firing Pawn's weapon
StopFire(0);
}


return retval;
}

function SetupZones()
{
Super.SetupZones();

// If we have a game class, configure the zones
if (MPI != None && WorldInfo.GRI.GameClass != none)
{
LocalPlayer(Player).ViewportClient.GetViewportSize(ViewportSize);

if (FreeLookZone != none)
{
FreeLookZone.OnProcessInputDelegate = SwipeZoneCallback;

}
}
}


defaultproperties
{

}




@@ -0,0 +1,131 @@
class Jazz1Pawn extends SimplePawn;


var float CamOffsetDistance;
var int CamAngle;

var Inventory MainGun;


simulated singular event Rotator GetBaseAimRotation()
{
local rotator TempRot;

TempRot = Rotation;
TempRot.Pitch = 0;

SetRotation(TempRot);


return TempRot;
}

function AddGunToSocket(Name SocketName)
{
local Vector SocketLocation;
local Rotator SocketRotation;

if (Mesh != None)
{
if (Mesh.GetSocketByName(SocketName) != None)
{
Mesh.GetSocketWorldLocationAndRotation(SocketName, SocketLocation, SocketRotation);

MainGun.SetRotation(SocketRotation);
MainGun.SetBase(Self,, Mesh, SocketName);

}
else
{
WorldInfo.Game.Broadcast(self,"!!!!!!SOCKET NAME NOT FOUND!!!!!");
}
}
else
{
WorldInfo.Game.Broadcast(self,"!!!!!!MESH NOT FOUND!!!!!");
}

}


function AddDefaultInventory()
{
MainGun = InvManager.CreateInventory(class'JazzWeapon1');
MainGun.SetHidden(false);

AddGunToSocket('Weapon_R');

Weapon(MainGun).FireOffset = vect(0,0,-70);
}

// Iso Cam
/*
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
out_CamLoc = Location;
out_CamLoc.X += Cos(CamAngle * UnrRotToRad) * CamOffsetDistance;
out_CamLoc.Z += Sin(CamAngle * UnrRotToRad) * CamOffsetDistance;
out_CamRot.Pitch = -1 * CamAngle;
out_CamRot.Yaw = 32000;
out_CamRot.Roll = 0;
return true;
}
*/

/////////////////////////////////////////////// Third Person View /////////////////////////////////////////////////////

simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector BackVector;
local vector UpVector;

local float CamDistanceHorizontal;
local float CamDistanceVertical;



// Set Camera Location
CamDistanceHorizontal = CamOffsetDistance * cos(CamAngle * UnrRotToRad);
CamDistanceVertical = CamOffsetDistance * sin(CamAngle * UnrRotToRad);

BackVector = -Normal(Vector(Rotation)) * CamDistanceHorizontal;
UpVector = vect(0,0,1) * CamDistanceVertical;

out_CamLoc = Location + BackVector + UpVector;

// Set Camera Rotation
out_CamRot.pitch = -CamAngle;
out_CamRot.yaw = Rotation.yaw;
out_CamRot.roll = Rotation.roll;

return true;
}


defaultproperties
{

Begin Object Class=SkeletalMeshComponent Name=JazzMesh
SkeletalMesh=SkeletalMesh'KismetGame_Assets.Anims.SK_Jazz'
AnimSets(0)=AnimSet'KismetGame_Assets.Anims.SK_Jazz_Anims'
AnimTreeTemplate=AnimTree'KismetGame_Assets.Anims.Jazz_AnimTree'
BlockRigidBody=true
CollideActors=true
End Object

Mesh = JazzMesh; // Set The mesh for this object
Components.Add(JazzMesh); // Attach this mesh to this Actor


CamAngle=3000;
CamOffsetDistance= 484.0


InventoryManagerClass=class'WeaponsIM1'
}




0 comments on commit 62f2d4f

Please sign in to comment.