using UnityEngine;
using System;
using System.Collections.Generic;

namespace mgaia.Utils.Pause
{
    /// <summary>
    /// Classe estática que pausa e despausa o jogo logicamente, através do travamento do update
    /// </summary>
    /// <owner>Victor</owner>
    public class LogicalPauseManager : BasePauseManager
    {
        public static LogicalPauseManager Instance { get; private set; }

        static LogicalPauseManager()
        {
            Instance = new LogicalPauseManager();
        }

        /// <summary>
        /// Envia mensagem para todos os objetos que podem ser pausados
        /// </summary>
        protected override void HandlePauseStateChanged(bool isPaused)
        {
            GameObject.FindObjectsOfType<PausableBehaviour>().ForEach(
                delegate(PausableBehaviour pausableBehaviour)
                {
                    pausableBehaviour.Pause(isPaused);
                });
        }
    }
}