Exemple #1
0
    //---------------------------------------------------------------------------------- -
    private void DisableButtStomp()
    {
        //  Calculate the distance the buttstomp went  //
        float buttStompDistance = m_buttStompStartHeight - transform.position.y;

        //  Spawn FX  //
        SpawnEffect(FXType.Buttstomp);

        //  Play audio  //
        m_audioPlayer.pitch = Random.Range(0.8f, 1.2f);
        m_audioPlayer.PlayOneShot(AudioLibrary.Get().buttStompHit01);

        //  Disable the attack from doing damage  //
        m_buttStompAttacker.DisableAttack();

        //  Apply Controller Vibration  //
        SetControllerVibration(1f, 1f);

        //  Disable Animation  //
        m_animator.SetTrigger("ButtstompEnd");
        m_animator.SetBool("ButtStomping", false);
        allowNegativeScaling = true;

        //  Apply a recoil  //
        float recoilForce = 40f;

        recoilForce += buttStompDistance * 1f;          //TODO: Figure out a good math function for this
        m_rigidbody.AddForce(Vector3.up * recoilForce, ForceMode.Impulse);

        //  Apply a speed boost  //
        //EnableSpeedBoost(buttStompDistance / 60f);    //TODO: Figure out a good math function for this
        EnableSpeedBoost(0.1f);

        //  Apply gameplay bools  //
        m_movementController.SetGrounded(true);
        m_downBoostAvailable = true;

        //  Mark the completion of the action  //
        m_buttStomping       = false;
        m_buttStompInitiated = false;
    }