예제 #1
0
 /// <summary>
 /// Clears the current ImpactManager instance, if it is the same as the provided instance.
 /// </summary>
 /// <param name="inst">The instance to clear.</param>
 public static void ClearInstance(ImpactManager inst)
 {
     if (instance == inst)
     {
         instance    = null;
         hasInstance = false;
     }
 }
예제 #2
0
 /// <summary>
 /// Sets the ImpactManager instance that all static methods will use.
 /// </summary>
 /// <param name="inst">The new instance.</param>
 public static void SetInstance(ImpactManager inst)
 {
     instance    = inst;
     hasInstance = instance != null;
 }
예제 #3
0
        /// <summary>
        /// Creates a new Interaction Result pool with the given key and size.
        /// </summary>
        /// <typeparam name="T">The IPoolable type to use.</typeparam>
        /// <param name="key">The name of the pool, used to retrieve objects.</param>
        /// <returns>The newly created pool, or the existing pool if there is one with the same key.</returns>
        public static void CreateInteractionResultPool <T>(string key) where T : class, IPoolable, new()
        {
            ImpactManager instance = GetInstance();

            instance.CreateInteractionResultPool <T>(key);
        }
예제 #4
0
        /// <summary>
        /// Attempts to get an available empty interaction result from the pool with the specified key.
        /// </summary>
        /// <typeparam name="T">The IPoolable type to get.</typeparam>
        /// <param name="key">The name of the pool.</param>
        /// <param name="obj">The returned result, if one was found.</param>
        /// <returns>True if an available result was found. False otherwise.</returns>
        public static bool TryGetInteractionResultFromPool <T>(string key, out T obj) where T : class, IPoolable, new()
        {
            ImpactManager instance = GetInstance();

            return(instance.TryGetInteractionResultFromPool(key, out obj));
        }
예제 #5
0
        /// <summary>
        /// Process a continuous interaction using the interaction data, an Impact Material, and an optional Impact Object that the interaction originated from.
        /// </summary>
        /// <param name="interactionData">The interaction data to process.</param>
        /// <param name="impactMaterial">The Impact Material to get interaction results from.</param>
        /// <param name="impactObject">An optional Impact Object that the interaction originated from.</param>
        public static void ProcessContinuousInteraction <T>(T interactionData, IImpactMaterial material, IImpactObject impactObject) where T : IInteractionData
        {
            ImpactManager instance = GetInstance();

            instance.ProcessContinuousInteraction(interactionData, material, impactObject);
        }
예제 #6
0
        /// <summary>
        /// Adds or updates the given continuous interaction result to the active continuous interaction results, if able.
        /// </summary>
        /// <param name="impactObject">The impact object the result is being sent from.</param>
        /// <param name="result">The new continuous interaction result.</param>
        public static void AddOrUpdateContinuousInteractionResult(IImpactObject impactObject, IContinuousInteractionResult result)
        {
            ImpactManager instance = GetInstance();

            instance.AddOrUpdateContinuousInteractionResult(impactObject, result);
        }
예제 #7
0
        /// <summary>
        /// Try to get an Impact Material from the Material Mapping using the given Physics Material instance ID.
        /// </summary>
        /// <param name="physicsMaterialInstanceId">The instance ID of the physics material (3D or 2D).</param>
        /// <param name="impactMaterial">The material that was found in the mapping, if one was found. Null otherwise.</param>
        /// <returns>True if a matching map was found, False otherwise.</returns>
        public static bool TryGetImpactMaterialFromMapping(int physicsMaterialInstanceId, out IImpactMaterial impactMaterial)
        {
            ImpactManager instance = GetInstance();

            return(instance.TryGetImpactMaterialFromMapping(physicsMaterialInstanceId, out impactMaterial));
        }
예제 #8
0
        /// <summary>
        /// Process a continuous interaction using the interaction data and the given Impact Object. The primary material at the interaction point will be used.
        /// </summary>
        /// <param name="interactionData">The interaction data to process.</param>
        /// <param name="impactObject">The Impact Object that an Impact Material will be retrieved from.</param>
        public static void ProcessContinuousInteraction <T>(T interactionData, IImpactObject impactObject) where T : IInteractionData
        {
            ImpactManager instance = GetInstance();

            instance.ProcessContinuousInteraction(interactionData, impactObject.GetPrimaryMaterial(interactionData.Point), impactObject);
        }
예제 #9
0
        /// <summary>
        /// Try to get an Impact Material from the Material Mapping using the given Collider2D.
        /// </summary>
        /// <param name="collider2d">The collider that has the Physics Material 2D to get a mapping for.</param>
        /// <param name="impactMaterial">The material that was found in the mapping, if one was found. Null otherwise.</param>
        /// <returns>True if a matching map was found, False otherwise.</returns>
        public static bool TryGetImpactMaterialFromMapping(Collider2D collider2d, out IImpactMaterial impactMaterial)
        {
            ImpactManager instance = GetInstance();

            return(instance.TryGetImpactMaterialFromMapping(collider2d, out impactMaterial));
        }
예제 #10
0
        public static bool HasActiveContinuousInteractionWithKey(long key)
        {
            ImpactManager instance = GetInstance();

            return(instance.HasActiveContinuousInteractionWithKey(key));
        }
예제 #11
0
        /// <summary>
        /// Has the maximum number of active continuous interactions been reached?
        /// </summary>
        /// <returns>True if the limit has been reached, False otherwise.</returns>
        public static bool HasReachedContinuousInteractionLimit()
        {
            ImpactManager instance = GetInstance();

            return(instance.HasReachedContinuousInteractionLimit());
        }
예제 #12
0
        /// <summary>
        /// Increments the physics interaction count.
        /// </summary>
        public static void IncrementPhysicsInteractionsLimit()
        {
            ImpactManager instance = GetInstance();

            instance.IncrementPhysicsInteractionsLimit();
        }
예제 #13
0
        /// <summary>
        /// Checks if the current physics interaction count has been reached.
        /// </summary>
        /// <returns>True if the limit has been reached, false otherwise.</returns>
        public static bool HasReachedPhysicsInteractionsLimit()
        {
            ImpactManager instance = GetInstance();

            return(instance.HasReachedPhysicsInteractionsLimit());
        }