示例#1
0
    void StrikeBall()
    {
        Vector3 newVelocity = Vector3.zero;

        ApplyDirection(m_ballTransform.position, out newVelocity);

        if (m_controller.IsSmashTriggered())
        {
            ApplySmashVelocity(m_ballMover.GetVelocity(), ref newVelocity);
            m_ballMover.SetSmashVelocity(newVelocity);
            m_controller.ConsumeSmash();
            m_ballSfx.clip = m_sfxSmash;
            m_gfxAnimator.SetBool("isSmashing", true);
            GetComponent <AudioSource>().Play();
            m_gameSequencer.SetSmashAction(true);
            Camera.main.GetComponent <ScreenShake>().ShakeCameraForSeconds(0.1f, 0.2f);
        }
        else
        {
            ApplyVelocity(m_ballMover.GetVelocity(), ref newVelocity);
            m_ballMover.SetVelocity(newVelocity);
            m_controller.AddSmashCharge();
            m_gameSequencer.SetSmashAction(false);
        }
        m_ballSfx.clip  = m_sfxHit;
        m_ballSfx.pitch = 1 + Mathf.Round(Random.Range(-0.1f, 0.1f) * 100.0f) / 100.0f;
        m_ballSfx.Play();
    }
示例#2
0
 void Engage()
 {
     m_isSmashAction = false;
     m_ball.Init();
     m_leftPad.GetComponent <IController>().InitPoint();
     m_rightPad.GetComponent <IController>().InitPoint();
     m_ball.SetVelocity(m_engagmentDirection * m_gameManager.InitialBallSpeed);
     Debug.Log("Engagement Done By Game Sequencer");
 }