public void separateFrom(FishBox otherBox, bool moveAway) { if (connectedBoxes.ContainsKey(otherBox)) { setTankWall(getThisBoxInst(connectedBoxes[otherBox][0]).wall, true); foreach (ConnectionInstruction inst in connectedBoxes[otherBox]) { BoxInfo thisBoxInst = getThisBoxInst(inst); setWallCorner(true, thisBoxInst.wall, thisBoxInst.corner); } connectedBoxes.Remove(otherBox); HashSet <GameObject> newFish = new HashSet <GameObject>(); foreach (GameObject fish in otherBox.getFishes()) { if (tankContains(fish)) { newFish.Add(fish); //Debug.Log("fish!"); } } foreach (GameObject fish in newFish) { fish.transform.parent = fishTank.transform; otherBox.getFishes().Remove(fish); fishes.Add(fish); } otherBox.separateFrom(this, false); if (moveAway) { Vector3 newPos = Vector3.zero; newPos.x += 20; newPos.z += 20; fishTank.transform.position = newPos; fishTank.transform.rotation = Quaternion.Euler(Vector3.zero); } } }