/* * Animateable - A item that can be placed in an animation * * Author: Phillip Piper * Date: 23/10/2009 10:39 PM * * Change log: * 2009-10-23 JPP - Initial version * * To do: * * Copyright (C) 2009 Phillip Piper * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * If you wish to use this code in a closed source application, please contact phillip_piper@bigfoot.com. */ using System; using System.Collections.Generic; namespace BrightIdeasSoftware { public interface IAnimateable { /// /// Gets or sets the animation that this component belongs to /// Animation Animation { get; set; } /// /// This component is being started. It should acquire any resources that it needs /// void Start(); /// /// A unit of time has passed and the animation component should advance its state /// if sufficient time has passed. /// /// The number of milliseconds since Start() was called. /// True if Tick() should be called again bool Tick(long elapsed); /// /// Revert this component to its initial state. /// void Reset(); /// /// This component has been stopped. It should release any resources acquired in Start(). /// void Stop(); } /// /// A Animateable is the base class for any item that can be /// placed within an Animation. /// public class Animateable : IAnimateable { /// /// Gets or sets the animation that this component belongs to /// public Animation Animation { get { return animation; } set { animation = value; } } private Animation animation; /// /// This component is being started. It should acquire any resources that it needs /// public virtual void Start() { } /// /// A unit of time has passed and the animation component should advance its state /// if sufficient time has passed. /// /// The number of milliseconds since Start() was called. /// True if Tick() should be called again public virtual bool Tick(long elapsed) { return false; } /// /// Revert this component to its initial state. /// public virtual void Reset() { } /// /// This component has been stopped. It should release any resources acquired in Start(). /// public virtual void Stop() { } } }