Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 |
class MyInteraction extends Interaction; var bool bDrawEnemy; var bool bDrawFriendly; var bool bControlPawn; var PlayerController OldController; var Pawn myPawn; function Initialize() { Log("Interaction Initialized"); } /*function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta ) { log(Action); if (Action == IST_Press) ViewportOwner.Actor.ClientMessage("Key PRESSED:" @ Key); if (Action == IST_Release) ViewportOwner.Actor.ClientMessage("Key RELEASED:" @ Key); if (Action == IST_Hold) ViewportOwner.Actor.ClientMessage("Key HELD:" @ Key); if (Action == IST_Axis) ViewportOwner.Actor.ClientMessage("Key AXIS:" @ Key); return false; }*/ /*function bool KeyType( EInputKey Key, optional string Unicode ) { if (bIgnoreKeys) return true; if( Key>=0x20 ) { if( Unicode != "" ) TypedStr = TypedStr $ Unicode; else TypedStr = TypedStr $ Chr(Key); return( true ); } }*/ function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta ) { if ((Action == IST_Press) && (Key == IK_PageUp)) { ViewportOwner.Actor.ClientMessage("Key PRESSED:" @ Key); } if ((Action == IST_Press) && (Key == IK_PageDown)) { ViewportOwner.Actor.ClientMessage("Key PRESSED:" @ Key); } return false; } /*function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta ) { if ((Action == IST_Press) && (Key == IK_PageUp)) bDrawEnemy = True; if ((Action == IST_Release) && (Key == IK_PageUp)) bDrawEnemy = False; if ((Action == IST_Press) && (Key == IK_PageDown)) bDrawFriendly = True; if ((Action == IST_Release) && (Key == IK_PageDown)) bDrawFriendly = False; return false; } simulated function PostRender( canvas Canvas ) { local Pawn P; local vector CameraLocation, dir, ScreenLocation; local rotator CameraRotation; local float dist, draw_scale; if ((bDrawEnemy) || (bDrawFriendly)) //if none are true, dont do anything. Saves processing. { foreach ViewportOwner.Actor.DynamicActors(class'Pawn', P) { if (ViewportOwner.Actor.Pawn == None || P == None) Return; //A trace to tell if you can see this thing If ((Canvas.Viewport.Actor.FastTrace(P.Location, ViewportOwner.Actor.Pawn.Location)) && (P != ViewportOwner.Actor.Pawn) && (P.PlayerReplicationInfo != None) && (P.Health > 0)) { //Convert 3d location to 2d for display on the Canvas ScreenLocation = WorldToScreen(P.location); Canvas.GetCameraLocation(CameraLocation, CameraRotation); dir = P.Location - CameraLocation; dist = VSize(dir); //Distance between me and them if (dir dot vector(CameraRotation) > 0) { draw_scale = 512 / dist; //Calculate the drawscale, 512 is the "1:1" distance. //Set drawing params Canvas.SetPos(ScreenLocation.X - (32 * draw_scale), ScreenLocation.Y - (32 * draw_scale)); Canvas.Style = 3; Canvas.SetDrawColor(255,255,255); if (bDrawEnemy) //If PageUp is depressed (bDrawEnemy is true), see if the pawn is an enemy, if so, draw him! if ((P.PlayerReplicationInfo.Team.TeamIndex != ViewportOwner.Actor.Pawn.PlayerReplicationInfo.Team.TeamIndex)) Canvas.DrawIcon(texture'red', draw_scale); if (bDrawFriendly) //If PageDown is depressed (bDrawFriendly is true), see if the pawn is an friendly, if so, draw him! if (P.PlayerReplicationInfo.Team.TeamIndex == ViewportOwner.Actor.Pawn.PlayerReplicationInfo.Team.TeamIndex) Canvas.DrawIcon(texture'green', draw_scale); } } } } }*/ defaultproperties { bActive=True bVisible=True } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |