void CheckTrigger() { if (touchPos.x < 0) { if (Input.GetMouseButtonDown(0)) { Ray ray = cameraForShooter.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { ShotBall sb = hit.collider.transform.GetComponent <ShotBall>(); if (sb != null && !sb.isActive) { sb.ChangeActive(); touchPos = Input.mousePosition; shotPower = 0.0f; } } } } else { if (touchPos.x != Input.mousePosition.x || touchPos.y != Input.mousePosition.y) { touchPos.x = -1.0f; startTime = Time.time; state = ShotState.DirectionAndPower; } } }
private void Start() { m_BallRigidbody = GetComponent <Rigidbody>(); m_CheckMove = GetComponent <CheckMove>(); m_ShotBall = GetComponent <ShotBall>(); m_Drag = m_BallRigidbody.drag; m_CurrentTime = m_Time; }