// Update is called once per frame void Update() { // Escape Key: Quit game if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } // Backspace Key: Reset the game if (Input.GetKeyDown(KeyCode.Backspace)) { // Get the GuiManager to reset the scores GameObject go = GameObject.Find("GUIManager"); GuiManager guiM = go.GetComponent <GuiManager>(); guiM.resetScores(); // Destroy all the spheres GameObject goBlobM = GameObject.Find("blobManager"); BlobAnimator blobAnim = goBlobM.GetComponent <BlobAnimator>(); BlobScript[] BlobScriptList = goBlobM.GetComponentsInChildren <BlobScript>(); foreach (BlobScript script in BlobScriptList) { script.destroySphere(); } // Create a new sphere blobAnim.createBlob(); } }
void OnCollisionEnter(Collision collision) { print(collision.gameObject.name); if (collision.gameObject.name == "LeftHand") { GuiManager gui = GameObject.Find("GUIManager").GetComponent("GuiManager") as GuiManager; gui.incScore(); //// Destroy (GameObj); } if (collision.gameObject.name == "wallB") { GuiManager gui = GameObject.Find("GUIManager").GetComponent("GuiManager") as GuiManager; gui.incScoreFoe(); Destroy(GameObj); Manager.createBlob(); } }