Impact Interaction System API
Impact.ImpactManagerInstance Class Reference

Static class that handles the reference for the currently active Impact Manager instance. More...

Static Public Member Functions

static void SetInstance (ImpactManager inst)
 Sets the ImpactManager instance that all static methods will use. More...
 
static ImpactManager GetInstance (bool createIfNull=true)
 Gets the current ImpactManager instance. More...
 
static void ClearInstance (ImpactManager inst)
 Clears the current ImpactManager instance, if it is the same as the provided instance. More...
 
static bool HasReachedPhysicsInteractionsLimit ()
 Checks if the current physics interaction count has been reached. More...
 
static void IncrementPhysicsInteractionsLimit ()
 Increments the physics interaction count.
 
static bool HasReachedContinuousInteractionLimit ()
 Has the maximum number of active continuous interactions been reached? More...
 
static bool HasActiveContinuousInteractionWithKey (long key)
 
static bool TryGetImpactMaterialFromMapping (Collider collider, out IImpactMaterial impactMaterial)
 Try to get an Impact Material from the Material Mapping using the given Collider. More...
 
static bool TryGetImpactMaterialFromMapping (Collider2D collider2d, out IImpactMaterial impactMaterial)
 Try to get an Impact Material from the Material Mapping using the given Collider2D. More...
 
static bool TryGetImpactMaterialFromMapping (int physicsMaterialInstanceId, out IImpactMaterial impactMaterial)
 Try to get an Impact Material from the Material Mapping using the given Physics Material instance ID. More...
 
static void ProcessInteraction< T > (T interactionData, IImpactObject impactObject)
 Process interaction data using the given Impact Object. The primary material at the interaction point will be used. More...
 
static void ProcessInteraction< T > (T interactionData, IImpactMaterial impactMaterial, IImpactObject impactObject)
 Process interaction data using the Impact Material and an optional Impact Object that the interaction originated from. More...
 
static void ProcessContinuousInteraction< T > (T interactionData, IImpactObject impactObject)
 Process a continuous interaction using the interaction data and the given Impact Object. The primary material at the interaction point will be used. More...
 
static void ProcessContinuousInteraction< T > (T interactionData, IImpactMaterial material, IImpactObject impactObject)
 Process a continuous interaction using the interaction data, an Impact Material, and an optional Impact Object that the interaction originated from. More...
 
static void AddOrUpdateContinuousInteractionResult (IImpactObject impactObject, IContinuousInteractionResult result)
 Adds or updates the given continuous interaction result to the active continuous interaction results, if able. More...
 
static void CreateInteractionResultPool< T > (string key)
 Creates a new Interaction Result pool with the given key and size. More...
 
static bool TryGetInteractionResultFromPool< T > (string key, out T obj)
 Attempts to get an available empty interaction result from the pool with the specified key. More...
 

Properties

static IInteractionResult[] InteractionResultBuffer [get]
 Shared buffer for retrieving interaction results from Impact Materials.
 
static ImpactMaterialComposition[] MaterialCompositionBuffer [get]
 Shared buffer for retrieving material composition.
 
static bool UseMaterialMapping [get, set]
 Is the material mapping feature enabled in the configuration?
 

Detailed Description

Static class that handles the reference for the currently active Impact Manager instance.

Member Function Documentation

◆ AddOrUpdateContinuousInteractionResult()

static void Impact.ImpactManagerInstance.AddOrUpdateContinuousInteractionResult ( IImpactObject  impactObject,
IContinuousInteractionResult  result 
)
static

Adds or updates the given continuous interaction result to the active continuous interaction results, if able.

Parameters
impactObjectThe impact object the result is being sent from.
resultThe new continuous interaction result.

◆ ClearInstance()

static void Impact.ImpactManagerInstance.ClearInstance ( ImpactManager  inst)
static

Clears the current ImpactManager instance, if it is the same as the provided instance.

Parameters
instThe instance to clear.

◆ CreateInteractionResultPool< T >()

static void Impact.ImpactManagerInstance.CreateInteractionResultPool< T > ( string  key)
static

Creates a new Interaction Result pool with the given key and size.

Template Parameters
TThe IPoolable type to use.
Parameters
keyThe name of the pool, used to retrieve objects.
Returns
The newly created pool, or the existing pool if there is one with the same key.
Type Constraints
T :class 
T :IPoolable 
T :new() 

◆ GetInstance()

static ImpactManager Impact.ImpactManagerInstance.GetInstance ( bool  createIfNull = true)
static

Gets the current ImpactManager instance.

Parameters
createIfNullShould an instance be created if one does not exist?
Returns
The current ImpactManager instance, or null if one does not exist and createIfNull is false.

◆ HasReachedContinuousInteractionLimit()

