/// <summary>
        /// Updates for sliding and rolling and places new decals if applicable.
        /// </summary>
        /// <param name="newResult">The new interaction result.</param>
        public void KeepAlive(IInteractionResult newResult)
        {
            IsAlive = true;

            DecalInteractionResult decalInteractionResult = newResult as DecalInteractionResult;

            if (CreationIntervalType == InteractionIntervalType.Time)
            {
                intervalCounter += Time.fixedDeltaTime;
            }
            else
            {
                intervalCounter = Vector3.Distance(decalInteractionResult.OriginalData.Point, previousCreationPosition);
            }

            if (intervalCounter >= currentCreationIntervalTarget)
            {
                currentCreationIntervalTarget = CreationInterval.RandomInRange();

                if (newResult.IsValid)
                {
                    ImpactDecalPool.CreateDecal(this, decalInteractionResult.OriginalData.Point, decalInteractionResult.OriginalData.Normal);
                }

                intervalCounter          = 0;
                previousCreationPosition = decalInteractionResult.OriginalData.Point;
            }

            OriginalData = decalInteractionResult.OriginalData;
        }
        /// <summary>
        /// Place decals using our data.
        /// </summary>
        /// <param name="parent">The Impact Object that created this result.</param>
        public void Process(IImpactObject parent)
        {
            this.parent = parent;

            ImpactDecalPool.CreateDecal(this, OriginalData.Point, OriginalData.Normal);
            IsAlive = true;

            currentCreationIntervalTarget = CreationInterval.RandomInRange();
            previousCreationPosition      = OriginalData.Point;

            //Dispose immediately for Collision interaction types
            if (OriginalData.InteractionType == InteractionData.InteractionTypeCollision)
            {
                Dispose();
            }
        }
        /// <summary>
        /// Retrieve a decal from the pool.
        /// This will ALWAYS return a decal. If all decals are unavailable, the oldest active decal will be used.
        /// </summary>
        /// <param name="collisionResult">The result to create the decal for.</param>
        /// <param name="point">The point at which to place the decal.</param>
        /// <param name="normal">The surface normal for the decal rotation.</param>
        /// <returns>An ImpactDecal instance.</returns>
        public static ImpactDecalBase CreateDecal(DecalInteractionResult collisionResult, Vector3 point, Vector3 normal)
        {
            if (collisionResult.DecalTemplate == null)
            {
                return(null);
            }

            ImpactDecalPool pool = poolGroup.GetOrCreatePool(collisionResult.DecalTemplate, collisionResult.DecalTemplate.PoolSize);

            if (pool != null)
            {
                ImpactDecalBase a = pool.GetObject();
                if (a != null)
                {
                    a.SetupDecal(collisionResult, point, normal);
                }

                return(a);
            }

            return(null);
        }
 /// <summary>
 /// Creates an object pool instance for the decal prefab.
 /// </summary>
 public override void Preload()
 {
     ImpactDecalPool.PreloadPoolForDecal(DecalPrefab);
     ImpactManagerInstance.CreateInteractionResultPool <Interactions.Decals.DecalInteractionResult>(interactionResultPoolKey);
 }