using System; using System.Collections.Generic; namespace Chernobyl.Update { /// /// An that allows for at runtime switching of /// it's implementation and makes creating new s /// easier through the use of other implementations. /// This is an implementation of the decorator pattern /// (http://en.wikipedia.org/wiki/Decorator_pattern). /// public abstract class UpdateableDecorator : IUpdateable { /// /// Updates this object and it's children if /// the feels it's necessary. /// /// The amount of time that has passed since /// this update was last called. public void Update(TimeSpan deltaTime) { DecoratedUpdateable.Update(deltaTime); } /// /// The parent of this IUpdateable or null if this IUpdateable does not /// have a parent. /// public IUpdateable UpdateableParent { get { return DecoratedUpdateable.UpdateableParent; } set { DecoratedUpdateable.UpdateableParent = value; } } /// /// Holds a collection of children that should be updated when this /// decides they should be updated. /// public ICollection UpdateableChildren { get { return DecoratedUpdateable.UpdateableChildren; } } /// /// The that implements the functionality of /// this . Note that, when setting this property, /// the data from the previous value of this property will be copied to /// the new value using /// . /// protected abstract IUpdateable DecoratedUpdateable { get; } } }