Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 16, 2016
0 parents
commit 62f2d4f
Showing
88 changed files
with
7,301 additions
and
0 deletions.
There are no files selected for viewing
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
31
Beginning iOS 3D Unreal Games Dev/Ch02/Classes/ExampleCh2Game.uc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
114
Beginning iOS 3D Unreal Games Dev/Ch02/Classes/ExampleCh2PC.uc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
|
||
|
||
|
30 changes: 30 additions & 0 deletions
30
Beginning iOS 3D Unreal Games Dev/Ch03/Example 3.1/Classes/ExampleCh31Game.uc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
|
67 changes: 67 additions & 0 deletions
67
Beginning iOS 3D Unreal Games Dev/Ch03/Example 3.1/Classes/ExampleCh31PC.uc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
{ | ||
|
||
} | ||
|
||
|
||
|
||
|
131 changes: 131 additions & 0 deletions
131
Beginning iOS 3D Unreal Games Dev/Ch03/Example 3.1/Classes/Jazz1Pawn.uc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
|
||
|
||
|
||
|
Oops, something went wrong.