/// <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(); } }