using UnityEngine;

namespace Intrepid.Utilities.Updatable
{
    [DefaultExecutionOrder(GonConstants.ExecutionOrder.UpdatableManager)]
    public class UpdatableManager : MonoBehaviour
    {
        private void FixedUpdate()
        {
            foreach (var updatable in UpdatableCollection.Instance.OrderedUpdatableList)
            {
                updatable.FixedUpdateFromUpdatable();
            }
        }
        
        private void Update()
        {
            foreach (var updatable in UpdatableCollection.Instance.OrderedUpdatableList)
            {
                updatable.UpdateFromUpdatable();
            }
        }
    }
}