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

public class GameController : MonoBehaviour
{
    private static GameController Instance;
    public static GameController GetInstance()
    {
        if (Instance == null)
        {
            GameObject obj = new GameObject("GameController");
            Instance = obj.AddComponent<GameController>();
            Instance.Fruits = new GameObject("Fruits").transform;
            Instance.Fruits.position = Vector3.zero;
        }
        return Instance;
    }

    public Transform Fruits;

    public bool IsGameOver = false;

    //准备销毁的水果集合
    public LinkedList<GameObject> TempList = new LinkedList<GameObject>();

    //红线高度
    public float RedLinePosY => ColliderAdapter.Instance.RedLinePosY;

    public void ResetGame()
    {
        IsGameOver = false;
        for (int i = Fruits.childCount - 1; i >= 0 ; i--)
        {
            Destroy(Fruits.GetChild(i).gameObject);
        }
        UIMgr.GetInstance().GetPanel<TouchPanel>().SetInstantiateFruit();
    }

}
