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);
        }
    }
Пример #2
0
    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);
        }
    }
Пример #3
0
    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);
    }
    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++;
        }
    }