#region Arthea License /*********************************************************************** * Arthea MUD by R. Jennings (2007) http://arthea.googlecode.com/ * * By using this code you comply with the Artistic and GPLv2 Licenses. * ***********************************************************************/ #endregion namespace Arthea.Updates { /// <summary> /// Handles the threading of the update methods /// </summary> public struct UpdateManager { /// <summary> /// How often areas update. /// </summary> public const int PulseArea = 120*PulseSecond; /// <summary> /// How often characters update. /// </summary> public const int PulseCharacters = 40*PulseSecond; /// <summary> /// How long a round of combat updates. /// </summary> public const int PulseCombat = 4*PulseSecond; /// <summary> /// How often items update /// </summary> public const int PulseItems = 40*PulseSecond; /// <summary> /// For time based actions. /// </summary> public const int PulseMinute = 60*PulseSecond; /// <summary> /// How often mobs wander around. /// </summary> public const int PulseMobWander = 45*PulseSecond; /// <summary> /// How many cycles per second. /// </summary> public const int PulseSecond = 1000; private static readonly TimerRegistry reg = new TimerRegistry(); static UpdateManager() { reg.AddTimerAction(new MobWanderAction()); reg.AddTimerAction(new CombatUpdateAction()); reg.AddTimerAction(new ItemsUpdateAction()); reg.AddTimerAction(new CharactersUpdateAction()); reg.AddTimerAction(new AreaUpdateAction()); } /// <summary> /// Updates this instance. /// </summary> public static void Update() { reg.Run(); } } }