private void ApplyVerticalPhysics(float verticalIn) { //to fastfall, player must be in the air and not holding "Jump" if (fastFallEnabled && (verticalIn < 0) && !onGroundCanJump && jumpDownTrueUntil < Time.time) { playerRB.AddForce(Vector2.down * fastFallForce * (-verticalIn), ForceMode2D.Force); gameMasterPattern.SpawnPixels(playerRB.position, Vector2.up, 2f, 2); } }
private void FixedUpdate() { if (Time.time > boostDownTrueUntil) //Check if the boost button cooldown has expired. If so, reset it. { boostDownTrueUntil = -1f; } else if (boostReady && boostEnabled) { ApplyBoost(); gameMasterPattern.SpawnPixels(playerRB.position, Vector2.down, 2f, 15); } }
public void Explode() { if (!exploded) { exploded = true; explodeFX.Play(); gameMasterPattern.SpawnPixels(playerRB.position, Vector2.up, 10f, 35); playerCollider.enabled = false; playerRenderer.enabled = false; playerRB.velocity = Vector3.zero; playerRB.gravityScale = 0f; playerRB.mass = 999999999; } }