private void InstantiateInteriorObjects() { GameObject gameObject = null; GameObject prefab = null; var createObj = new CreateGameObject(); Vector3 pos; Vector3 angle; //Loading Interior GameObjects: for (var i = 0; i < this.binaryTemp.objName_Interior.Length; i++) { var interiorObj = new GameObject_Interior(); pos = new Vector3(binaryTemp.pos_Interior[i, 0], binaryTemp.pos_Interior[i, 1], binaryTemp.pos_Interior[i, 2]); angle = new Vector3(binaryTemp.angle_Interior[i, 0], binaryTemp.angle_Interior[i, 1], binaryTemp.angle_Interior[i, 2]); prefab = (GameObject)Resources.Load("prefabs/" + binaryTemp.objName_Interior[i], typeof(GameObject)); // Instantiate object gameObject = createObj.InstantiateGameObj(prefab, pos); // Setting objects data gameObject = createObj.GameObjSetting(gameObject, angle); //adding the game object to modelObj interiorObj.SetGameObject(gameObject, pos, angle, prefab.name); //adding the game object to list of instantiated game objects InstantiatedGameObject._obj.SetInstantiatedInteriorObj(interiorObj); } }
public void OnPointerClick(PointerEventData eventData) { if (Interface._obj.GetSelected_ModelObj()) { var modelObj = Interface._obj.GetSelectedObject(); var oldModel = InstantiatedGameObject._obj.GetInstantiatedModelObj(this.gameObject); var createObj = new CreateGameObject(); var objColor = Color.white; // color of wall will be the default "WHITE" if (modelObj.name.Contains("window")) { objColor = Color.red; } else if (modelObj.name.Contains("door")) { objColor = Color.yellow; } var gameObject = createObj.InstantiateGameObj(modelObj, oldModel.GetStartPos(), true); gameObject = createObj.GameObjSetting(gameObject, oldModel.GetScale(), oldModel.GetAngle(), objColor); var newModel = new GameObject_Model(); newModel.SetGameObject(gameObject, oldModel.GetStartPos(), oldModel.GetScale(), oldModel.GetAngle(), objColor, modelObj.name, oldModel.GetObjLength()); InstantiatedGameObject._obj.SetInstantiatedModelObj(newModel); InstantiatedGameObject._obj.DeleteGameObjectModel(oldModel); Destroy(this.gameObject); Interface._obj.SetSelected_InteriorObj(false); Interface._obj.SetSelected_ModelObj(false); Interface._obj.SetSelectedObject(null); } }
private void InstantiateModelObjects() { GameObject gameObject = null; GameObject prefab = null; var createObj = new CreateGameObject(); Vector3 pos; Vector3 length; Vector3 angle; Color color; double objLength; //Loading Model GameObjects: for (var i = 0; i < this.binaryTemp.objName_Model.Length; i++) { var modelObj = new GameObject_Model(); pos = new Vector3(binaryTemp.startPos_Model[i, 0], binaryTemp.startPos_Model[i, 1], binaryTemp.startPos_Model[i, 2]); length = new Vector3(binaryTemp.length_Model[i, 0], binaryTemp.length_Model[i, 1], binaryTemp.length_Model[i, 2]); angle = new Vector3(binaryTemp.angle_Model[i, 0], binaryTemp.angle_Model[i, 1], binaryTemp.angle_Model[i, 2]); color = new Color(binaryTemp.color_Model[i, 0], binaryTemp.color_Model[i, 1], binaryTemp.color_Model[i, 2], binaryTemp.color_Model[i, 3]); prefab = (GameObject)Resources.Load("prefabs/" + binaryTemp.objName_Model[i], typeof(GameObject)); objLength = binaryTemp.objLength_Model[i]; // Instantiate object if (prefab.name.Contains("window")) { gameObject = createObj.InstantiateGameObj(prefab, pos, true); } else { gameObject = createObj.InstantiateGameObj(prefab, pos, false); } // Setting objects data gameObject = createObj.GameObjSetting(gameObject, length, angle, color); // Adding the game object to modelObj modelObj.SetGameObject(gameObject, pos, length, angle, color, prefab.name, objLength); // Adding the game object to list of instantiated game objects InstantiatedGameObject._obj.SetInstantiatedModelObj(modelObj); } }
private void RealModel() { var createObj = new CreateGameObject(); var iteration = 0; GameObject instentiatedPrefab = null; string prefabName = null; while (iteration < startPosValues.Count) { var modelObj = new GameObject_Model(); // Creating an object if (objType_[iteration].CompareTo("Walls") == 0) { instentiatedPrefab = createObj.InstantiateGameObj(wallPrefab, startPosValues[iteration], false); prefabName = wallPrefab.name; } else if (objType_[iteration].CompareTo("Windows") == 0) { instentiatedPrefab = createObj.InstantiateGameObj(windowPrefab, startPosValues[iteration], true); prefabName = windowPrefab.name; } else if (objType_[iteration].CompareTo("Doors") == 0) { instentiatedPrefab = createObj.InstantiateGameObj(doorPrefab, startPosValues[iteration], false); prefabName = doorPrefab.name; } instentiatedPrefab = createObj.GameObjSetting(instentiatedPrefab, scalValues[iteration], rotationValues[iteration], color_[iteration]); // Adding the game object to modelObj modelObj.SetGameObject(instentiatedPrefab, startPosValues[iteration], scalValues[iteration], rotationValues[iteration], color_[iteration], prefabName, objectLength[iteration]); // Adding the game object to list of instantiated game objects InstantiatedGameObject._obj.SetInstantiatedModelObj(modelObj); iteration++; } }
private void InteriorObject(Vector3 point) { var createObj = new CreateGameObject(); point.y = 0.06f; var gameObject = createObj.InstantiateGameObj(selectedObject, point); gameObject.transform.eulerAngles = new Vector3(Interface._obj.GetAngle_InteriorObj(), 0, 0); if (Interface._obj.GetCameraMode_Ortho()) { gameObject.GetComponent <ObjectDrag>().enabled = true; } var interiorObj = new GameObject_Interior(); interiorObj.SetGameObject(gameObject, gameObject.transform.position, gameObject.transform.eulerAngles, selectedObject.name); InstantiatedGameObject._obj.AddGameObjectInterior(interiorObj); }
private void ModelObject(Vector3 point) { var createObj = new CreateGameObject(); point.y = 0.06f; var gameObject = createObj.InstantiateGameObj(selectedObject, point, true); gameObject = createObj.GameObjSetting(gameObject, new Vector3(0, 90, 50), new Vector3(0, 0, 0), Color.white); if (Interface._obj.GetCameraMode_Ortho()) { gameObject.GetComponent <ObjectDrag>().enabled = true; } var modelObj = new GameObject_Model(); modelObj.SetGameObject(gameObject, gameObject.transform.position, gameObject.transform.localScale, gameObject.transform.eulerAngles, Color.white, selectedObject.name, 50); InstantiatedGameObject._obj.AddGameObjectModel(modelObj); }