using System.Collections.Generic; using SM.Base.Contexts; namespace SM.Base.Scene { /// /// Contains a list of show items. /// /// The type of show items. public abstract class GenericItemCollection : List, IShowItem, IShowCollection where TItem : IShowItem { /// public List Objects => this; /// public void Update(UpdateContext context) { for(int i = 0; i < Objects.Count; i++) this[i].Update(context); } /// public virtual void Draw(DrawContext context) { for (int i = 0; i < Objects.Count; i++) this[i].Draw(context); } } /// /// Contains a list of show items with transformation. /// /// The type of show items. /// The type of transformation. public abstract class GenericItemCollection : GenericItemCollection where TItem : IShowItem where TTransformation : GenericTransformation, new() { /// /// Transformation of the collection /// public TTransformation Transform = new TTransformation(); /// public override void Draw(DrawContext context) { context.View = Transform.GetMatrix() * context.View; base.Draw(context); } } }