Show / Hide Table of Contents

Interface IGameState

Represents the game state, a collection of game objects with the capability to update when out-of-date.

Inherited Members
IState<ObjectInfo, IGameObject>.Get(ObjectInfo, TimeSpan, CancellationToken)
IState<ObjectInfo, IGameObject>.Existing(ObjectInfo)
IState<ObjectInfo, IGameObject>.Clear(ObjectInfo)
IReadOnlyCollection<IGameObject>.Count
IEnumerable<IGameObject>.GetEnumerator()
IEventAggregator<IGameEventArgs>.RecentEvents
IEventAggregator<IGameEventArgs>.ClearEvents()
IEventPublisher<IGameEventArgs>.EventReceived
IHasUpdateTime.UpdateTime
Namespace: Microsoft.XboxStudios.GameStateTracker
Assembly: GameStateTracker.Abstractions.dll
Syntax
public interface IGameState : IState<ObjectInfo, IGameObject>, IReadOnlyCollection<IGameObject>, IEnumerable<IGameObject>, IEnumerable, IEventAggregator<IGameEventArgs>, IEventPublisher<IGameEventArgs>, IHasUpdateTime

Methods

View Source

Clear(ObjectInfo?)

Removes an object from the cache.

Declaration
bool Clear(ObjectInfo? info)
Parameters
Type Name Description
ObjectInfo? info

The object info.

Returns
Type Description
bool

True if the object was removed.

View Source

ClearAll<T>(params string[])

Removes all cached objects derived from the given class names.

Declaration
void ClearAll<T>(params string[] classNames) where T : IGameObject
Parameters
Type Name Description
string[] classNames

The class names.

Type Parameters
Name Description
T

The game object type.

View Source

ExistingAll<T>(string?)

Gets all cached game objects derived from the given class name.

Declaration
IEnumerable<T> ExistingAll<T>(string? className = null) where T : IGameObject
Parameters
Type Name Description
string className

The class name.

Returns
Type Description
IEnumerable<T>

An enumerable of game objects.

Type Parameters
Name Description
T

The game object type.

View Source

Existing<T>(ObjectInfo?)

Gets a cached game object with the given info.

Declaration
T? Existing<T>(ObjectInfo? info = null) where T : class, IGameObject
Parameters
Type Name Description
ObjectInfo? info

The object info.

Returns
Type Description
T

A game object.

Type Parameters
Name Description
T

The game object type.

View Source

GetAll<T>(ObjectInfo, TimeSpan, CancellationToken)

Retrieves all game objects matching the given query.

Declaration
Task<IEnumerable<T>> GetAll<T>(ObjectInfo query, TimeSpan maxAge, CancellationToken token = default) where T : IGameObject
Parameters
Type Name Description
ObjectInfo query

The objects to look for.

TimeSpan maxAge

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

CancellationToken token

The cancellation token.

Returns
Type Description
Task<IEnumerable<T>>

An enumerable of game objects.

Type Parameters
Name Description
T

The object type.

View Source

GetAll<T>(string, TimeSpan, CancellationToken)

Retrieves all game objects derived from the given class name.

Declaration
Task<IEnumerable<T>> GetAll<T>(string className, TimeSpan maxAge, CancellationToken token = default) where T : IGameObject
Parameters
Type Name Description
string className

The class name.

TimeSpan maxAge

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

CancellationToken token

The cancellation token.

Returns
Type Description
Task<IEnumerable<T>>

An enumerable of game objects.

Type Parameters
Name Description
T

The game object type.

View Source

GetAll<T>(TimeSpan, CancellationToken)

Retrieves all game objects derived from the given object type.

Declaration
Task<IEnumerable<T>> GetAll<T>(TimeSpan maxAge, CancellationToken token = default) where T : IGameObject
Parameters
Type Name Description
TimeSpan maxAge

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

CancellationToken token

The cancellation token.

Returns
Type Description
Task<IEnumerable<T>>

An enumerable of game objects.

Type Parameters
Name Description
T

The game object type.

View Source

Get<T>(ObjectInfo, TimeSpan, CancellationToken)

Retrieves a game object which matches the given query.

Declaration
Task<T?> Get<T>(ObjectInfo query, TimeSpan maxAge, CancellationToken token = default) where T : class, IGameObject
Parameters
Type Name Description
ObjectInfo query

The object to look for.

TimeSpan maxAge

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

CancellationToken token

The cancellation token.

Returns
Type Description
Task<T>

The game object.

Type Parameters
Name Description
T

The object type.

Extension Methods

IGameStateExtensions.GetLocalPlayerPawn<T>(IGameState, int, TimeSpan)
IGameStateExtensions.GetLocalPlayerState<T>(IGameState, int, TimeSpan)
IGameStateExtensions.GetLocalPlayer<T>(IGameState, int, TimeSpan)
IGameStateExtensions.GetPlayerLocation<T>(IGameState, int, TimeSpan)
IGameStateExtensions.LocalPlayer(IGameState, int)
IGameStateExtensions.LocalPlayerState(IGameState, int)
IGameStateExtensions.OrderByNearest<T>(IGameState, int, IEnumerable<T>)
IGameStateExtensions.PlayerDistanceTo(IGameState, int, IActor)
IGameStateExtensions.PlayerDistanceTo(IGameState, int, Vector3?)
IGameStateExtensions.PlayerLocation(IGameState, int)
IEnumerableExtensions.WithoutLast<T>(IEnumerable<T>)
  • View Source
In this article
Back to top Generated by DocFX