// Use this for initialization void Start() { //從上一個場景把資料loading進來 _passParameter = (GameSceneManagerJsonFormat)GetlastScenePassData(); //如果沒有資料的話就建立假的 if (_passParameter == null) { _passParameter = CreateFakeData(); } //把CameraRig Loading到場景上面 LoadCameraRigToScene(); //處理傳遞的資訊 ProcessPassData(_passParameter); //設定腳色這個是遊戲一開始start //如果之後遊戲死掉回復就不會顯示start //把目前需要的stage Loading到Scene上面 if (SwitchToStage(_stage)) { Debug.Log("SwitchToStageSuccess"); } else { //表示沒有場景 Debug.Log("SwitchToStageFail"); } }
//建立假的資料,方便測試 public GameSceneManagerJsonFormat CreateFakeData() { GameSceneManagerJsonFormat format = new GameSceneManagerJsonFormat(); //把目前先暫時拉上去的都當作傳進來的 /* * foreach (GameObject stage in _listStage) * { * StageGameObjectSingleItem stageItem = new StageGameObjectSingleItem(); * stageItem.StageName = "關卡w"; * stageItem.StageInfo = "關卡說明w"; * stageItem.Stage = stage; * format.stageList.Add(stageItem); * } */ format.PlayTime = 150; format.winCondition = 1; format.limitStageTime = true; format.if_FailBackToFirstStage = false;//死掉可以待在同一關 //format.difficulity= StageController.Difficulty.insame;//先從簡單開始 //回傳 return(format); }
//處理傳遞過來的物件 public override void ProcessPassData(StateMachineJsonFormat Format = null) { //傳進去 _passParameter = (GameSceneManagerJsonFormat)Format; //然後作處理 }