/* public void CheckForCubesBelow() * { * GameObject[] cubes = GameObject.FindGameObjectsWithTag("Stationary"); * * * foreach(Transform child in transform) * { * //FindObjectOfType<Game>() .Round(child.position); * foreach(GameObject cube in cubes) * { * if (child.transform.position.x == cube.transform.position.x && * child.transform.position.z == cube.transform.position.z && * child.transform.position.y -2 == cube.transform.position.y ) * { * * DisableObject(); * return; * } * } * } * } */ void DisableObject() { //Disable the fall CancelInvoke("Fall"); //Label child cubes to stationary foreach (Transform child in transform) { child.transform.tag = "Stationary"; } //Move to Stationary Object for (int i = transform.childCount - 1; i >= 0; --i) { Transform child = transform.GetChild(i); child.SetParent(GameObject.FindGameObjectWithTag("StationaryObjects").transform, true); } //Disable the block enabled = false; FindObjectOfType <Game>().CheckForGameOver(); //Update stationary blocks cubemanager.GetComponent <CubeManager>().UpdateGameBoard(); //cubemanager.GetComponent<CubeManager>().DisplayOccupide(); //check for rows to delete //FindObjectOfType<EmptyCube>().clearLines(); //Spawn FindObjectOfType <Game>().spawnObject(); }