public static GameSceneInformation GetInstance()
 {
     if (sceneInformation == null)
     {
         sceneInformation = Create();
     }
     return(sceneInformation);
 }
    private static GameSceneInformation Create()
    {
        var information = new GameSceneInformation();

        if (information == null || !information.Init())
        {
            information = null;
        }
        return(information);
    }
    void LoadLevelInformation()
    {
        if (DebugMode)
        {
            return;
        }

        information = GameSceneInformation.GetInstance();
        var levelNameToLoad = information.LevelName;
        var danNameToLoad   = information.DanName;

        //根据载入信息 初始化相应的关卡
        foreach (var level in levels)
        {
            if (level.name == levelNameToLoad)
            {
                nowLevel = Instantiate(level, transform);
                break;
            }
        }
        //根据载入信息 初始化相应的蛋
        foreach (var vida in vidas)
        {
            if (vida.name == danNameToLoad)
            {
                nowVida = Instantiate(vida, transform);
                break;
            }
        }


        //加载硬币数量
        var coins = GameObject.FindGameObjectsWithTag("coin");

        gameController.maxCoinNum = coins.Length;
        //加载怪物数量
        var fails = GameObject.FindObjectsOfType <Fail>();

        gameController.maxFailNum = fails.Length;
    }
 // Use this for initialization
 void Start()
 {
     GameSceneInformation.GetInstance();
 }
Exemple #5
0
 public void LoadGameSceneNextLevel()
 {
     GameSceneInformation.GetInstance().LevelName = GameSceneInformation.GetInstance().NextLevelName;
     LoadGameScene();
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     hasScene = false;
     GameSceneInformation.GetInstance();//初始化
 }