void GotoScene(HMScene scene) { fadeInOut.transform.localPosition = new Vector3( - 28f , 0 , 3f ); fadeInOut.transform.DOLocalMoveX(28f, fadeTime ).SetRelative(false); if (changeSceneCoroutine != null ) StopCoroutine(changeSceneCoroutine); changeSceneCoroutine = SwitchScene(scene, fadeTime * 0.4f ); StartCoroutine(changeSceneCoroutine); }
IEnumerator SwitchScene(HMScene to , float delay) { Debug.Log("Go to " + to.scene.name); EventManager.Instance.PostEvent(EventDefine.FORZEN_CHARACTER); yield return new WaitForSeconds(delay); tempScene.scene.SetActive(false); tempScene = to; tempScene.scene.SetActive(true); colorChange = tempScene.colorChange; character.transform.position = tempScene.start.transform.position; yield return new WaitForSeconds(delay); EventManager.Instance.PostEvent(EventDefine.UNFORZEN_CHARACTER); changeSceneCoroutine = null; }
// protected override void BeginStep () { // if (tempStep.Equals("Trans") ) // { // Message msg = new Message(); // msg.AddMessage("item", ""); // EventManager.Instance.PostEvent(EventDefine.GET_ITEM, msg); // Application.LoadLevel("TimeLine"); // return; // } // for(int i = 0 ; i < Scenes.Length ; ++ i ) // { // // Debug.Log("Update Scene" + tempStep); // if (Scenes[i].name.Equals(tempStep)) // Scenes[i].SetActive(true); // else // Scenes[i].SetActive(false); // } // // if (name.StartsWith(Global.TRANSFORM_SCENE_NAME)) // // { // // TransformScene(name); // // } // } protected override void Init(string path="") { base.Init(Global.HAPPYMASK_SCRIPT_PATH); s_Instance = this; tempScene = sceneList[0]; StartCoroutine( SwitchScene(tempScene, 0)); //thunder StartCoroutine(MakeThunder()); }