void Start() { gameObject.tag = "GameController"; GravityController = transform.GetChild(1).transform.GetComponent <GravityControllerScript>(); FreezeCarsor = transform.GetChild(2).transform.GetComponent <FreezeCarsorScript>(); uIController = FreezeCarsor.transform.root.GetChild(0).GetComponent <UIController>(); if (GameObject.FindWithTag("AllScene")) { sceneManagerScript = GameObject.FindWithTag("AllScene").GetComponent <SceneManagerScript>(); SetHidetime = sceneManagerScript.GethideUItime(); } }
void Start() { float worldScreenHeight = Camera.main.orthographicSize * 2f; gravityController = transform.root.GetChild(1).GetComponent <GravityControllerScript>(); //UI_NowRotframe UI_NowRotframe = transform.GetChild(0).GetComponent <RectTransform>(); UI_NowRotframe.sizeDelta = new Vector2(worldScreenHeight * RotFrame_size, RotFrame_size * 4); UI_NowRotframe.localPosition += new Vector3(-UI_NowRotframe.rect.width * 0.5f, -UI_NowRotframe.rect.height * 0.5f); //UI_MoveRotframe UI_MoveRotframe = transform.GetChild(1).GetComponent <RectTransform>(); UI_MoveRotframe.sizeDelta = UI_NowRotframe.sizeDelta; UI_MoveRotframe.localPosition = UI_NowRotframe.localPosition + new Vector3(-UI_NowRotframe.rect.width, 0);//new Vector3(0, -UI_NowRotframe.rect.height * 0.5f) + new Vector3(0, -UI_MoveRotframe.rect.height * 0.5f); //UI_NowRotText UI_NowRotText = transform.GetChild(0).GetChild(0).GetComponent <Text>(); UI_NowRotText.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(UI_NowRotframe.rect.width, UI_NowRotframe.rect.height); //UI_MoveRotText UI_MoveRotText = transform.GetChild(1).GetChild(0).GetComponent <Text>(); UI_MoveRotText.gameObject.GetComponent <RectTransform>().sizeDelta = UI_MoveRotframe.sizeDelta; //Ice/Unzipアイコン左下端 Icon_Unzip.sizeDelta *= BidIconMagnification; Icon_Ice.transform.localPosition += new Vector3(Icon_Ice.rect.width * 0.5f, Icon_Ice.rect.height * 0.5f); Icon_Unzip.transform.localPosition += new Vector3(Icon_Unzip.rect.width * 0.5f, Icon_Unzip.rect.height * 1.5f); //RotIcon //LRボタン位置(RotIconに付随して動くため、RotIconを移動させること) var roll0 = Icon_Rot.GetChild(0).GetComponent <RectTransform>(); var roll1 = Icon_R.GetChild(0).GetComponent <RectTransform>(); var roll2 = Icon_L.GetChild(0).GetComponent <RectTransform>(); var roll3 = Icon_X.GetChild(0).GetComponent <RectTransform>(); var roll4 = Icon_Y.GetChild(0).GetComponent <RectTransform>(); var rotwidth = UI_NowRotframe.sizeDelta.x; roll0.sizeDelta = Icon_R.sizeDelta = Icon_L.sizeDelta = Icon_X.sizeDelta = Icon_Y.sizeDelta = roll1.sizeDelta = roll2.sizeDelta = roll3.sizeDelta = roll4.sizeDelta = Icon_Rot.sizeDelta = new Vector2(rotwidth, rotwidth) * 0.4f; Icon_Rot.transform.localPosition = Vector3.zero; Icon_Rot.transform.localPosition += new Vector3(-rotwidth * 0.5f, rotwidth * 0.5f); Icon_R.transform.localPosition = Icon_Rot.transform.localPosition + new Vector3(rotwidth * 0.2f, rotwidth * 0.3f, 0); Icon_L.transform.localPosition = Icon_Rot.transform.localPosition + new Vector3(-rotwidth * 0.2f, rotwidth * 0.3f, 0); Icon_X.transform.localPosition = Icon_Rot.transform.localPosition + new Vector3(rotwidth * 0.2f, -rotwidth * 0.3f, 0); Icon_Y.transform.localPosition = Icon_Rot.transform.localPosition + new Vector3(-rotwidth * 0.2f, -rotwidth * 0.3f, 0); //rollArrow調整用 Icon_X_Arrow = Icon_X.GetChild(0).GetComponent <Image>(); Icon_Y_Arrow = Icon_Y.GetChild(0).GetComponent <Image>(); Icon_rotImage = Icon_Rot.transform.GetChild(0).GetComponent <Image>(); //Arrow positon Icon_Arrow.sizeDelta = Icon_Rot.sizeDelta * 2; arrowimage = Icon_Arrow.transform.GetComponent <Image>(); arrowimage.sprite = arrow; Icon_Arrow.transform.localPosition += new Vector3(Icon_Arrow.rect.width * 0.5f, 0, 0); arrowimage.color = Color.red; //Icon_Frask Icon_Frask_Rendrer = Icon_Frask.gameObject.GetComponent <Image>(); Icon_Frask_Rendrer.sprite = Icon_Unzip_Frask; Icon_Frask.sizeDelta = Icon_Arrow.sizeDelta * 0.5f; Icon_Frask.transform.localPosition = Icon_Arrow.localPosition + new Vector3(-rotwidth, rotwidth) * 0.2f; //Icon_Lst Icon_Lst.transform.localPosition = Icon_Arrow.localPosition; Icon_Lst.sizeDelta = Icon_Arrow.sizeDelta * 0.5f; //hideUIpos showUIpos = new Vector2[] { UI_NowRotframe.transform.localPosition, UI_MoveRotframe.localPosition, Icon_Ice.localPosition, Icon_Unzip.localPosition, Icon_Rot.parent.localPosition, Icon_Arrow.parent.localPosition }; hideUIpos = new Vector2[] { UI_NowRotframe.transform.localPosition + new Vector3(0, UI_NowRotframe.rect.height), UI_MoveRotframe.localPosition + new Vector3(UI_MoveRotframe.rect.width, 0), Icon_Ice.localPosition + new Vector3(-Icon_Ice.rect.width - Icon_A.rect.width * 0.5f, 0), Icon_Unzip.localPosition + new Vector3(-Icon_Unzip.rect.width - Icon_B.rect.width * 0.5f, 0), Icon_Rot.parent.localPosition + new Vector3(rotwidth, 0), Icon_Arrow.parent.localPosition + new Vector3(-Icon_Arrow.rect.width, 0) }; hideUIgroup = new RectTransform[] { UI_NowRotframe, UI_MoveRotframe, Icon_Ice, Icon_Unzip, Icon_Rot.parent.GetComponent <RectTransform>(), Icon_Arrow.parent.GetComponent <RectTransform>() }; aud = gameObject.AddComponent <AudioSource>(); aud.volume = PlayerPrefs.GetFloat("BGM"); aud.loop = false; aud.playOnAwake = false; }