using System;
using System.Collections.Generic;
using Artemis.Storage.Entities.Profile.Abstract;
using Artemis.Storage.Entities.Profile.Conditions;
namespace Artemis.Core;
///
/// Represents a condition that is always true.
///
public class AlwaysOnCondition : ICondition
{
///
/// Creates a new instance of the class.
///
/// The profile element this condition applies to.
public AlwaysOnCondition(RenderProfileElement profileElement)
{
ProfileElement = profileElement;
Entity = new AlwaysOnConditionEntity();
}
///
/// Creates a new instance of the class.
///
/// The entity used to store this condition.
/// The profile element this condition applies to.
public AlwaysOnCondition(AlwaysOnConditionEntity alwaysOnConditionEntity, RenderProfileElement profileElement)
{
ProfileElement = profileElement;
Entity = alwaysOnConditionEntity;
}
///
public void Dispose()
{
}
#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), true);
}
///
public void OverrideTimeline(TimeSpan position)
{
ProfileElement.Timeline.Override(position, position > ProfileElement.Timeline.Length);
}
#endregion
#region Implementation of IPluginFeatureDependent
///
public IEnumerable GetFeatureDependencies()
{
return [];
}
#endregion
}