Пример #1
0
        public void ReleaseIfClicked()
        {
            // foreach(Material m in currentPlaceableObject.GetComponentInChildren<MeshRenderer>().materials) {
            //         m.shader = Shader.Find("Standard (Specular setup)");
            // }
            currentPlaceableObject.GetComponent <Rigidbody>().isKinematic    = true;
            currentPlaceableObject.GetComponent <Rigidbody>().freezeRotation = true;
            currentPlaceableObject.GetComponent <Rigidbody>().constraints    = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
            currentPlaceableObject.transform.SetParent(terrain.transform);
            if (currentPlaceableObject.gameObject.name == "000ModernHouse(Clone)")
            {
                currentPlaceableObject.transform.position = new Vector3(currentPlaceableObject.transform.position.x, 0, currentPlaceableObject.transform.position.z);
            }
            float xPos = currentPlaceableObject.transform.position.x;
            float yPos = currentPlaceableObject.transform.position.y;
            float zPos = currentPlaceableObject.transform.position.z;
            float yRot = currentPlaceableObject.transform.eulerAngles.y;
            Dictionary <string, object> objectData = new Dictionary <string, object> {
                { "xPos", xPos },
                { "yPos", yPos },
                { "zPos", zPos },
                { "yRot", yRot },
                { "name", currentPlaceableObject.name }
            };

            target.gameObject.SetActive(true);
            target.GetComponent <CharacterScript>().SetMainCamEditing(target, false);
            currentPlaceableObject = null;
            uiManagerScript.PlacedItem();
            saveSystem.SaveSpace(objectData, target, int.Parse(myRoomID));
        }