public void BottomTest() { var bottom = new Botton(); Assert.AreEqual(-(1 / 3), bottom.Charge); Assert.AreEqual(0, bottom.Strangeness); }
private void Update() { //生成光标射线并处理botton 的接收信息 Physics.Raycast(Camera.main.ScreenPointToRay(eyeCamera.WorldToScreenPoint(cursorParent.position)), out cursorRaycastHit, setting.the可视距离, 1 << LayerMask.NameToLayer("Objects")); Ray temp = Camera.main.ScreenPointToRay(eyeCamera.WorldToScreenPoint(cursorParent.position)); Debug.DrawRay(temp.origin, temp.direction); Botton newActiveBotton = cursorRaycastHit.collider == null ? null : cursorRaycastHit.collider.GetComponent <Botton>(); if (newActiveBotton != currentActiveBotton) { if (currentActiveBotton != null) { currentActiveBotton.OnCursorExit(); } currentActiveBotton = newActiveBotton; if (currentActiveBotton != null) { currentActiveBotton.OnCursorEnter(); } } if (currentActiveBotton != null) { currentActiveBotton.OnCursorOver(); } }
// Update is called once per frame void Update() { ScriptB = GameObject.Find("Botton (1)").GetComponent <Botton>(); if (ScriptB.Activado == true) { if (this.transform.position.y >= PosicionFinal.y) { transform.position -= transform.up * velocidad * Time.deltaTime; } //transform.position -= transform.right * velocidad * Time.deltaTime; } }