using System; using Artemis.Storage.Entities.Profile.Abstract; using Artemis.Storage.Entities.Profile.Conditions; namespace Artemis.Core { /// /// Represents a condition that plays once when its script evaluates to . /// public class PlayOnceCondition : ICondition { /// /// Creates a new instance of the class. /// /// The profile element this condition applies to. public PlayOnceCondition(RenderProfileElement profileElement) { ProfileElement = profileElement; Entity = new PlayOnceConditionEntity(); } /// /// Creates a new instance of the class. /// /// The entity used to store this condition. /// The profile element this condition applies to. public PlayOnceCondition(PlayOnceConditionEntity entity, RenderProfileElement profileElement) { ProfileElement = profileElement; Entity = entity; } #region Implementation of IDisposable /// public void Dispose() { } #endregion #region Implementation of IStorageModel /// public void Load() { } /// public void Save() { } #endregion #region Implementation of ICondition /// public IConditionEntity Entity { get; } /// public RenderProfileElement ProfileElement { get; } /// public bool IsMet { get; private set; } /// public void Update() { if (ProfileElement.Parent is RenderProfileElement parent) IsMet = parent.DisplayConditionMet; else IsMet = true; } /// public void UpdateTimeline(double deltaTime) { ProfileElement.Timeline.Update(TimeSpan.FromSeconds(deltaTime), false); } /// public void OverrideTimeline(TimeSpan position) { ProfileElement.Timeline.Override(position, false); } #endregion } }