/// <summary> /// Coroutine used to delay adding a frame back into the "toRender" queue. /// </summary> /// <param name="toQueue">The splat to delay adding back.</param> /// <returns>A Coroutine enumerator.</returns> private IEnumerator DelayFrame(Splatter.QueuedSplat toQueue) { yield return(new WaitForSeconds(1F / toQueue.splatData.FPS)); toQueue.frame++; // increment frame splatsToRender.Enqueue(toQueue); }
/// <summary> /// Queues a Splat up to be rendered. /// </summary> /// <param name="splatData">The SplatSO describing the splat.</param> /// <param name="worldPos">The world position to anchor the splat at.</param> /// <param name="projectileDir">The direction to splat in.</param> public void QueueNewSplat(SplatSO splatData, Vector3 worldPos, Vector2 projectileDir) { Splatter.QueuedSplat splat = new Splatter.QueuedSplat(); splat.splatData = splatData; splat.frame = 0; splat.worldPos = worldPos; splat.projectileDir = projectileDir; splatsToRender.Enqueue(splat); }