void removePieceFromWallZ(PieceObject tempPiece, int zVal) { var tempList = tempPiece.getActualObjects(); var currNode = tempList.First; GameObject currObject; //bool tempBool; //tempBool = false; Debug.Log(tempList.Count); while (currNode != null) { Debug.Log("recursion tick2"); //Debug.Log("one Node"); currObject = currNode.Value; currNode = currNode.Next; //Debug.Log(currNode); if (currObject.transform.position.y <= sizeDim + yOffset - 4 && currObject.transform.position.z == zVal) { Debug.Log("gameobject is part of wall and not above"); //Debug.Log("0 y value"); tempPiece.removeObjectFromActualObjects(currObject); Destroy(currObject); } } }
//Confusing Name; Takes in a piece that is intersecting a floor, edits it so that everything on that floor is removed and everything else is moved down according to gravity void removePieceFromFloor(PieceObject tempPiece, int floorVal) { var tempList = tempPiece.getActualObjects(); var currNode = tempList.First; GameObject currObject; //Debug.Log(tempList.Count); while (currNode != null) { //Debug.Log("one Node"); currObject = currNode.Value; currNode = currNode.Next; //Debug.Log(currNode); if (currObject.transform.position.y == floorVal) { //Debug.Log("0 y value"); tempPiece.removeObjectFromActualObjects(currObject); Destroy(currObject); } else { if (currObject.transform.position.y > floorVal) { currObject.transform.Translate(new Vector3(0, -1, 0), Space.World); } } } }