public void StartButton() { LoadingStartMenu.showFullBanner = true; //HideDialogMission(); AudioControl.DPlaySound("Click 1"); dialogLeft.GetComponent <DialogMissionLeft>().Hide(); dialogMid.GetComponent <DialogMissionMid>().Hide(); LeanTween.scale(dialogMid.gameObject, new Vector3(0, 0, 0), 0.2f).setUseEstimatedTime(true).setEase(LeanTweenType.easeInBack).setDelay(0.2f).setOnComplete(() => { MissionControl.countShowDialogLogin++; MissionControl.countShowRate++; Show = false; if (VariableSystem.heart < 1) { transform.parent.parent.GetComponent <MissionControl>().AddHeartButton(); } else { //Tru tim khi bat dau choi AudioControl.AddHeart(-1); //Chua bo dc cai dialog mission vi 1 so thanh phan cua no ko hien len sau khi goi active lai if (MissionData.targetCommon.startScene == 1) { LoadingScene.ShowLoadingScene("Farm", true); } else if (MissionData.targetCommon.startScene == 2) { LoadingScene.ShowLoadingScene("Factory", true); } else { LoadingScene.ShowLoadingScene("Store", true); } //Destroy music AudioControl.StopMusic("Nhac menu"); GoogleAnalytics.instance.LogScreen("Play level " + level); } transform.FindChild("BgBlack").gameObject.SetActive(false); }); LeanTween.scale(dialogLeft.gameObject, new Vector3(0, 0, 0), 0.1f).setUseEstimatedTime(true).setEase(LeanTweenType.easeInBack); dialogRight.GetComponent <DialogMissionRight>().HideDialog(); //HungBV - reset FactoryScenesController.isCreat = false; TownScenesController.isCreat = false; VilageResearchController.isCreate = false; CreatAndControlPanelHelp.countClickHelpPanel = 0; LotteryController.countSpin = 1; }
void Update() { if (Input.GetKeyDown("escape")) { audioManager.StopMusic(); PhotonNetwork.LeaveRoom(); // Application.LoadLevel("MainMenu"); SceneManager.LoadScene(1); } if (Input.GetKeyDown("return") && isPlaying == false) { if (Instructions.activeSelf == true) { Instructions.SetActive(false); } else { isPlaying = true; SpawnPlayer(); audioManager.PlayMusic(); } } }
void Start() { //VariableSystem.heart = 1; GoogleAnalytics.instance.LogScreen("Mission"); if (String.IsNullOrEmpty(VariableSystem.language)) { VariableSystem.language = "English"; } //VariableSystem.diamond = 100; showLogin = false; lbCountMessage = transform.FindChild("Button").FindChild("ButtonShowMessage").FindChild("Texture").FindChild("CountMessage").gameObject.GetComponent <UILabel>(); dialogSetting = transform.FindChild("Dialog").FindChild("DialogSetting"); dialogMessage = transform.FindChild("Dialog").FindChild("DialogMessage"); dialogSelectFriend = transform.FindChild("Dialog").FindChild("DialogSelectFriend"); dialogLoading = transform.FindChild("Dialog").FindChild("DialogLoading"); dialogLogin = transform.FindChild("Dialog").FindChild("DialogLogin"); loginButton = transform.FindChild("Button").FindChild("ButtonLogin"); dialogMission = transform.FindChild("Dialog").FindChild("DialogMission"); dialogAchievement = transform.FindChild("Dialog").FindChild("DialogAchievement"); dialogInapp = GameObject.Find("DialogInapp").transform; dialogDailyGift = transform.FindChild("Dialog").FindChild("DialogDailyGift"); dialogSpecialGift = transform.FindChild("Dialog").FindChild("DialogSpecialGift"); dialogRefill = transform.FindChild("Dialog").FindChild("DialogRefill"); dialogInfo = transform.FindChild("Dialog").FindChild("DialogInfo"); dialogEvent = transform.FindChild("Dialog").FindChild("DialogEventFriend"); lbLife = transform.FindChild("Button").FindChild("Life").FindChild("Icon").FindChild("Count").GetComponent <UILabel>(); lbDiamond = transform.FindChild("Button").FindChild("Diamond").FindChild("Count").GetComponent <UILabel>(); lbTimeLife = transform.FindChild("Button").FindChild("Life").FindChild("Time").GetComponent <UILabel>(); GameObject common = GameObject.Find("CommonObject"); if (common != null) { AudioControl.StopMusic("Nhac nen 2"); AudioControl.StopMusic("Nhac nen 1"); GameObject.Destroy(common); } if (MissionControl.Language == null) { //Doc xml ngon ngu MissionControl.LanguageEN = new Dictionary <string, string>(); MissionControl.LanguageVI = new Dictionary <string, string>(); TextAsset xml = Resources.Load <TextAsset>("Mission/Language/EN"); //Read File xml XmlDocument xmlDoc = new XmlDocument(); StringReader reader = new StringReader(xml.text); xmlDoc.Load(reader); XmlNodeList xmlNodeList = xmlDoc.DocumentElement.ChildNodes; reader.Dispose(); reader.Close(); foreach (XmlNode node in xmlNodeList) { MissionControl.LanguageEN.Add(node.Name, node.InnerText); } //vn TextAsset xml1 = Resources.Load <TextAsset>("Mission/Language/VI"); //Read File xml XmlDocument xmlDoc1 = new XmlDocument(); StringReader reader1 = new StringReader(xml1.text); xmlDoc1.Load(reader1); XmlNodeList xmlNodeList1 = xmlDoc1.DocumentElement.ChildNodes; reader1.Dispose(); reader1.Close(); foreach (XmlNode node in xmlNodeList1) { MissionControl.LanguageVI.Add(node.Name, node.InnerText); } MissionControl.Language = MissionControl.LanguageEN; if ("Vietnamese".Equals(VariableSystem.language)) { MissionControl.Language = MissionControl.LanguageVI; } } //Update language button transform.FindChild("Button").FindChild("ButtonLogin").FindChild("Label").GetComponent <UILabel>().text = MissionControl.Language["LOGIN"]; //Show rate if (countShowRate >= 7 && !showDialogTryAgain) { countShowRate = 0; transform.FindChild("Dialog").FindChild("DialogShare").GetComponent <DialogShare>().ShowDialog(); } AudioControl.DPlayMusicInstance("Nhac menu", true, true); }
private IEnumerator FlyAwayAndEndLevel() { audioControl.StopMusic(); audioControl.PlaySFX(SFX.LevelEnd); if (MusicAssigner.Instance != null) { Destroy(MusicAssigner.Instance); } Debug.Log($"Starting "); animator.Play("Takeoff"); idle.Pause(); idle.gameObject.SetActive(false); var player = GameObject.Find("Player"); player.GetComponent <BasePlayer>().EndOfLevel(); var time = 0f; // Time for 10 frames of floating upwards while (time < 0.417f) { time += Time.deltaTime; transform.position = new Vector3( transform.position.x, transform.position.y + 0.01f, transform.position.z); yield return(null); } // approximate time for rotation yield return(new WaitForSeconds(2f)); animator.enabled = false; takeOff.Play(); Camera.main.GetComponent <SmoothCameraMovement>() .Player = gameObject; time = 0; var rate = 0.01f; cg.gameObject.SetActive(true); while (time < 3f) { time += Time.deltaTime; transform.position = new Vector3( transform.position.x, transform.position.y + 0.02f, transform.position.z); cg.alpha += rate; yield return(null); } cg.alpha = 1f; while (!Input.GetKeyDown(KeyCode.Space)) { yield return(null); } if (loadPlayer) { SceneManager.LoadScene("Player"); SceneManager.LoadScene(nextScene, LoadSceneMode.Additive); if (nextSceneTransition != "") { SceneManager.LoadScene(nextSceneTransition, LoadSceneMode.Additive); } } else { SceneManager.LoadScene(nextScene); } }