private void prepareTheBall() { if (m_playerBall.GetComponent <Rigidbody>().IsSleeping() && m_CurrentMode == eStrokeMode.BallShot) { m_CurrentMode = eStrokeMode.ReadyToShoot; m_playerBall.UpdateLastPosition(); } }
private void When_ReadyToShot() { if (isClicked()) { m_3DArrow.Show(true); m_CurrentMode = eStrokeMode.Aiming; } }
private void When_Aiming() { if (isClicked()) { m_3DArrow.Show(false); m_CurrentMode = eStrokeMode.PickingStrength; m_StrengthPicker.gameObject.transform.parent.gameObject.SetActive(true); m_ShootAngle = m_3DArrow.transform.parent.transform.localEulerAngles; } }
void FixedUpdate() { if (m_IsReadyToShoot == true) { m_IsReadyToShoot = false; m_CurrentMode = eStrokeMode.BallShot; // shoot according to m_ShootFactor -> Vector3 forceVector = new Vector3(m_ShootFactor, 0, 0); m_playerBall.GetComponent <Rigidbody>().AddForce( Quaternion.Euler(0, m_ShootAngle.y - 90, 0) * forceVector, ForceMode.Impulse); m_AudioManager.Play("Swing"); m_NumberOfStrokes++; m_UIManager.UpdateCurrentScore(m_NumberOfStrokes); } }