コード例 #1
0
    public static void Pool(SgtRingSegment segment)
    {
        if (segment != null)
        {
            segment.Ring = null;

            SgtComponentPool<SgtRingSegment>.Add(segment);
        }
    }
コード例 #2
0
    public static void MarkForDestruction(SgtRingSegment segment)
    {
        if (segment != null)
        {
            segment.Ring = null;

            segment.gameObject.SetActive(true);
        }
    }
コード例 #3
0
    public static void MarkForDestruction(SgtRingSegment segment)
    {
        if (segment != null)
        {
            segment.Ring = null;

            segment.gameObject.SetActive(true);
        }
    }
コード例 #4
0
    public static void Pool(SgtRingSegment segment)
    {
        if (segment != null)
        {
            segment.Ring = null;

            SgtComponentPool <SgtRingSegment> .Add(segment);
        }
    }
コード例 #5
0
    protected virtual void OnDestroy()
    {
        SgtHelper.Destroy(material);

        for (var i = segments.Count - 1; i >= 0; i--)
        {
            SgtRingSegment.MarkForDestruction(segments[i]);
        }

        segments.Clear();
    }
コード例 #6
0
    protected void UpdateSegments()
    {
        segments.RemoveAll(m => m == null);

        if (SegmentCount != segments.Count)
        {
            SgtHelper.ResizeArrayTo(ref segments, SegmentCount, i => SgtRingSegment.Create(this), s => SgtRingSegment.Pool(s));
        }

        var angleStep = SgtHelper.Divide(360.0f, SegmentCount);

        for (var i = SegmentCount - 1; i >= 0; i--)
        {
            var angle    = angleStep * i;
            var rotation = Quaternion.Euler(0.0f, angle, 0.0f);

            segments[i].ManualUpdate(mesh, material, rotation);
        }
    }