i solved it!!. i decide to use simulated function DrawHUD( HUD H ) on each class outside the hud and it worked. i post the code
PHP Code:
class MyHud extends MobileHUD;
event PostRender()
{
super.PostRender() ;
DisplayConsoleMessages();
}
defaultproperties
{
}
PHP Code:
class CarPLayer extends UTVehicle_Scorpion_Content;
var config vector PlayerLocation;
var int CurTime;
struct SCollisionsList
{
var vector HitLocation;
var float HitTime;
};
var int lap;
var array< SCollisionsList> CollisionsList;
var string html;
var() string MessageHud;
var bool ShowMessageHud;
var string nRand;
simulated event PostBeginPlay(){
super.PostBeginPlay();
}
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector X, Y, Z;
//this makes the camera stay with the vehicle
GetActorEyesViewPoint( out_CamLoc, out_CamRot );
GetAxes(Rotation,X,Y,Z);
// a bit behind
out_CamLoc = Location - 40 * X;
//up a bit
out_CamLoc.Z = Location.Z + 25;
//camera rotation yaw = vehicle rotation yaw
out_CamRot.Yaw = Rotation.Yaw;
// look down a bit
out_CamRot.Pitch = (-0.0f *DegToRad) * RadToUnrRot;
//delete this line if you want the cam to roll with the vehicle
out_CamRot.Roll = 0;
return true;
}
simulated function DrawHUD( HUD H )
{
if(ShowMessageHud)
{
super.DrawHUD(H);
H.Canvas.SetPos(H.Canvas.ClipX/2,H.Canvas.ClipY/2-200);
H.Canvas.SetDrawColor(255, 255, 255);
H.Canvas.Font = class'Engine'.static.GetLargeFont();
H.Canvas.DrawText(MessageHud);
}
}
event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal)
{
local string MetaName;
if(lap==0)lap=1;
MetaName=string(Other);
switch(MetaName)
{
case ("TriggerVolume_0"):
ShowMessageHud=true;
MessageHud=string(GenerateRandomNumber(lap));
break;
case ("TriggerVolume_1"):
ShowMessageHud=false;
break;
case ("TriggerVolume_2"):
ShowMessageHud=true;
MessageHud=string(GenerateRandomNumber(lap));
break;
case ("TriggerVolume_3"):
ShowMessageHud=false;
break;
case ("TriggerVolume_4"):
ShowMessageHud=true;
MessageHud=string(GenerateRandomNumber(lap));
break;
case ("TriggerVolume_5"):
ShowMessageHud=false;
break;
case ("TriggerVolume_6"):
ShowMessageHud=true;
MessageHud=string(GenerateRandomNumber(lap));
break;
case ("TriggerVolume_7"):
ShowMessageHud=false;
break;
case ("TriggerVolume_8"):
lap++;
ShowMessageHud=true;
MessageHud="Vuelta Numero "$lap;
break;
case ("TriggerVolume_9"):
ShowMessageHud=false;
break;
}
}
//this function generates a random number. eery lap the game increase the number lenght by one
simulated function int GenerateRandomNumber(int nLap)
{
local int sRandomNumber;
local int nBase;
local int Range1;
local int Range2;
nBase=3;
Range1=10**(nLap+nBase-1);
Range2=(10**(nLap+nBase))-1;
sRandomNumber=int( RandRange(Range1,Range2));
return sRandomNumber;
}
simulated event RigidBodyCollision (PrimitiveComponent HitComponent, PrimitiveComponent OtherComponent, const out Actor.CollisionImpactData Collision, int ContactIndex)
{
local SCollisionsList LastCollision;
PlayerLocation=GetALocalPlayerController().Pawn.Location;
LastCollision.HitLocation = Collision.ContactInfos[0].ContactPosition;
LastCollision.HitTime = WorldInfo.TimeSeconds;
CollisionsList.AddItem(LastCollision);
}
defaultproperties
{
bDirectHitWall=True;
}
PHP Code:
class BaseGame extends UDKGame;
var SoundCue beep;
var int CurTime;
var bool bPlayed;
var int LastTime;
var bool Move;
var string sMessage;
var bool bShowCountDown;
event PostLogin( PlayerController NewPlayer )
{
super.PostLogin(NewPlayer);
}
event Tick(float DeltaTime)
{
CurTime=WorldInfo.TimeSeconds;
if(CurTime==1)
{
LastTime=1;
bShowCountDown=true;
}
if(CurTime==2)
{
sMessage="3";
if( LastTime==1)
{
PlaySound(beep);
LastTime=2;
}
}
if(CurTime==3)
{
sMessage="2";
if( LastTime==2)
{
PlaySound(beep);
LastTime=3;
}
}
if(CurTime==4)
{
sMessage="1";
if( LastTime==3)
{
PlaySound(beep);
LastTime=4;
}
}
if(CurTime==5)
{
sMessage="Comienzo!!";
if( LastTime==4)
{
Move=true;
PlaySound(beep);
PlaySound(beep);
PlaySound(beep);
}
}
if(CurTime==6)
{
bShowCountDown=false;
}
}
defaultproperties
{
PlayerControllerClass=class'MyGame.MyGamePlayerController'//Your PlayerControllerClass to use with this game-type
DefaultPawnClass =class 'MyGame.MyPawn'//Your PawnClass to use with this game-type
HUDType =class 'MyGame.MyHud'//Your HUD (Heads Up Display) to use with this game-type
bDelayedStart = false //If TRUE, the game will not immediately begin when the player joins.
beep=SoundCue'KismetExamples.homing_beacon_Cue'
}
PHP Code:
class MyGamePlayerController extends GamePlayerController ;
var BaseGame cBaseGame;
simulated event PostBeginPlay(){
super.PostBeginPlay();
cBaseGame=spawn(class'BaseGame');
}
simulated function DrawHUD( HUD H )
{
local string sText;
super.DrawHUD(H);
if(cBaseGame.bShowCountDown)
{
sText=cBaseGame.sMessage;
H.Canvas.SetPos(H.Canvas.ClipX/2,H.Canvas.ClipY/2-200);
H.Canvas.SetDrawColor(255, 255, 255);
H.Canvas.Font = class'Engine'.static.GetLargeFont();
H.Canvas.DrawText(sText);
}
}
state PlayerDriving
{
function PlayerMove( float DeltaTime )
{
local float Forward, Strafe;
local bool bState;
bState=cBaseGame.Move;
//if the counter gets to start! in BaseGame.uc send a message for debugging purposses
//this is not working. its not capturing the BaseGame.Move variable value
if(bState==true)
{
UpdateRotation(DeltaTime);
// Get the forward input information
Forward = PlayerInput.aForward;
// Get the strafe input information
Strafe = PlayerInput.aStrafe;
if (PlayerInput != None)
{
Forward = (((PlayerInput.aTilt.X * UnrRotToDeg) - 30.f) / 50.f) * -1.f;
}
// Clamp the forward to within -1.f and 1.f
Forward = FClamp(Forward, -1.f, 1.f);
ProcessDrive(Forward, Strafe, PlayerInput.aUp, bPressedJump);
bPressedJump = false;
}
else
{
ProcessDrive(0, 0, PlayerInput.aUp, bPressedJump);
}
}
}
defaultproperties{
bFreeLook = false; // to disable free look with mouse
bMousing = false; // to disable mousing
}
Bookmarks