public void Start() { animator = GetComponent <Animator>(); roadTool = GetComponent <RoadTool>(); buildingTool = GetComponent <BuildingTool>(); moveUI = GetComponent <MoveUI>(); tileHighlighter = GetComponent <TileHighlighter>(); Menus = new GameObject[] { buildingMenu, mainMenu, buildMenu }; foreach (CompoundButton menuButton in buildMenuButtons) { menuButton.OnButtonClicked += BuildMenuButtonPressed; } foreach (CompoundButton menuButton in mainMenuButtons) { menuButton.OnButtonClicked += MainMenuButtonPressed; } foreach (CompoundButton timeButton in timeButtons) { timeButton.OnButtonClicked += TimeButtonPressed; } }
void Awake() { if (MoveUI.transition_UI == null) transition_UI = this; else { // There's another moveUI, destroy this one Destroy(this.transform.parent.gameObject); } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
public static MoveUI PlayerForDTO(Move move) { MoveUI result = new MoveUI(); result.Name = move.Name; result.Color = move.Color; result.Queen = move.Queen; result.Border = move.Border; result.doubleWay = move.doubleWay; result.goldWay = move.goldWay; return(result); }
void Awake() { if (MoveUI.transition_UI == null) { transition_UI = this; movement_direction = new Vector3(20, 0, 0); } else { // There's another moveUI, destroy this one Destroy(this.transform.parent.gameObject); } }
public void Init(TurnOptionsUI turnOptions, MoveUI move) { this.turnOptions = turnOptions; this.move = move; this.slots = new GameObject[] { slot1, slot2, slot3, slot4, slot5, slot6, slot7, slot8 }; }
// Use this for initialization void Start() { instance = GameManager.instance; moveUI = FindObjectOfType <MoveUI>(); }
private void Awake() { _alphaText = feedbackText.GetComponent <AlphaText>(); _moveUI = feedbackText.GetComponent <MoveUI>(); _cam = Camera.main; }
// Update is called once per frame void Update() { #region//点击,允许双手 if (position.LS == 3 || position.RS == 3) { NohandClick.DoClick(); } #endregion #region//双手向上,唤起菜单 if (position.LS == 2 && position.RS == 2) { duration += 0.015f; if (duration <= 1.2f) { image.fillAmount = duration <= 1 ? duration : 1f; } else { image.fillAmount = 0f; ControlCenter.menu(); duration = 0f; } } else { duration = 0f; image.fillAmount = duration; } #endregion #region//左手抓住,拖动菜单 //Debug.Log(position.LS+" "+ position.RS+ selected.name); if (position.LS == 1 && position.RS == 0 && selected != null) { Vector3 UIposition = new Vector3( Hands.Hands.L.transform.position.x * 3f, Hands.Hands.L.transform.position.y * 5f - 4f > 1.3f ? Hands.Hands.L.transform.position.y * 5f - 4f : 1.3f, Hands.Hands.L.transform.position.z * 4f - 1.5f); MoveUI.SetTo(UIposition, Camera.main.transform.rotation.eulerAngles.x, Camera.main.transform.rotation.eulerAngles.y); } #endregion #region//左手向上,展示商品,旋转 if (position.LS == 2 && !showingL && ControlCenter.objectExistActive("good_clone/loadedgood")) { shration += 0.015f; if (shration <= 1.2f) { imageL.fillAmount = shration <= 1 ? shration : 1f; } else { imageL.fillAmount = 0f; if (showL == null) { //复制模型到左手上,注意要给showL赋值 showL = Instantiate(GameObject.Find("good_clone/loadedgood")); showL.name = "loadedgood"; float x = showL.GetComponentInChildren <Renderer>().bounds.size.x; float y = showL.GetComponentInChildren <Renderer>().bounds.size.y; float z = showL.GetComponentInChildren <Renderer>().bounds.size.z; float largest = x > y ? x > z ? x : z : y; float resize = largest / 0.1f;//要把单轴尺寸最大值变为0.1 float lx = showL.transform.localScale.x; float ly = showL.transform.localScale.y; float lz = showL.transform.localScale.z; showL.transform.localPosition = new Vector3(0f, 0f, 0f); Quaternion q = new Quaternion(); q.eulerAngles.Set(0f, 0f, 0f); showL.transform.localRotation = q; showL.transform.localScale = new Vector3(lx / resize, ly / resize, lz / resize); Vector3 positionL = new Vector3( Hands.Hands.L.transform.position.x, Hands.Hands.L.transform.position.y + 0.2f, Hands.Hands.L.transform.position.z); showL.transform.position = positionL;//设置复制的模型位置 } if (position.RS == 1) { if (positionR.Equals(new Vector3())) { positionR = Hands.Hands.R.transform.position; } Vector3 nowpositionR = Hands.Hands.R.transform.position; Vector3 nowrotation = showL.transform.localRotation.eulerAngles; nowrotation.x += nowpositionR.x - positionR.x;//每帧都会按照变化旋转,可能需要常数来调整速度,可能需要修改 nowrotation.y += nowpositionR.z - positionR.z; nowrotation.z += nowpositionR.y - positionR.y; showL.transform.localRotation = Quaternion.Euler(nowrotation);//设置旋转 } else { positionR = new Vector3(); } } } else { shration = 0f; imageL.fillAmount = shration; if (showL != null) { Destroy(showL); } } #endregion #region//双手抓住,缩放 if (position.LS == 1 && position.RS == 1 && ControlCenter.objectExistActive("good_clone/loadedgood")) { if (stdistance == 0f) { stdistance = Mathf.Sqrt( Mathf.Pow(Hands.Hands.L.transform.position.x - Hands.Hands.R.transform.position.x, 2f) + Mathf.Pow(Hands.Hands.L.transform.position.y - Hands.Hands.R.transform.position.y, 2f) + Mathf.Pow(Hands.Hands.L.transform.position.z - Hands.Hands.R.transform.position.z, 2f)); stsize = GameObject.Find("good_clone/loadedgood").transform.localScale; } float nowdistance = Mathf.Sqrt( Mathf.Pow(Hands.Hands.L.transform.position.x - Hands.Hands.R.transform.position.x, 2f) + Mathf.Pow(Hands.Hands.L.transform.position.y - Hands.Hands.R.transform.position.y, 2f) + Mathf.Pow(Hands.Hands.L.transform.position.z - Hands.Hands.R.transform.position.z, 2f)); float rate = nowdistance / stdistance * 0.5f;//变化相对原大小的比例,可能需要修改 Vector3 newsize = new Vector3(stsize.x * rate, stsize.y * rate, stsize.z * rate); GameObject.Find("good_clone/loadedgood").transform.localScale = newsize; } else { stdistance = 0f; } #endregion }
private void Start() { m_Audio = GetComponent <AudioSource>(); m_Animator = GetComponent <MoveUI>(); }