void DustSpawner() { //This function calls all the other functions to generate dust if (Random.Range(0, 1000) >= 900 && rb.velocity.x != 0 && PlayerInfo.isGrounded) { PlayerChecks.GenerateParticle(dust); } SpeedBackDust(); }
void SpeedBackDust() { currentVelocity = rb.velocity.x; float difference = currentVelocity - lastVelocity; if ((difference == -maxVelocityDifference || difference == maxVelocityDifference) && PlayerInfo.isGrounded) { PlayerChecks.GenerateParticle(dust); } lastVelocity = currentVelocity; }
public void CallDash(float xRaw, float yRaw) { if (xRaw == 0 && yRaw == 0) { DashMove(PlayerInfo.facing, yRaw); } else { DashMove(xRaw, yRaw); } PlayerChecks.GenerateParticle(dashParticles); }
void Update() { jumpTime += Time.fixedDeltaTime; if (Input.GetKeyDown(KeyCode.Space)) { jumpTime = 0; } if (jumpTime <= minJumpTime && PlayerInfo.isGrounded && PlayerInfo.canJump) { rb.velocity = new Vector2(rb.velocity.x, jumpForce); jumpTime = minJumpTime; PlayerChecks.GenerateParticle(particles); PlayerInfo.isJumping = true; } }