// Use this for initialization void Start() { pauseBarScript = GameObject.Find("pauseBar").GetComponent <pauseBarScale>(); pauseEndScript = GameObject.Find("pauseEnd").GetComponent <pauseEndScale>(); if (PlayerPrefs.GetString("chaPos4") != "") { pauseBarScript.scaleFourCha(); pauseEndScript.scaleFourCha(); } else if (PlayerPrefs.GetString("chaPos3") != "") { pauseBarScript.scaleThreeCha(); pauseEndScript.scaleThreeCha(); } else if (PlayerPrefs.GetString("chaPos2") != "") { pauseBarScript.scaleTwoCha(); pauseEndScript.scaleTwoCha(); } else if (PlayerPrefs.GetString("chaPos1") != "") { pauseBarScript.scaleOneCha(); pauseEndScript.scaleOneCha(); } }
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 && 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 (pos1Check.pos1IsFree == true && zebraIsOnShelf == false) { Debug.Log("zebra pos1Check.pos1IsFree == true && zebraIsOnShelf == false"); pauseBarScript.scaleOneCha(); pauseEndScript.scaleOneCha(); this.audio.Play(); transform.position = dummyPos1.transform.position; pos1Check.pos1IsFree = false; zebraIsOnShelf = true; setPosButtonScript.chaPos1 = "zebra"; } else if (pos2Check.pos2IsFree == true && zebraIsOnShelf == false) { Debug.Log("zebra pos2Check.pos2IsFree == true && zebraIsOnShelf == false"); pauseBarScript.scaleTwoCha(); pauseEndScript.scaleTwoCha(); this.audio.Play(); transform.position = dummyPos2.transform.position; pos2Check.pos2IsFree = false; zebraIsOnShelf = true; setPosButtonScript.chaPos2 = "zebra"; } else if (pos3Check.pos3IsFree == true && zebraIsOnShelf == false) { Debug.Log("zebra pos3Check.pos3IsFree == true && zebraIsOnShelf == false"); pauseBarScript.scaleThreeCha(); pauseEndScript.scaleThreeCha(); this.audio.Play(); transform.position = dummyPos3.transform.position; pos3Check.pos3IsFree = false; zebraIsOnShelf = true; setPosButtonScript.chaPos3 = "zebra"; } else if (pos4Check.pos4IsFree == true && zebraIsOnShelf == false) { Debug.Log("zebra pos4Check.pos4IsFree == true && zebraIsOnShelf == false"); pauseBarScript.scaleFourCha(); pauseEndScript.scaleFourCha(); this.audio.Play(); transform.position = dummyPos4.transform.position; pos4Check.pos4IsFree = false; zebraIsOnShelf = true; setPosButtonScript.chaPos4 = "zebra"; } //if player drag zebra to its position, the 'zebraIsOnShelf' still is true and this is not correct //we have have to check to see is zebra position.x is bigger than shelf and if 'zebraIsOnShelf'= true //this mean zebra is send back by player and posBoolChange should be changed to false else { Debug.Log("zebra else if pos1Check.pos1IsFree == true && zebraIsOnShelf == false"); this.audio.Play(); transform.position = zebraBW.transform.position; zebraIsOnShelf = false; CheckzebraBacktoPosition(); } } else { Debug.Log("zebra else if (transform.position.x < pauseBar.transform.position.x+2)"); this.audio.Play(); transform.position = zebraBW.transform.position; zebraIsOnShelf = false; CheckzebraBacktoPosition(); } }
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(); } }