static bool Impact.ImpactManagerInstance.HasReachedContinuousInteractionLimit ( )
static

Has the maximum number of active continuous interactions been reached?

Returns
True if the limit has been reached, False otherwise.

◆ HasReachedPhysicsInteractionsLimit()

static bool Impact.ImpactManagerInstance.HasReachedPhysicsInteractionsLimit ( )
static

Checks if the current physics interaction count has been reached.

Returns
True if the limit has been reached, false otherwise.

◆ ProcessContinuousInteraction< T >() [1/2]

static void Impact.ImpactManagerInstance.ProcessContinuousInteraction< T > ( interactionData,
IImpactMaterial  material,
IImpactObject  impactObject 
)
static

Process a continuous interaction using the interaction data, an Impact Material, and an optional Impact Object that the interaction originated from.

Parameters
interactionDataThe interaction data to process.
impactMaterialThe Impact Material to get interaction results from.
impactObjectAn optional Impact Object that the interaction originated from.
Type Constraints
T :IInteractionData 

◆ ProcessContinuousInteraction< T >() [2/2]

static void Impact.ImpactManagerInstance.ProcessContinuousInteraction< T > ( interactionData,
IImpactObject  impactObject 
)
static

Process a continuous interaction using the interaction data and the given Impact Object. The primary material at the interaction point will be used.

Parameters
interactionDataThe interaction data to process.
impactObjectThe Impact Object that an Impact Material will be retrieved from.
Type Constraints
T :IInteractionData 

◆ ProcessInteraction< T >() [1/2]

static void Impact.ImpactManagerInstance.ProcessInteraction< T > ( interactionData,
IImpactMaterial  impactMaterial,
IImpactObject  impactObject 
)
static

Process interaction data using the Impact Material and an optional Impact Object that the interaction originated from.

Parameters
interactionDataThe interaction data to process.
impactMaterialThe Impact Material to get interaction results from.
impactObjectAn optional Impact Object that the interaction originated from.
Type Constraints
T :IInteractionData 

◆ ProcessInteraction< T >() [2/2]

static void Impact.ImpactManagerInstance.ProcessInteraction< T > ( interactionData,
IImpactObject  impactObject 
)
static

Process interaction data using the given Impact Object. The primary material at the interaction point will be used.

Parameters
interactionDataThe interaction data to process.
impactObjectThe Impact Object that the primary Impact Material will be retrieved from.
Type Constraints
T :IInteractionData 

◆ SetInstance()

static void Impact.ImpactManagerInstance.SetInstance ( ImpactManager  inst)
static

Sets the ImpactManager instance that all static methods will use.

Parameters
instThe new instance.

◆ TryGetImpactMaterialFromMapping() [1/3]

static bool Impact.ImpactManagerInstance.TryGetImpactMaterialFromMapping ( Collider  collider,
out IImpactMaterial  impactMaterial 
)
static

Try to get an Impact Material from the Material Mapping using the given Collider.

Parameters
colliderThe collider that has the Physic Material to get a mapping for.
impactMaterialThe material that was found in the mapping, if one was found. Null otherwise.
Returns
True if a matching map was found, False otherwise.

◆ TryGetImpactMaterialFromMapping() [2/3]

static bool Impact.ImpactManagerInstance.TryGetImpactMaterialFromMapping ( Collider2D  collider2d,
out IImpactMaterial  impactMaterial 
)
static

Try to get an Impact Material from the Material Mapping using the given Collider2D.

Parameters
collider2dThe collider that has the Physics Material 2D to get a mapping for.
impactMaterialThe material that was found in the mapping, if one was found. Null otherwise.
Returns
True if a matching map was found, False otherwise.

◆ TryGetImpactMaterialFromMapping() [3/3]

static bool Impact.ImpactManagerInstance.TryGetImpactMaterialFromMapping ( int  physicsMaterialInstanceId,
out IImpactMaterial  impactMaterial 
)
static

Try to get an Impact Material from the Material Mapping using the given Physics Material instance ID.

Parameters
physicsMaterialInstanceIdThe instance ID of the physics material (3D or 2D).
impactMaterialThe material that was found in the mapping, if one was found. Null otherwise.
Returns
True if a matching map was found, False otherwise.

◆ TryGetInteractionResultFromPool< T >()

static bool Impact.ImpactManagerInstance.TryGetInteractionResultFromPool< T > ( string  key,
out T  obj 
)
static

Attempts to get an available empty interaction result from the pool with the specified key.

Template Parameters
TThe IPoolable type to get.
Parameters
keyThe name of the pool.
objThe returned result, if one was found.
Returns
True if an available result was found. False otherwise.
Type Constraints
T :class 
T :IPoolable 
T :new()