private void placementWalltoWall(GameObject otherObject, FollowMouse followScript, Collider otherCol) { if (this.transform.rotation == otherCol.transform.rotation) { if (!followScript.getRotate()) { followScript.snap(); otherObject.transform.position = parentObject.transform.position + new Vector3(parentObject.transform.GetComponent <BoxCollider>().bounds.size.x, 0, 0); } else if (followScript.getRotate()) { followScript.snap(); otherObject.transform.position = parentObject.transform.position - new Vector3(0, 0, parentObject.transform.GetComponent <BoxCollider>().bounds.size.z); } } else { followScript.enableSliding(); if (!followScript.getRotate()) { followScript.snap(); otherObject.transform.position = parentObject.transform.position - new Vector3(-(otherCol.transform.GetComponent <BoxCollider>().bounds.extents.x - otherCol.transform.GetComponent <BoxCollider>().bounds.extents.z), 0, parentObject.transform.GetComponent <BoxCollider>().bounds.extents.z); } else if (followScript.getRotate()) { followScript.snap(); otherObject.transform.position = parentObject.transform.position + new Vector3(parentObject.transform.GetComponent <BoxCollider>().bounds.extents.x, 0, otherCol.transform.GetComponent <BoxCollider>().bounds.extents.z - otherCol.transform.GetComponent <BoxCollider>().bounds.extents.x); } } }
private void placementWallToWall(GameObject otherObject, FollowMouse followScript, Collider otherCol) { if (this.transform.rotation == otherCol.transform.rotation) { followScript.snap(); otherObject.transform.position = parentObject.transform.position + new Vector3(0, parentObject.transform.GetComponent <BoxCollider>().bounds.size.y, 0); } }
private void placementFloorToWall(GameObject otherObject, FollowMouse followScript, Collider otherCol) { followScript.snap(); //otherObject.transform.position = parentObject.transform.position + new Vector3(0, parentObject.transform.GetComponent<BoxCollider>().bounds.extents.y, otherObject.transform.GetComponent<BoxCollider>().bounds.extents.z - parentObject.transform.GetComponent<BoxCollider>().bounds.extents.z); //Debug.Log(followScript.isPlaceable()); float xPos = followScript.cursorPos.x; float zPos = followScript.cursorPos.z; Vector3 cursorPos = followScript.cursorPos; Vector3 temp = this.transform.position - cursorPos; Vector3 temp2 = this.GetComponent <BoxCollider>().bounds.center; //Debug.Log("X: " + xPos); //Debug.Log("Z: " + zPos); //Debug.Log("X: " + Mathf.Abs(xPos)); //Debug.Log(this.transform.rotation == new Quaternion(0.0f, 0.7f, 0.0f, 0.7f)); float angle = Quaternion.Angle(this.transform.rotation, new Quaternion(0.0f, 0.7f, 0.0f, 0.7f)); //Debug.Log(this.transform.rotation.Equals(new Quaternion(0.0f, 0.7f, 0.0f, 0.7f)) || this.transform.rotation == new Quaternion(0.0f, 0.7f, 0.0f, 0.7f)); if (angle < 90f) { if (xPos > temp2.x + 0.5f) { otherObject.transform.position = parentObject.transform.position + new Vector3(otherObject.transform.GetComponent <BoxCollider>().bounds.extents.x - parentObject.transform.GetComponent <BoxCollider>().bounds.extents.x, parentObject.transform.GetComponent <BoxCollider>().bounds.extents.y - otherObject.transform.GetComponent <BoxCollider>().bounds.extents.y, 0); } else if (xPos < temp2.x - 0.5f) { otherObject.transform.position = parentObject.transform.position + new Vector3(-(otherObject.transform.GetComponent <BoxCollider>().bounds.extents.x - parentObject.transform.GetComponent <BoxCollider>().bounds.extents.x), parentObject.transform.GetComponent <BoxCollider>().bounds.extents.y - otherObject.transform.GetComponent <BoxCollider>().bounds.extents.y, 0); } else { otherObject.transform.position = parentObject.transform.position + new Vector3(0, parentObject.transform.GetComponent <BoxCollider>().bounds.extents.y - otherObject.transform.GetComponent <BoxCollider>().bounds.extents.y, 0); } } else { if (zPos > temp2.z + 0.5f) { otherObject.transform.position = parentObject.transform.position + new Vector3(0, parentObject.transform.GetComponent <BoxCollider>().bounds.extents.y - otherObject.transform.GetComponent <BoxCollider>().bounds.extents.y, (otherObject.transform.GetComponent <BoxCollider>().bounds.extents.z - parentObject.transform.GetComponent <BoxCollider>().bounds.extents.z)); } else if (zPos < temp2.z - 0.5f) { otherObject.transform.position = parentObject.transform.position + new Vector3(0, parentObject.transform.GetComponent <BoxCollider>().bounds.extents.y - otherObject.transform.GetComponent <BoxCollider>().bounds.extents.y, -(otherObject.transform.GetComponent <BoxCollider>().bounds.extents.z - parentObject.transform.GetComponent <BoxCollider>().bounds.extents.z)); } else { otherObject.transform.position = parentObject.transform.position + new Vector3(0, parentObject.transform.GetComponent <BoxCollider>().bounds.extents.y - otherObject.transform.GetComponent <BoxCollider>().bounds.extents.y, 0); } } }
private void placementWallToFoundation(GameObject otherObject, FollowMouse followScript, Collider otherCol) { followScript.snap(); otherObject.transform.position = parentObject.transform.position + new Vector3(parentObject.transform.GetComponent <BoxCollider>().bounds.extents.x - otherObject.transform.GetComponent <BoxCollider>().bounds.extents.x, parentObject.transform.GetComponent <BoxCollider>().bounds.extents.y + otherObject.transform.GetComponent <BoxCollider>().bounds.extents.y, 0); }
private void placementFoundationToFoundation(GameObject otherObject, FollowMouse followScript) { followScript.snap(); otherObject.transform.position = parentObject.transform.position + new Vector3(parentObject.transform.GetComponent <BoxCollider>().bounds.size.x, 0, 0); }
private void placementFloorToWall(GameObject otherObject, FollowMouse followScript, Collider otherCol) { followScript.snap(); otherObject.transform.position = parentObject.transform.position - new Vector3(0, 0, parentObject.transform.GetComponent <BoxCollider>().bounds.size.z); }