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

public class FlowManager : MonoBehaviour
{
    public static FlowManager Inst;
    public List<FlowBase> flows;
    public int flowIndex;
    public FlowBase currFlowBase;

    void Start()
    {
        Inst = this;

        StartFlow();
    }

    // Update is called once per frame
    void Update()
    {
        if (currFlowBase != null)
        {
            currFlowBase.UpdateFlow();
        }
    }

    private void StartFlow()
    {
        FacadeComponent.Instance.CreateController<PointController>().OpenView();
        flowIndex = 0;
        currFlowBase = flows[flowIndex];
    }

    public void NextFlow()
    {
        flowIndex += 1;
        currFlowBase = flows[flowIndex];
        currFlowBase.StartFlow();
    }

    public void LastFlow() { }

    private void EndFlow() { }

    public void CheckCollider(Collider collider, bool isEnter)
    {
        if (currFlowBase.state == FlowBase.FlowState.Collider)
        {
            ((FlowCollider)currFlowBase).CheckPoint(collider, isEnter);
        }
    }
}
