void OnMouseUp() { if (transform.position.x < pauseBar.transform.position.x + 2) { if (pos1Check.pos1IsFree == true && rhinoIsOnShelf == false) { Debug.Log("pos1Check.pos1IsFree == true && rhinoIsOnShelf == false"); pauseBarScript.scaleOneCha(); pauseEndScript.scaleOneCha(); this.audio.Play(); transform.position = dummyPos1.transform.position; pos1Check.pos1IsFree = false; rhinoIsOnShelf = true; setPosButtonScript.chaPos1 = "rhino"; money.audio.Play(); money.buy(10000); } else if (pos2Check.pos2IsFree == true && rhinoIsOnShelf == false) { Debug.Log("rhino pos2Check.pos2IsFree == true && rhinoIsOnShelf == false"); pauseBarScript.scaleTwoCha(); pauseEndScript.scaleTwoCha(); this.audio.Play(); transform.position = dummyPos2.transform.position; pos2Check.pos2IsFree = false; rhinoIsOnShelf = true; setPosButtonScript.chaPos2 = "rhino"; money.audio.Play(); money.buy(10000); } else if (pos3Check.pos3IsFree == true && rhinoIsOnShelf == false) { Debug.Log("rhino pos3Check.pos3IsFree == true && rhinoIsOnShelf == false"); pauseBarScript.scaleThreeCha(); pauseEndScript.scaleThreeCha(); this.audio.Play(); transform.position = dummyPos3.transform.position; pos3Check.pos3IsFree = false; rhinoIsOnShelf = true; setPosButtonScript.chaPos3 = "rhino"; money.audio.Play(); money.buy(10000); } else if (pos4Check.pos4IsFree == true && rhinoIsOnShelf == false) { Debug.Log("rhino pos4Check.pos4IsFree == true && rhinoIsOnShelf == false"); pauseBarScript.scaleFourCha(); pauseEndScript.scaleFourCha(); this.audio.Play(); transform.position = dummyPos4.transform.position; pos4Check.pos4IsFree = false; rhinoIsOnShelf = true; setPosButtonScript.chaPos4 = "rhino"; money.audio.Play(); money.buy(10000); } //if player drag rhino to its position, the 'rhinoIsOnShelf' still is true and this is not correct //we have have to check to see is rhino position.x is bigger than shelf and if 'rhinoIsOnShelf'= true //this mean rhino is send back by player and posBoolChange should be changed to false else { Debug.Log("rhino else if pos1Check.pos1IsFree == true && rhinoIsOnShelf == false"); this.audio.Play(); transform.position = rhinoBW.transform.position; rhinoIsOnShelf = false; CheckRhinoBacktoPosition(); } } else { Debug.Log("rhino else if (transform.position.x < pauseBar.transform.position.x+2)"); this.audio.Play(); transform.position = rhinoBW.transform.position; rhinoIsOnShelf = false; CheckRhinoBacktoPosition(); } }
void OnMouseUp() { if (transform.position.x < pauseBar.transform.position.x + 2) { if (PlayerPrefs.GetInt("monkeyArrested") == 0 || (PlayerPrefs.GetInt("monkeyArrested") == 1 && ((money.moneyLeft - 20000) >= 0))) { if (pos1Check.pos1IsFree == true && monkeyIsOnShelf == false) { Debug.Log("monkey pos1Check.pos1IsFree == true && monkeyIsOnShelf == false"); pauseBarScript.scaleOneCha(); pauseEndScript.scaleOneCha(); this.audio.Play(); transform.position = dummyPos1.transform.position; pos1Check.pos1IsFree = false; monkeyIsOnShelf = true; setPosButtonScript.chaPos1 = "monkey"; if (PlayerPrefs.GetInt("monkeyArrested") == 1) { money.audio.Play(); money.buy(20000); handCuffs_monkey.renderer.enabled = false; PlayerPrefs.SetInt("monkeyArrested", 0); monkeyWasArrestedBefore = true; } } else if (pos2Check.pos2IsFree == true && monkeyIsOnShelf == false) { Debug.Log("monkey pos2Check.pos2IsFree == true && monkeyIsOnShelf == false"); pauseBarScript.scaleTwoCha(); pauseEndScript.scaleTwoCha(); this.audio.Play(); transform.position = dummyPos2.transform.position; pos2Check.pos2IsFree = false; monkeyIsOnShelf = true; setPosButtonScript.chaPos2 = "monkey"; if (PlayerPrefs.GetInt("monkeyArrested") == 1) { money.audio.Play(); money.buy(20000); handCuffs_monkey.renderer.enabled = false; PlayerPrefs.SetInt("monkeyArrested", 0); monkeyWasArrestedBefore = true; } } else if (pos3Check.pos3IsFree == true && monkeyIsOnShelf == false) { Debug.Log("monkey pos3Check.pos3IsFree == true && monkeyIsOnShelf == false"); pauseBarScript.scaleThreeCha(); pauseEndScript.scaleThreeCha(); this.audio.Play(); transform.position = dummyPos3.transform.position; pos3Check.pos3IsFree = false; monkeyIsOnShelf = true; setPosButtonScript.chaPos3 = "monkey"; if (PlayerPrefs.GetInt("monkeyArrested") == 1) { money.audio.Play(); money.buy(20000); handCuffs_monkey.renderer.enabled = false; PlayerPrefs.SetInt("monkeyArrested", 0); monkeyWasArrestedBefore = true; } } else if (pos4Check.pos4IsFree == true && monkeyIsOnShelf == false) { Debug.Log("monkey pos4Check.pos4IsFree == true && monkeyIsOnShelf == false"); pauseBarScript.scaleFourCha(); pauseEndScript.scaleFourCha(); this.audio.Play(); transform.position = dummyPos4.transform.position; pos4Check.pos4IsFree = false; monkeyIsOnShelf = true; setPosButtonScript.chaPos4 = "monkey"; if (PlayerPrefs.GetInt("monkeyArrested") == 1) { money.audio.Play(); money.buy(20000); handCuffs_monkey.renderer.enabled = false; PlayerPrefs.SetInt("monkeyArrested", 0); monkeyWasArrestedBefore = true; } } //if player drag monkey to its position, the 'monkeyIsOnShelf' still is true and this is not correct //we have have to check to see is monkey position.x is bigger than shelf and if 'monkeyIsOnShelf'= true //this mean monkey is send back by player and posBoolChange should be changed to false else { Debug.Log("monkey else if pos1Check.pos1IsFree == true && monkeyIsOnShelf == false"); this.audio.Play(); transform.position = monkeyBW.transform.position; monkeyIsOnShelf = false; CheckmonkeyBacktoPosition(); } } } else { Debug.Log("monkey else if (transform.position.x < pauseBar.transform.position.x+2)"); this.audio.Play(); transform.position = monkeyBW.transform.position; monkeyIsOnShelf = false; CheckmonkeyBacktoPosition(); } }
void OnMouseUp() { if (transform.position.x < pauseBar.transform.position.x + 2) { if (pos1Check.pos1IsFree == true && gorillaIsOnShelf == false && ((money.moneyLeft - 20000) >= 0)) { Debug.Log("pos1Check.pos1IsFree == true && gorillaIsOnShelf == false"); pauseBarScript.scaleOneCha(); pauseEndScript.scaleOneCha(); this.audio.Play(); transform.position = dummyPos1.transform.position; pos1Check.pos1IsFree = false; gorillaIsOnShelf = true; setPosButtonScript.chaPos1 = "gorilla"; money.audio.Play(); money.buy(20000); } else if (pos2Check.pos2IsFree == true && gorillaIsOnShelf == false && ((money.moneyLeft - 20000) >= 0)) { Debug.Log("gorilla pos2Check.pos2IsFree == true && gorillaIsOnShelf == false"); pauseBarScript.scaleTwoCha(); pauseEndScript.scaleTwoCha(); this.audio.Play(); transform.position = dummyPos2.transform.position; pos2Check.pos2IsFree = false; gorillaIsOnShelf = true; setPosButtonScript.chaPos2 = "gorilla"; money.audio.Play(); money.buy(20000); } else if (pos3Check.pos3IsFree == true && gorillaIsOnShelf == false && ((money.moneyLeft - 20000) >= 0)) { Debug.Log("gorilla pos3Check.pos3IsFree == true && gorillaIsOnShelf == false"); pauseBarScript.scaleThreeCha(); pauseEndScript.scaleThreeCha(); this.audio.Play(); transform.position = dummyPos3.transform.position; pos3Check.pos3IsFree = false; gorillaIsOnShelf = true; setPosButtonScript.chaPos3 = "gorilla"; money.audio.Play(); money.buy(20000); } else if (pos4Check.pos4IsFree == true && gorillaIsOnShelf == false && ((money.moneyLeft - 20000) >= 0)) { Debug.Log("gorilla pos4Check.pos4IsFree == true && gorillaIsOnShelf == false"); pauseBarScript.scaleFourCha(); pauseEndScript.scaleFourCha(); this.audio.Play(); transform.position = dummyPos4.transform.position; pos4Check.pos4IsFree = false; gorillaIsOnShelf = true; setPosButtonScript.chaPos4 = "gorilla"; money.audio.Play(); money.buy(20000); } //if player drag gorilla to its position, the 'gorillaIsOnShelf' still is true and this is not correct //we have have to check to see is gorilla position.x is bigger than shelf and if 'gorillaIsOnShelf'= true //this mean gorilla is send back by player and posBoolChange should be changed to false else { Debug.Log("gorilla else if pos1Check.pos1IsFree == true && gorillaIsOnShelf == false"); this.audio.Play(); transform.position = gorillaBW.transform.position; gorillaIsOnShelf = false; CheckgorillaBacktoPosition(); } } else { Debug.Log("gorilla else if (transform.position.x < pauseBar.transform.position.x+2)"); this.audio.Play(); transform.position = gorillaBW.transform.position; gorillaIsOnShelf = false; CheckgorillaBacktoPosition(); } }