public static void Pool(SgtRingSegment segment) { if (segment != null) { segment.Ring = null; SgtComponentPool<SgtRingSegment>.Add(segment); } }
public static void MarkForDestruction(SgtRingSegment segment) { if (segment != null) { segment.Ring = null; segment.gameObject.SetActive(true); } }
public static void Pool(SgtRingSegment segment) { if (segment != null) { segment.Ring = null; SgtComponentPool <SgtRingSegment> .Add(segment); } }
protected virtual void OnDestroy() { SgtHelper.Destroy(material); for (var i = segments.Count - 1; i >= 0; i--) { SgtRingSegment.MarkForDestruction(segments[i]); } segments.Clear(); }
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); } }