コード例 #1
0
    public void ForceStop()
    {
        ps.Stop();
        ps.Clear();

        if (pool != null)
        {
            pool.Return(this);
        }
    }
コード例 #2
0
ファイル: PoolGameObject.cs プロジェクト: mmerchante/aedifex
 public void Return()
 {
     //Recycle the object only if the pool is still alive
     if (pool)
     {
         pool.Return(this);
     }
 }
コード例 #3
0
ファイル: TimeSlider.cs プロジェクト: mmerchante/aedifex
    protected void DrawTimeIndicators(Rect container)
    {
        float z           = Mathf.Max(1f, Zoom);
        int   zoomScaling = (int)((int)(z / secondsPerTick) * secondsPerTick) + 1;

        int   ticks  = (int)((BaseDuration) / secondsPerTick) * zoomScaling;
        float offset = Offset * container.width * Zoom;

        int accents = ticks / ticksPerAccent;

        while (currentIndicators.Count < accents)
        {
            currentIndicators.Add(indicatorPool.Retrieve());
        }

        if (currentIndicators.Count >= accents)
        {
            List <TimeSliderIndicator> toReturn = new List <TimeSliderIndicator>();
            int toRemove = currentIndicators.Count - accents;

            for (int i = 0; i < toRemove; ++i)
            {
                toReturn.Add(currentIndicators[currentIndicators.Count - 1]);
                indicatorPool.Return(currentIndicators[currentIndicators.Count - 1]);
                currentIndicators.RemoveAt(currentIndicators.Count - 1);
            }
        }

        for (int i = 0; i < currentIndicators.Count; ++i)
        {
            TimeSliderIndicator indicator = currentIndicators[i];
            float t = Mathf.Clamp01(i / (float)accents);
            float x = t * container.width * Zoom - offset;
            indicator.UpdateData(BaseDuration * t, x);
        }
    }