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

public class PosDrawPhase : AbstractPhase {

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

    public Animator mAnimatorSketch;

    private void Awake()
    {
        _instance = this;
    }

    public override void BeginPhase()
    {
        TimerGame.Instance.TimeClosedEvent += EndPhase;
        mAnimatorSketch.Play("Sketch_Out");
        Timing.RunCoroutine(WaitAnimation());
    }

    public override void EndPhase()
    {
        TimerGame.Instance.gameObject.SetActive(false);
        ControlProgressManager.Instance.mCurrentPhase++;
        ControlProgressManager.Instance.RunningProgress();
    }

    IEnumerator<float> WaitAnimation()
    {
        yield return Timing.WaitForSeconds(2f);
        CameraManager.Instance.OrtGameObj.SetActive(false);
        CameraManager.Instance.CanvasSpace.SetActive(false);
        DrawPhase.Instance.mPainter.SetActive(false);
        CameraManager.Instance.PerspGameObj.SetActive(true);
        CameraManager.Instance.CanvasOver.SetActive(true);
        EndPhase();
    }
}
