using System;

namespace MonoGame.FourEngine.Components
{
    public class ActionComponent : Component
    {
        private Action<UpdateEventArgs> _action;

        public ActionComponent(Action<UpdateEventArgs> action)
        {
            _action = action;
        }

        public override void OnUpdate(UpdateEventArgs args)
        {
            base.OnUpdate(args);
            _action?.Invoke(args);
        }
    }
}