using Intrepid.Gameplay.Codex.Visual;
using Intrepid.Gameplay.Codex.Visual.Events;
using Intrepid.SimpleEvents;

namespace Intrepid.Gameplay.Codex.Perception.Presentation
{
    /// <summary>
    /// Tiny base for future diegetic marks. It only listens to visual changes.
    /// Specific marks can inherit and apply materials, sprites, particles or line renderers.
    /// </summary>
    public abstract class CodexWorldMarkPresenter : EventListener
    {
        protected override void InitializeVariables()
        {
        }

        protected override void OnBootstrap()
        {
            ApplyVisual(CodexVisualService.Instance.CurrentContext);
        }

        protected override void Subscriptions()
        {
            Subscribe<CodexVisualChangedEvent>(e =>
            {
                ApplyVisual(e.Context);    
            });
        }
        
        protected abstract void ApplyVisual(CodexVisualContext context);
    }
}
