fixed footsteps
also @bryanna i moved the grapple poles in the village so they can be reached without the trumpet jump
This commit is contained in:
@@ -90,18 +90,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
} else {
|
||||
this._moveInput = Vector2.zero;
|
||||
}
|
||||
|
||||
if (!IsJumping && !_isJumpFalling && !isRegFalling && value.Get<Vector2>().x != 0) {
|
||||
if (!soundPlaying) {
|
||||
print("footsteps PLAY");
|
||||
audioSource.Play();
|
||||
soundPlaying = true;
|
||||
}
|
||||
} else if (audioSource.isPlaying && audioSource.clip.name == "footsteps") {
|
||||
print("footsteps stop");
|
||||
audioSource.Stop();
|
||||
soundPlaying = false;
|
||||
}
|
||||
}
|
||||
|
||||
void OnJump()
|
||||
@@ -227,6 +215,14 @@ public class PlayerMovement : MonoBehaviour
|
||||
gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play();
|
||||
}
|
||||
}
|
||||
|
||||
// stop sound if needed
|
||||
if (soundPlaying && (isRegFalling || IsJumping || _isJumpFalling)) {
|
||||
print("footsteps stop");
|
||||
audioSource.Stop();
|
||||
soundPlaying = false;
|
||||
}
|
||||
|
||||
//WALL JUMP
|
||||
// else if (CanWallJump() && LastPressedJumpTime > 0)
|
||||
// {
|
||||
@@ -292,6 +288,20 @@ public class PlayerMovement : MonoBehaviour
|
||||
SetGravityScale(Data.gravityScale);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SOUND CHECKS
|
||||
if (!IsJumping && !_isJumpFalling && !isRegFalling && _moveInput.x != 0) {
|
||||
if (!soundPlaying) {
|
||||
// print("footsteps PLAY");
|
||||
audioSource.Play();
|
||||
soundPlaying = true;
|
||||
}
|
||||
} else if (soundPlaying && audioSource.clip.name == "footsteps") {
|
||||
// print("footsteps stop");
|
||||
audioSource.Stop();
|
||||
soundPlaying = false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
@@ -380,15 +390,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
//Convert this to a vector and apply to rigidbody
|
||||
RB.AddForce(movement * Vector2.right, ForceMode2D.Force);
|
||||
|
||||
// play sound
|
||||
// if (!IsJumping && movement != 0) {
|
||||
// if (!audioSource.isPlaying) {
|
||||
// audioSource.Play();
|
||||
// }
|
||||
// } else if (audioSource.isPlaying && audioSource.clip.name == "footsteps") {
|
||||
// audioSource.Stop();
|
||||
// }
|
||||
|
||||
/*
|
||||
* For those interested here is what AddForce() will do
|
||||
* RB.velocity = new Vector2(RB.velocity.x + (Time.fixedDeltaTime * speedDif * accelRate) / RB.mass, RB.velocity.y);
|
||||
|
||||
Reference in New Issue
Block a user