public void showstars() { // freeze menu buttons foreach (GameObject button in menuObjects) { button.GetComponent <Button>().interactable = false; } // change cursor back: cursor.setMouse(); dc.BackToDeselect(); // Ryan: victory sound here! AudioSource levelComplete = gameObject.GetComponent <AudioSource> (); levelComplete.Play(); //sound.SetActive (false); footsound.mute = true; int usage = PlayerPrefs.GetInt("usage"); txt.text = "Number of tools used: " + usage.ToString(); Time.timeScale = 0; if (usage <= par1) { score1 = 3; foreach (GameObject g in starObjects) { g.SetActive(true); } } else if (usage <= 2 * par1) { score1 = 2; foreach (GameObject g in starObjects) { if (g.name != "star3") { g.SetActive(true); } } } else { score1 = 1; foreach (GameObject g in starObjects) { if (g.name != "star3" && g.name != "star2") { g.SetActive(true); } } } PlayerPrefs.SetInt("score1", score1); lb.savescore(score1); }
public void showstars() { // change cursor back: cursor.setMouse(); dc.BackToDeselect(); AudioSource levelComplete = gameObject.GetComponent <AudioSource> (); levelComplete.Play(); //sound.SetActive (false); footsound.mute = true; int usage = PlayerPrefs.GetInt("usage"); txt.text = "Number of tools used: " + usage.ToString(); Time.timeScale = 0; if (usage <= par9) { score9 = 3; foreach (GameObject g in starObjects) { g.SetActive(true); } } else if (usage <= 2 * par9) { score9 = 2; foreach (GameObject g in starObjects) { if (g.name != "star3") { g.SetActive(true); } } } else { score9 = 1; foreach (GameObject g in starObjects) { if (g.name != "star3" && g.name != "star2") { g.SetActive(true); } } } score9 = score9 + PlayerPrefs.GetInt("score8"); PlayerPrefs.SetInt("score9", score9); lb.savescore(score9); }
public void showgameover() { cursor.setMouse(); Time.timeScale = 0; footsound.mute = true; envtsounds.SetActive(false); foreach (GameObject g in gameoverObjects) { Debug.Log(g); g.SetActive(true); } foreach (GameObject button in menuObjects) { button.GetComponent <Button>().interactable = false; } }
public void showstars() { // change cursor back: cursor.setMouse(); dc.BackToDeselect(); //sound.SetActive (false); footsound.mute = true; int usage = PlayerPrefs.GetInt("usage"); txt.text = "Number of tools used: " + usage.ToString(); Time.timeScale = 0; if (usage <= par10) { score10 = 3; foreach (GameObject g in starObjects) { g.SetActive(true); } } else if (usage <= 2 * par10) { score10 = 2; foreach (GameObject g in starObjects) { if (g.name != "star3") { g.SetActive(true); } } } else { score10 = 1; foreach (GameObject g in starObjects) { if (g.name != "star3" && g.name != "star2") { g.SetActive(true); } } } score10 = score10 + l9.score9; lb.savescore(score10); }
// Update is called once per frame void Update() { if (EventSystem.current.currentSelectedGameObject != null) { // detect which inventory button is selected [lever? ramp? pulley? wedge? eraser?] if (EventSystem.current.currentSelectedGameObject.name == "Lever" && lever.carrying) { lever.SetLever(); selected = "Lever"; } else if (EventSystem.current.currentSelectedGameObject.name == "Ramp" && ramp.carrying) { ramp.SetRamp(); selected = "Ramp"; } else if (EventSystem.current.currentSelectedGameObject.name == "Wedge" && wedge.carrying) { wedge.SetWedge(); selected = "Wedge"; } else if (EventSystem.current.currentSelectedGameObject.name == "Crossbow" && crossbow.carrying) { crossbow.SetCrosshair(); selected = "Crossbow"; } else if (EventSystem.current.currentSelectedGameObject.name == "Eraser" && eraser.carrying) { eraser.SetEraser(); selected = "Eraser"; } else if (EventSystem.current.currentSelectedGameObject.name == "Pulley" && pulley.carrying) { pulley.SetPulley(); selected = "Pulley"; } else { cursor.setMouse(); } } // do actions place(); }
public void showstars() { // freeze menu buttons foreach (GameObject button in menuObjects) { button.GetComponent <Button>().interactable = false; } // change cursor back: cursor.setMouse(); dc.BackToDeselect(); AudioSource levelComplete = gameObject.GetComponent <AudioSource> (); levelComplete.Play(); //sound.SetActive (false); footsound.mute = true; //fingure out how many tools were used int usage = PlayerPrefs.GetInt("usage"); txt.text = "Number of tools used: " + usage.ToString(); Time.timeScale = 0; if (usage <= par2) { //if usage is <= par, you get 3 stars score2 = 3; foreach (GameObject g in starObjects) { g.SetActive(true); } } else if (usage <= 2 * par2) { // if usuage is less than 2 times the par, you get 2 stars score2 = 2; foreach (GameObject g in starObjects) { Debug.Log(g); if (g.name != "star3") { Debug.Log(g); g.SetActive(true); } } } else { // if usage is less than 3 times the par, you get 2 stars score2 = 1; foreach (GameObject g in starObjects) { if (g.name != "star3" && g.name != "star2") { g.SetActive(true); } } } score2 = score2 + PlayerPrefs.GetInt("score1"); PlayerPrefs.SetInt("score2", score2); //save the score so far in player prefs for the leaderboard lb.savescore(score2); }
private void OnMouseExit() { cursor.setMouse(); }
void Start() { cursor = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <HandleCursor>(); cursor.setMouse(); }