using System; using System.Drawing; using Artemis.Core.Models.Profile; using Artemis.Core.Models.Surface; using Artemis.Core.Plugins.Models; namespace Artemis.Core.Plugins.Abstract { public abstract class ProfileModule : Module { protected ProfileModule(PluginInfo pluginInfo) : base(pluginInfo) { } public Profile ActiveProfile { get; private set; } /// public override void Update(double deltaTime) { lock (this) { // Update the profile ActiveProfile?.Update(deltaTime); } } /// public override void Render(double deltaTime, ArtemisSurface surface, Graphics graphics) { lock (this) { // Render the profile ActiveProfile?.Render(deltaTime, surface, graphics); } } public void ChangeActiveProfile(Profile profile) { lock (this) { if (profile == ActiveProfile) return; ActiveProfile?.Deactivate(); ActiveProfile = profile; ActiveProfile?.Activate(); } OnActiveProfileChanged(); } #region Events public event EventHandler ActiveProfileChanged; protected virtual void OnActiveProfileChanged() { ActiveProfileChanged?.Invoke(this, EventArgs.Empty); } #endregion } }