Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
    void SpeedBackDust()
    {
        currentVelocity = rb.velocity.x;
        float difference = currentVelocity - lastVelocity;

        if ((difference == -maxVelocityDifference || difference == maxVelocityDifference) && PlayerInfo.isGrounded)
        {
            PlayerChecks.GenerateParticle(dust);
        }
        lastVelocity = currentVelocity;
    }
Exemplo n.º 3
0
 public void CallDash(float xRaw, float yRaw)
 {
     if (xRaw == 0 && yRaw == 0)
     {
         DashMove(PlayerInfo.facing, yRaw);
     }
     else
     {
         DashMove(xRaw, yRaw);
     }
     PlayerChecks.GenerateParticle(dashParticles);
 }
Exemplo n.º 4
0
    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;
        }
    }