// Update is called once per frame void Update() { if (Enemy.count <= 0 && isGameFinish == false) { //Debug.Log("Count = 0 " + Enemy.count); int temp = (ms.getChoosenMap() == 1) ? 0 : ms.getChoosenMap(); Debug.Log("Temp: " + temp); ms.setChoosenMap(temp); TxtController.getInstance().updateText(); timer = Time.time; isGameFinish = true; //Debug.Log(timer); } if (PlayerCode.isDeath == true && isGameFinish == false) { //Debug.Log("Count = 0 " + Enemy.count); int temp = (ms.getChoosenMap() == 1) ? 0 : ms.getChoosenMap(); Debug.Log("Temp: " + temp); ms.setChoosenMap(temp); TxtController.getInstance().updateText(); timer = Time.time; isGameFinish = true; //Debug.Log(timer); } if (isGameFinish) { lastTimer = Time.time; blackScreen.GetComponent <Image>().enabled = true; status.SetActive(true); UnityEngine.UI.Text textStatus = status.GetComponent <UnityEngine.UI.Text>(); textStatus.text = Enemy.count <= 0 ? "You Win" : "You Lose"; //Debug.Log("Last Timer : " + lastTimer + "timer : " + timer); //Debug.Log(lastTimer - timer); } if ((lastTimer - timer) >= 3f && isGameFinish == true) { DisplayMap.removeEnemy(DisplayMap.xRand, DisplayMap.yRand); ms.setToPlay(false); SceneManager.LoadScene("MenuScene"); } }
// Update is called once per frame void Update() { if (isRotate == true) { checkText(); rotateBoxes(); } if (Input.GetKeyDown(KeyCode.UpArrow) && !isRotate) { // Debug.Log("Key Up " + index); index = plusIndex(index); // Debug.Log("Update : "+ index); changeColor(index, minIndex(index)); } if (Input.GetKeyDown(KeyCode.DownArrow) && !isRotate) { // Debug.Log("Key Up " + index); index = minIndex(index); // Debug.Log("Update : " + index); changeColor(index, plusIndex(index)); } if (Input.GetKeyDown(KeyCode.Return) && !isRotate) { if (index == 9) { // play index = 4; changeColor(index, 9); resetFinish(); isRotate = true; //changeCanvasTo(0); indexing = new Indexing(0, 4); } else if (index == 8) { // design map ms.setIndex(2); SceneManager.LoadScene("LoadingScreen"); } else if (index == 5) { //exit Debug.Log("Exit"); Application.Quit(); } else if (index == 4) { //play game ms.setChoosenMap(1); TxtController.getInstance().updateText(); ms.setIndex(1); SceneManager.LoadScene("LoadingScreen"); } else if (index == 3 || index == 2 || index == 1) { //play game int temp = (index != 2 && index == 3) ? 1 : 3; if (index == 2) { temp = 2; } //Debug.Log(temp); //Debug.Log(ms.getStatus()); //Debug.Log(ms.isAvailable(temp)); if (ms.isAvailable(temp)) { ms.setToPlay(true); ms.setChoosenMap(temp + 1); TxtController.getInstance().updateText(); ms.setIndex(1); SceneManager.LoadScene("LoadingScreen"); } } else if (index == 0) { //back index = 9; changeColor(index, 0); resetFinish(); isRotate = true; //changeCanvasTo(1); indexing = new Indexing(5, 9); } } if (Input.GetKeyDown(KeyCode.RightArrow)) { //Debug.Log("Right"); if (index == 7) { //resol plusResol(); //Debug.Log(idxR); Screen.SetResolution(resol[idxR].width, resol[idxR].height, true); changeText(7, resol[idxR].text); } else if (index == 6) { //quality plusQuality(); QualitySettings.SetQualityLevel(idxQ, true); changeText(6, quality[idxQ]); } } if (Input.GetKeyDown(KeyCode.LeftArrow)) { //Debug.Log("Left"); if (index == 7) { //change resol minResol(); Screen.SetResolution(resol[idxR].width, resol[idxR].height, true); //Debug.Log(idxR); changeText(7, resol[idxR].text); } else if (index == 6) { minQuality(); QualitySettings.SetQualityLevel(idxQ, true); changeText(6, quality[idxQ]); } } }