using DarkTonic.CoreGameKit;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ControlProgressManager : MonoBehaviour {

    private static ControlProgressManager _instance;
    public static ControlProgressManager Instance
    {
        get
        {
            return _instance;
        }
    }

    public Transform PrefabFace, mFacePivot;
    [HideInInspector] public Face TheTrueAssassin;

    public enum Progress
    {
        LookPhase,
        PosLookPhase,
        DrawPhase,
        PosDrawPhase,
        IdentifierPhase,
        PosIdentifierPhase
    }

    [HideInInspector] public Progress mCurrentPhase;

    private void Awake()
    {
        _instance = this;
    }

    public void Start()
    {
        CameraManager.Instance.CanvasSpace.SetActive(false);

        mCurrentPhase = Progress.LookPhase;
        RunningProgress();

        Transform trans = PoolBoss.Spawn(this.PrefabFace, this.mFacePivot.position, Quaternion.identity, this.mFacePivot);

        if (trans != null)
        {
            this.TheTrueAssassin = trans.GetComponent<Face>();

            if (this.TheTrueAssassin != null)
            {
                this.TheTrueAssassin.makeRandomHead();
            }
        }
    }

    public void RunningProgress()
    {
        switch (mCurrentPhase)
        {
            case Progress.LookPhase:            LookPhase.Instance.BeginPhase();
                                                break;
            case Progress.PosLookPhase:         PosLookPhase.Instance.BeginPhase();
                                                break;
            case Progress.DrawPhase:            DrawPhase.Instance.BeginPhase();
                                                break;
            case Progress.PosDrawPhase:         PosDrawPhase.Instance.BeginPhase();
                                                break;
            case Progress.IdentifierPhase:      IdentifierPhase.Instance.BeginPhase();
                                                break;
            case Progress.PosIdentifierPhase:   PosIdentifierPhase.Instance.BeginPhase();
                                                break;
            default:                            break;
        }
    }
}
