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

public class GameManager : MonoBehaviour
{
    static PlayerScript player;
    [Range(1f,120f)]public float mainTimer;
    static float timer;
    public static float victoryCountdown;
    void Awake()
    {
        GameObject.Find("CANVAS UI").transform.Find("Intro Screen").gameObject.SetActive(true);
        player = GameObject.Find("CHARACTER").GetComponent<PlayerScript>();
        if (mainTimer > 0.5f) timer = mainTimer; else timer = 60f;
    }

    void Start()
   {
       //StartGame();
   } 


   void Update()
   {
       victoryCountdown -= Time.deltaTime;
       if (victoryCountdown < 0) Victory();

       if (Input.GetKeyDown(KeyCode.Escape)) Application.Quit();
   }


    public void StartGame()
    {
        player.NewGame();
        victoryCountdown = timer;
    }

    public static void Victory()
    {
        player.Victory();
        EndGame();
    }


    public static void EndGame()
    {
        
    }

} // FIN DU SCRIPT
