I don't need to test my programs. I have an error-correcting modem.

UE2:Interaction (UT2003)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2003 Object >> Interactions >> Interaction
Package: 
Engine
Direct subclasses:
BaseGUIController, Console, OGGMusicChanger
This class in other games:
UE2Runtime, UT2004, UDK, UT3

Generally an Interaction can be used to capture player input and render to the Canvas. Interactions are the only non-Actor objects that can use states, but they don't support state code outside functions.

Interactions can be registered in two ways, either as a global interaction or as a local interaction. Global interactions are stored in a dynamic array of the InteractionMaster while each Viewport (native-only subclass of Player) contains an array of local interactions. Whether an interaction is created as local or global interaction is just a matter of passing a Viewport reference to InteractionMaster.AddInteraction() or not.

Properties

bActive

Type: bool

Whether this Interaction currently wants to receive KeyType() and KeyEvent() calls.

Default value: True

bNativeEvents

Type: bool

Whether this interaction wants to receive events natively instead of getting its UnrealScript functions called.

bRequiresTick

Type: bool

Whether this Interaction currently wants to receive Tick() calls.

bVisible

Type: bool

Whether this Interaction currently wants to receive PreRender() and PostRender() calls.

Master

Type: InteractionMaster

Reference to the InteractionMaster.

ViewportOwner

Type: Player

References the owning Viewport for local interactions. None for global interactions.

Functions

Native functions

ConsoleCommand

native function bool ConsoleCommand (coerce string S)

Executes a console command in the context of the local player. This is the function that processes all commands you enter at the in-game console. This function returns False if the console command doesn't exist. Output of commands executed through this function can be captured with the Message() event by all registered global and local interactions.

Initialize

native function Initialize ()

Initializes the interaction's state support, then calls the Initialized() event. This is called automatically by InteractionMaster.AddInteraction(), so you don't need to call it again.

ScreenToWorld

native function Object.Vector ScreenToWorld (Object.Vector Location, optional Object.Vector CameraLocation, optional Object.Rotator CameraRotation)

Converts local screen coordinates (Location) to a directional vector in global world coordinates. The CameraLocation and CameraRotation default to 0 if omitted, giving a position relative to the eye of the camera.

WorldToScreen

native function Object.Vector WorldToScreen (Object.Vector Location, optional Object.Vector CameraLocation, optional Object.Rotator CameraRotation)

Converts global world coordinates (Location) to local screen coordinates. The CameraLocation and CameraRotation default to the local PlayerController's position if omitted.

Events

Initialized

event Initialized ()

Called by the Initialize() function after state support has been initialized, so this is the first place where you can use GotoState() to switch to a specific state.

NotifyLevelChange

event NotifyLevelChange ()

Called by the engine right before the current level changes. This is the best place to unregister game-specific interactions by calling Master.RemoveInteraction(Self). Failing to unregister an interaction may cause problems in network games, including kicks and bans by anti-cheat mods!

Global interactions receive this event before local interactions.

NotifyMusicChange

event NotifyMusicChange ()

Other instance functions

KeyEvent

function bool KeyEvent (out Interactions.EInputKey Key, out Interactions.EInputAction Action, float Delta)

Called for active (bActive) interactions for every key, button and axis input event from keyboards, mice, joysticks, gamepads and similar devices. Returning True from this function will "swallow" the event. Later interactions and the game's own input handling will not receive the key event in this case.

Global interactions receive this event before local interactions.

KeyType

function bool KeyType (out Interactions.EInputKey Key, optional string Unicode)

Called for active (bActive) interactions for every key press - think typing in a text editor. When you press and hold a key, this function is called repeatedly according to the operating system's keyboard setting. Key is the key that was pressed, Unicode is the actual Unicode text associated with the key. Returning True from this function will "swallow" the event. Later interactions will not receive the key event in this case.

Global interactions receive this event before local interactions.

Message

function Message (coerce string Msg, float MsgLife)

Called for all interactions from within ConsoleCommand for output of the executed command.

Global interactions receive this event before local interactions.

PostRender

function PostRender (Canvas Canvas)

Called for visible (bVisible) interactions after Hud.PostRender() has finished.

Global interactions receive this event after local interactions.

PreRender

function PreRender (Canvas Canvas)

Called for visible (bVisible) interactions before the world is rendered. Drawing onto the canvas works already.

Global interactions receive this event before local interactions.

SetFocus

function SetFocus ()

Moves the interaction to the start of the (global or local) interactions list and makes it active and visible.

Tick

function Tick (float DeltaTime)

Called for interactions that want to be ticked (bRequiresTick) after all actors have been ticked. Unlike Actor.Tick(), the interaction event is called regardless whether the game is paused or in PlayersOnly mode.

Global interactions receive this event before local interactions.