// TODO future - distance we get from RayCast, has to be scaled by the coeff. which is used in Canvas public void SetLine(float angle, float length) { m_RectTransform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); m_VecSize.y = length / GUILogic.GetScale(); m_RectTransform.sizeDelta = m_VecSize; }
// allow to launch ball if: // finger is outside the ball // we initially clicked on the ball // I assume that exit/enter happens before up/end void TryToLaunchOrCancelBall() { if (m_BallUp && m_TouchEnd) { // cancel if (m_BallEnter) { // Debug.LogError("Cancel strike"); } //strike else { m_Dir.x = m_Ball.m_RectTransform.position.x - m_CurrTouchPos.x; m_Dir.y = m_Ball.m_RectTransform.position.y - m_CurrTouchPos.y; // m_StrikeMagnitude = Mathf.Clamp(dir.magnitude, c_StrikeMagnitudeMin, c_StrikeMagnitudeMax); m_Ball.Strike(m_Dir.normalized, m_StrikeMagnitudeMax * GUILogic.GetScale()); } ResetKeys(); } // Debug.Log("m_BallDown " + m_BallDown); // Debug.Log("m_TouchBegin " + m_TouchBegin); // Debug.Log("m_BallEnter " + m_BallEnter); // Debug.Log("m_BallUp " + m_BallUp); // Debug.Log("m_TouchEnd " + m_TouchEnd); }
// TODO future - distance we get from RayCast, has to be scaled by the coeff. which is used in Canvas void SetLineLength(float length) { m_VecSize.y = length / GUILogic.GetScale(); m_RectTransform.sizeDelta = m_VecSize; }