コード例 #1
0
ファイル: AddFoamThruster.cs プロジェクト: QuiqueGM/FishingGO
        /// <summary>
        /// Returans a new FoamOverlay object. Will take from the pool
        /// if not empty and reset to new values. If pool empty it will
        /// create a new object. Used to reduce memory allocations.
        /// </summary>
        FoamOverlay NewFoamOverlay(Vector3 pos, float rotation, float size, float duration, Texture texture)
        {
            FoamOverlay overlay = null;

            if (m_pool.Count > 0)
            {
                overlay = m_pool.First.Value;
                overlay.Reset(pos, Rotation(), size, duration, foamTexture);
                m_pool.RemoveFirst();
            }
            else
            {
                overlay = new FoamOverlay(pos, Rotation(), size, duration, foamTexture);
            }

            return(overlay);
        }