Exemple #1
0
    public void FireBoost()
    {
        // SFX
        FindObjectOfType <AudioManager>().Stop("Charge");
        FindObjectOfType <AudioManager>().Play("Boost");

        //set boost direction
        m_move = m_controls.GetMove();
        if (m_move.x == 0 && m_move.y == 0)
        {
            Debug.Log(m_DirectionSelected);
            m_Direction = m_DirectionSelected;
        }
        else
        {
            m_Direction = new Vector3(m_move.x, m_move.y, 0.0f);
            m_Direction.Normalize();
            m_DirectionSelected = m_Direction;
        }

        //If the player boost knockback duration has ended.
        float maxForce = 0;

        if (boostBigHitTesting == false)
        {
            maxForce = m_PlayerStats.m_boost.MaxForce;
        }
        //if (m_TimeCharging >= m_PlayerStats.m_boost.timeToMaxCharge)
        if (m_BoostCollider.fullyCharged)
        {
            // set the position of the players boost collider;
            m_BoostCollider.setCollider(m_Direction, Quaternion.LookRotation(transform.forward, new Vector3(m_Direction.x, m_Direction.y, 0.0f)));
        }
        else
        {
            m_BoostCollider.BoostEnded();
        }



        //Adding boost velocity.
        m_RigidBody.AddForce(m_BoostForce * m_Direction, ForceMode.Impulse);

        //reset and modify variables
        m_PlayerStats.CanBoost = false;

        //Debug.Log("Boost fired!");


        //Log Boosts
        l_boosts++;
    }
Exemple #2
0
 public bool BoostDuration()
 {
     if (m_controls.GetBoost(BUTTON_DETECTION.GET_BUTTON_DOWN))
     {
         m_RigidBody.velocity = m_RigidBody.velocity.normalized * 15;
         m_BoostCollider.BoostEnded();
         return(false);
     }
     if (m_BoostDuration > 0) //&& m_PlayerStats.GetBoostState() == true)
     {
         m_BoostDuration -= Time.deltaTime;
         return(false);
     }
     //If the boost has recharged.
     BoostDurationEnd();
     return(true);
 }