i am playing around with TexRotator thing for hud.
and i come up to this problem
I can't Seem to be able to access PawnOwner in HudRotatingTex. But don't understand why (Still new to this whole scripting thing)
I can get the texture to display fine, it just won't rotate
i have 2 classes
HudRotatingTex.uc
HudDisplayTex.ucCode:class HudRotatingTex extends HudBase; #exec OBJ LOAD FILE=TestInterface.utx var int i; var TexRotator test; simulated event PostBeginPlay() { //-- Scripted Texture = Setup the RotatingTex Image ----------- test = new(None) class'TexRotator'; test.TexRotationType = TR_FixedRotation; test.UOffset = 128; test.VOffset = 128; test.TexCoordCount = TCN_2DCoords; test.TexCoordProjected = false; test.Material = Texture'TestInterface.HUD.RotatingTexture'; } simulated event Destroyed() { test = none; } simulated function DrawRotatingTex(Canvas c) { local color tempColor; local byte tempstyle; tempColor = c.DrawColor; //storing the values tempstyle= c.Style; c.DrawColor=WhiteColor; c.Style=ERenderStyle.STY_Additive; //-------- Draw the RotatingTex --------------------- c.SetPos(0,0); test.Rotation.Yaw = i; c.DrawTile(test, 256, 128, 0.0, 0.0, 256, 256); c.DrawText(i); //--------- Done drawing ---------------------------- c.DrawColor = tempColor;//restore values c.Style = tempstyle; rotateTexture(); } simulated function rotateTexture() { i = PawnOwner.Rotation.Yaw; //-- This doesn't Work WHY WHY WHY??????? } defaultproperties { i= 0; }
Code:class HudDisplayTex extends HudBase; var HudRotatingTex objRotatingTex; simulated function postbeginplay() { objRotatingTex = spawn(class'HudRotatingTex'); objRotatingTex.postbeginplay(); } simulated function destroyed() { objRotatingTex.destroyed(); } simulated function DrawHud(canvas c) { super.DrawHud(c); objRotatingTex.DrawRotatingTex(c); c.DrawText(PawnOwner.Rotation.Yaw); //--- This Displays Fine }



Reply With Quote

Bookmarks