public void switchControlType() { if (currentControlType == CONTROL_TYPE.SIDE_SCROLL) { currentControlType = CONTROL_TYPE.FIRST_PERSON; mouseRotation.rotateAroundYAxis = true; } else { currentControlType = CONTROL_TYPE.SIDE_SCROLL; mouseRotation.rotateAroundYAxis = false; } }
public void SetType(CONTROL_TYPE type) { if (type == curType) { return; } curType = type; switch (curType) { case CONTROL_TYPE.STORY: _agent.isStopped = true; break; case CONTROL_TYPE.COMMON: break; } }
public Control(ControlProperty resource) : this() { m_rectBounds = new Rectangle(resource.m_rectBounds.Left + ResManager.Instance.DefaultWindowLocation.X, resource.m_rectBounds.Top + ResManager.Instance.DefaultWindowLocation.Y, resource.m_rectBounds.Width, resource.m_rectBounds.Height); m_szID = resource.m_szID; m_bEnabled = (resource.m_bDisabled == 0); m_szTooltip = resource.m_szTooltip; m_szCaption = resource.m_szTitle; m_bShowCaption = resource.m_style.HasFlag(WindowStyle.WBS_CAPTION); m_visibility = VISIBLITY_TYPE.Visible; m_type = (CONTROL_TYPE)System.Enum.Parse(typeof(CONTROL_TYPE), resource.m_szType); /* if (resource.visible == 0) m_visibility = VISIBLITY_TYPE.Visible; else m_visibility = VISIBLITY_TYPE.Hidden; */ }
public void UpdateMovement() { if (rb.velocity.y >= maxYSpeed && maxYSpeed != -1) { rb.velocity = new Vector3(rb.velocity.x, maxYSpeed, rb.velocity.z); } switch (ballState) { case STATE.PRE_START: break; case STATE.EMERGING: if (transform.position.z > 2.5f) { transform.Translate(-Vector3.forward * ballEmergeSpeed); } else { SetBallState(STATE.IN_PLAY); } break; case STATE.IN_PLAY: //mouse /*if (Input.GetMouseButton(0)) * { * intendedBallPosition = Camera.main.ScreenPointToRay(Input.mousePosition).GetPoint(-Camera.main.transform.position.z + transform.position.z); * ballOffset = intendedBallPosition.x - transform.position.x; * if (ballOffset > 0.1f) * rb.velocity = new Vector3(xSpeed, rb.velocity.y, rb.velocity.z); * else if (ballOffset < -0.1f) * rb.velocity = new Vector3(-xSpeed, rb.velocity.y, rb.velocity.z); * else * rb.velocity = new Vector3(0f, rb.velocity.y, rb.velocity.z); * } * else * { * rb.velocity = new Vector3(0f, rb.velocity.y, rb.velocity.z); * }*/ #if UNITY_EDITOR // arrow keys if (Input.GetAxis("Horizontal") > 0f) { rb.velocity = new Vector3(xSpeed, rb.velocity.y, rb.velocity.z); } else if (Input.GetAxis("Horizontal") < 0f) { rb.velocity = new Vector3(-xSpeed, rb.velocity.y, rb.velocity.z); } else { rb.velocity = new Vector3(0f, rb.velocity.y, rb.velocity.z); } #else //gyro if (PlayerPrefs.GetString("Control Type", "ROLL") == "ROLL") { controlType = CONTROL_TYPE.ROLL; } else if (PlayerPrefs.GetString("Control Type", "ROLL") == "TILT") { controlType = CONTROL_TYPE.TILT; } switch (controlType) { case CONTROL_TYPE.ROLL: rb.velocity = new Vector3(xSpeed * Input.gyro.rotationRateUnbiased.y, rb.velocity.y, rb.velocity.z); break; case CONTROL_TYPE.TILT: rb.velocity = new Vector3(xSpeed * -Input.gyro.rotationRateUnbiased.z, rb.velocity.y, rb.velocity.z); break; default: break; } #endif break; default: break; } }