public void StartTheGame() { //remainingTimeImage.transform.parent.gameObject.SetActive(true); newsObject.SetActive(false); int gameDifficulty = 1;//------ Get the difficulty if (gameDifficulty > 6) { gameDifficulty = 6; } maxTime = RemapValue(gameDifficulty, 1, 6, timeMinLimit, timeMaxLimit); inflateRate = RemapValue(gameDifficulty, 1, 6, minInflateRate, maxInflateRate); blowRate = RemapValue(gameDifficulty, 1, 6, minBlowRate, maxBlowRate); currentGameState = H_GameState.Playing; currentTime = maxTime; }
public void IncreaseTheTriggerCount() { currentNumberOfTriggers++; if (currentNumberOfTriggers >= numberOfTriggers) { //---Stop he game and Win currentGameState = H_GameState.End; dirstObject.SetActive(false); int extraScore = (int)(gameScore * (currentTime / maxTime)); StartCoroutine(WinTheGame(gameScore + extraScore)); print(gameScore + " " + extraScore); return; } }
//public IEnumerator CheckForWinning() //{ // colorCalculator.CheckColor(); // yield return new WaitForSeconds(0.3f); // currColor = colorCalculator.currentColor; // float h1, h2, s1, s2, v1, v2; // Color.RGBToHSV(currColor, out h1, out s1, out v2); // Color.RGBToHSV(defaultColor, out h2, out s2, out v1); // print("The V1 : " + currColor.r); // print("The V2 : " + v2); //} public void StartTheGame() { //colorCalculator.CheckColor(); //yield return new WaitForSeconds(0.1f); //defaultColor = colorCalculator.currentColor; remainingTimeImage.transform.parent.gameObject.SetActive(true); int gameDifficulty = 1;//------ Get the difficulty if (gameDifficulty > 6) { gameDifficulty = 6; } maxTime = RemapValue(gameDifficulty, 1, 6, timeMinLimit, timeMaxLimit); currentTime = maxTime; dirstObject.SetActive(true); currentGameState = H_GameState.Playing; }
// Update is called once per frame void Update() { if (currentGameState == H_GameState.Playing) { currentTime -= Time.deltaTime; remainingTimeImage.fillAmount = currentTime / maxTime; if (currentTime <= 0) { //---Stop he game and lose StartCoroutine(LoseTheGame()); currentGameState = H_GameState.End; return; } //if (Input.GetKeyDown(KeyCode.Space)) //{ // StartCoroutine(CheckForWinning()); //} } }
// Update is called once per frame void Update() { if (currentGameState == H_GameState.Playing) { currentTime -= Time.deltaTime; remainingTimeImage.fillAmount = currentTime / maxTime; if (currentTime <= 0) { //---Stop he game and lose StartCoroutine(LoseTheGame()); currentGameState = H_GameState.End; return; } if (tomatoHead.transform.localScale.x > 1) { tomatoHead.transform.localScale -= Vector3.one * inflateRate * Time.deltaTime; } //if (tomatoHead.transform.localScale.x <= loseLimit) //{ // //----- stop the game and lose // currentGameState = H_GameState.End; // return; //} if (Input.GetMouseButtonDown(0)) { tomatoHead.transform.localScale += Vector3.one * blowRate * Time.deltaTime; } if (tomatoHead.transform.localScale.x >= winLimit) { //----- stop the game and Win StartCoroutine(WinTheGame()); currentGameState = H_GameState.End; return; } } }