Show / Hide Table of Contents

Class IGameStateExtensions

Extension methods to retrieve the local player controller and pawn from IGameState.

Inheritance
object
IGameStateExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.XboxStudios.GameStateTracker.Unreal
Assembly: GameStateTracker.Unreal.dll
Syntax
public static class IGameStateExtensions

Methods

View Source

GetLocalPlayerPawn<T>(IGameState, int, TimeSpan)

Gets the local player pawn with the given player index.

Declaration
public static Task<APawn?> GetLocalPlayerPawn<T>(this IGameState self, int playerIndex, TimeSpan maxAge) where T : class, IPlayerController
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

TimeSpan maxAge

The maximum age of the object, if it exists in the cache.

Returns
Type Description
Task<APawn>

A pawn.

Type Parameters
Name Description
T

The player controller class type.

View Source

GetLocalPlayerState<T>(IGameState, int, TimeSpan)

Gets the local player info of the given player index.

Declaration
public static Task<APlayerInfo?> GetLocalPlayerState<T>(this IGameState self, int playerIndex, TimeSpan maxAge) where T : class, IPlayerController
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

TimeSpan maxAge

The maximum age of the object, if it exists in the cache.

Returns
Type Description
Task<APlayerInfo>

A player info object.

Type Parameters
Name Description
T

The player controller class type.

View Source

GetLocalPlayer<T>(IGameState, int, TimeSpan)

Gets the local player controller with the given player index.

Declaration
public static Task<T?> GetLocalPlayer<T>(this IGameState self, int playerIndex, TimeSpan maxAge) where T : class, IPlayerController
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

TimeSpan maxAge

The maximum age of the object, if it exists in the cache.

Returns
Type Description
Task<T>

A player controller.

Type Parameters
Name Description
T

The player controller class type.

View Source

GetPlayerLocation<T>(IGameState, int, TimeSpan)

Gets the local player's location.

Declaration
public static Task<Vector3?> GetPlayerLocation<T>(this IGameState self, int playerIndex, TimeSpan maxAge) where T : class, IPlayerController
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

TimeSpan maxAge

The maximum age of the object, if it exists in the cache.

Returns
Type Description
Task<Vector3?>

A location vector.

Type Parameters
Name Description
T

The player controller class type.

View Source

LocalPlayer(IGameState, int)

Gets the cached local player controller with the given player index.

Declaration
public static IPlayerController? LocalPlayer(this IGameState self, int playerIndex)
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

Returns
Type Description
IPlayerController

A player controller.

View Source

LocalPlayerState(IGameState, int)

Gets the cached local player info of the given player index.

Declaration
public static APlayerInfo? LocalPlayerState(this IGameState self, int playerIndex)
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

Returns
Type Description
APlayerInfo

A player info object.

View Source

OrderByNearest<T>(IGameState, int, IEnumerable<T>)

Sorts the enumeration of actors by the distance to the local player.

Declaration
public static IEnumerable<T> OrderByNearest<T>(this IGameState self, int playerIndex, IEnumerable<T> actors) where T : IActor
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

IEnumerable<T> actors

The enumeration of actors to sort.

Returns
Type Description
IEnumerable<T>

An enumeration of actors, sorted by increasing distance from the local player.

Type Parameters
Name Description
T

The actor type.

View Source

PlayerDistanceTo(IGameState, int, IActor)

Gets the local player's cached distance to another actor.

Declaration
public static float PlayerDistanceTo(this IGameState self, int playerIndex, IActor other)
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

IActor other

The other actor.

Returns
Type Description
float

The distance.

View Source

PlayerDistanceTo(IGameState, int, Vector3?)

Gets the local player's cached distance to another location.

Declaration
public static float PlayerDistanceTo(this IGameState self, int playerIndex, Vector3? other)
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

Vector3? other

The other location.

Returns
Type Description
float

The distance.

View Source

PlayerLocation(IGameState, int)

Gets the local player's cached location.

Declaration
public static Vector3? PlayerLocation(this IGameState self, int playerIndex)
Parameters
Type Name Description
IGameState self

The game state.

int playerIndex

The player index.

Returns
Type Description
Vector3?

A location vector.

  • View Source
In this article
Back to top Generated by DocFX