1.导入unity包(Generic中有Lists)
using UnityEngine;
using System.Collections;
using System.Collections.Generic; //Allows us to use Lists.
2.单例模式(整个游戏中只能有一个GameManager)
通过调用GameManager.instance来获取该单例。
定义BoardManager,level
如果instance==null,新建一个instance=this
如果instance不是当前的this,销毁当前的gameobject
调用dontDestroyOnLoad来保证重载scene的时候gamemanager不被销毁
通过boardManager初始化场景
public class GameManager : MonoBehaviour
{
public static GameManager instance = null; //Static instance of GameManager which allows it to be accessed by any other script.
private BoardManager boardScript; //Store a reference to our BoardManager which will set up the level.
private int level = 3; //Current level number, express