Class IGameStateExtensions
Extension methods to retrieve the local player controller and pawn from IGameState.
Inherited Members
Namespace: Microsoft.XboxStudios.GameStateTracker.Unreal
Assembly: GameStateTracker.Unreal.dll
Syntax
public static class IGameStateExtensionsMethods
View SourceGetLocalPlayerPawn<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, IPlayerControllerParameters
| 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. | 
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, IPlayerControllerParameters
| 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. | 
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, IPlayerControllerParameters
| 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. | 
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, IPlayerControllerParameters
| 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. | 
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. | 
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. | 
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 : IActorParameters
| 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. | 
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. | 
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. | 
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. |