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

public class GameStartUI : MonoBehaviour
{
    [SerializeField] private Animator animator;
    [SerializeField] private LookPoint lookPoint;

    public Transform startTransform;
    
    //private float testTimer = 5f;
    private bool startAni;
    private float startAniTimer = 1f;
    private bool gameStartTar;
    private bool protectTar;

    private float StartTimer = 3f;

    private void Update()
    {
        if (gameStartTar)
        {
            if(!protectTar)
            {
                GameStart();
            }

        }
        if(Input.GetMouseButtonDown(0))
        {

            gameStartTar = true;

            startTransform.gameObject.SetActive(false);
        }

        if(startAni)
        {
            startAniTimer -= Time.deltaTime;
            if (startAniTimer < 0)
            {
                animator.SetBool("GameStart", false);
                lookPoint.StartUP();
                
            }
        }

        

    }

    public void GameStart()
    {
        animator.SetBool("GameStart",true);
        startAni = true;
        protectTar = true;

    }

    public void Hide()
    {
        gameObject.SetActive(false);
    }
}
