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

public class CharacterScreenPortalAnim : MonoBehaviour
{
    public List<GameObject> idlePortals = new List<GameObject>();
    public List<GameObject> closePortals = new List<GameObject>();

    public List<GameObject> characters = new List<GameObject>();

    private void Awake()
    {
        for (int i = 0; i < idlePortals.Count; i++)
        {
            idlePortals[i].SetActive(true);
            closePortals[i].SetActive(false);
        }
        for (int i = 0; i < characters.Count; i++)
        {
            characters[i].SetActive(false);
        }
    }

    // Start is called before the first frame update
    void Start()
    {
        Invoke(nameof(ClosePortals), 0.25f);   
    }

    private void ClosePortals()
    {
        for (int i = 0; i < idlePortals.Count; i++)
        {
            closePortals[i].SetActive(true);
            idlePortals[i].SetActive(false);
        }

        for (int i = 0; i < characters.Count; i++)
        {
            characters[i].SetActive(true);
        }

        Invoke(nameof(HidePortalsCompletely), 1f);
    }

    private void HidePortalsCompletely()
    {
        for (int i = 0; i < closePortals.Count; i++)
        {
            closePortals[i].SetActive(false);
        }
    }
}
