using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Otter { public class GraphicList : Graphic { public List Graphics = new List(); public GraphicList(params Graphic[] graphics) { Graphics.AddRange(graphics); } public Graphic this[int index] { get { return Graphics[index]; } set { Graphics[index] = value; } } public T GetGraphic(int index) where T : Graphic { return (T)this[index]; } public T Add(T graphic) where T : Graphic { Graphics.Add(graphic); return graphic; } public void Clear() { Graphics.Clear(); } public void AddRange(params Graphic[] graphics) { Graphics.AddRange(graphics); } public void AddRange(IEnumerable graphics) { Graphics.AddRange(graphics); } public override void Update() { base.Update(); foreach (var g in Graphics) { g.Update(); } } public override void Render(float x = 0, float y = 0) { base.Render(x, y); if (!Visible) return; foreach (var g in Graphics) { g.Render(x + X, y + Y); } } } }