using System; using System.Collections.Generic; using Chernobyl.Update; namespace Chernobyl.StateMachine { /// /// A state than can be updated /// public class UpdateableState : State, IUpdateable { /// /// Creates an UpdateableState that uses an /// to store children IUpdateables. /// public UpdateableState() : this(new List()) {} /// /// Constructor. /// /// The list to use to hold onto children /// IUpdateables. public UpdateableState(ICollection childCollection) { UpdateableChildren = childCollection; } /// /// Updates this state and it's children /// instances. /// /// The amount of time that has /// passed since the last call to this update. public virtual void Update(TimeSpan deltaTime) { foreach (IUpdateable child in UpdateableChildren) { child.Update(deltaTime); } } /// /// The parent of this IUpdateable. /// public IUpdateable UpdateableParent { get; set; } /// /// The children of this IUpdateable. /// public ICollection UpdateableChildren { get; set; } } }