Sup.
Basiclly im trying to change 2 bool variables (inAMiddOfABoost, finishedBoost) through a function, and im setting them to true, and they still stay false. Maybe it has to do with the fact that this class extends the other one, but I dont remember that it has to do something with it. Thanks for helping.
public void Boost(bool boosting, float boostSpd, float boostTime, bool inAMiddOfABoost, bool finishedBoost)
{
//cooldown starts
if (waitBoostClock < boostCooldownTime)
{
//cooldown
waitBoostClock += Time.deltaTime;
}
else
{
//if player hitting boost button
if (boosting)
{
//letting know PlayerMovement that the player is boosting
finishedBoost = false;
inAMiddOfABoost = true;
boostTimer += Time.deltaTime;
//Limit the boost for time
if (boostTimer < boostTime && waitBoostClock >= boostCooldownTime)
//if player looking left, boosting left
if (!m_FacingRight)
{
Vector3 targetVelocity = new Vector2(boostSpd * -1, m_Rigidbody2D.velocity.y);
//boost gravity
m_Rigidbody2D.gravityScale = 12;
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
}
//if player idle of looking right, booting right
else
{
Vector3 targetVelocity = new Vector2(boostSpd * 1, m_Rigidbody2D.velocity.y);
m_Rigidbody2D.gravityScale = 12;
m_Rigidbody2D.velocity = Vector3.SmoothDamp(m_Rigidbody2D.velocity, targetVelocity, ref m_Velocity, m_MovementSmoothing);
}
//leaving boost
else if (boostTimer >= boostTime)
{
//boost cooldown time **need to add to PlayerMovement
waitBoostClock = 0;
boostTimer = 0;
//letting know PlayerMovement that the player isn't moving
finishedBoost = true;
inAMiddOfABoost = false;
//reseting to normal gravity
m_Rigidbody2D.gravityScale = 8;
}