using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Globalization; public class BlocResize : MonoBehaviour { //public ConstructBloc CB; public void resize() { GameObject bloc = GameObject.Find(SceneModeManager.SelectedName).gameObject; int objectnum = int.Parse(SceneModeManager.SelectedName.Substring(4, 1)); float w = DOIT.ConvertStringToNumber(GameObject.Find("mW").gameObject.GetComponent().text); float h = DOIT.ConvertStringToNumber(GameObject.Find("mH").gameObject.GetComponent().text); float d = DOIT.ConvertStringToNumber(GameObject.Find("mD").gameObject.GetComponent().text); bloc.transform.localScale = new Vector3(w , h , d ); //Scale texture float swh = 0; if (_G.OBJs[objectnum][8].Substring(0, 1) == "f") { swh = 48; } if (_G.OBJs[objectnum][8].Substring(0, 1) == "w") { swh = 48; } if (_G.OBJs[objectnum][8].Substring(0, 1) == "c") { swh = 24; } if (_G.OBJs[objectnum][8].Substring(0, 1) == "g") { swh = 12; } if (_G.OBJs[objectnum][8].Substring(0, 1) == "s") { swh = 36; } bloc.transform.Find("top").gameObject.GetComponent().material.mainTextureScale = new Vector2(w/swh, d/ swh); bloc.transform.Find("front").gameObject.GetComponent().material.mainTextureScale = new Vector2(w / swh, h / swh); bloc.transform.Find("left").gameObject.GetComponent().material.mainTextureScale = new Vector2(d / swh, h / swh); bloc.transform.Find("back").gameObject.GetComponent().material.mainTextureScale = new Vector2(w / swh, h / swh); bloc.transform.Find("right").gameObject.GetComponent().material.mainTextureScale = new Vector2(d / swh, h / swh); bloc.transform.Find("under").gameObject.GetComponent().material.mainTextureScale = new Vector2(w / swh, d / swh); _G.OBJs[objectnum][6] = w.ToString(CultureInfo.InvariantCulture); _G.OBJs[objectnum][7] = h.ToString(CultureInfo.InvariantCulture); _G.OBJs[objectnum][8] = d.ToString(CultureInfo.InvariantCulture); } }