ugh
This commit is contained in:
		@@ -21,9 +21,10 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
    [Header("Clarinet:")]
 | 
			
		||||
    bool unlockedClarinet;
 | 
			
		||||
    [SerializeField] private float dashMult = 2;
 | 
			
		||||
    [SerializeField] private float maxDashTime = 1.0f;
 | 
			
		||||
    [SerializeField] private float maxDashTime = 10.0f;
 | 
			
		||||
    [SerializeField] private float dashStopSpeed = 0.1f;
 | 
			
		||||
    private float currentDashTime;
 | 
			
		||||
    public bool isDash = false;
 | 
			
		||||
 | 
			
		||||
    [Header("Grappling:")]
 | 
			
		||||
    [SerializeField] public Tutorial_GrapplingGun grapplingGun;
 | 
			
		||||
@@ -98,19 +99,24 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
        {
 | 
			
		||||
            if (playerInput.actions["ClarinetDive"].WasPressedThisFrame())
 | 
			
		||||
            {
 | 
			
		||||
                isDash = true;
 | 
			
		||||
                currentDashTime = 0.0f;
 | 
			
		||||
            }
 | 
			
		||||
            if (!playerController.IsGrounded())
 | 
			
		||||
            {
 | 
			
		||||
                Vector3 dashSpeed = new Vector3(1f,1f,1f) * dashMult;
 | 
			
		||||
                if (currentDashTime < maxDashTime)
 | 
			
		||||
                {
 | 
			
		||||
                    Vector2 dashSpeed = new Vector2(1f,1f) * dashMult;
 | 
			
		||||
                    if (currentDashTime < maxDashTime)
 | 
			
		||||
                    {
 | 
			
		||||
                        _rb.AddForce(dashSpeed, ForceMode2D.Force);
 | 
			
		||||
                        currentDashTime += dashStopSpeed;
 | 
			
		||||
                        print("cdt " + currentDashTime);
 | 
			
		||||
                    }
 | 
			
		||||
                    // print("Clarinet pressed!");
 | 
			
		||||
                    _rb.AddForce(dashSpeed, ForceMode2D.Force);
 | 
			
		||||
                    currentDashTime += dashStopSpeed;
 | 
			
		||||
                    print("cdt " + currentDashTime);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    isDash = false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else{isDash = false;}
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,9 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
    bool wasGrappling = false;
 | 
			
		||||
    bool unlockedTrumpet;
 | 
			
		||||
 | 
			
		||||
    //clarinet
 | 
			
		||||
    public bool isDashing = false;
 | 
			
		||||
 | 
			
		||||
    //Set all of these up in the inspector
 | 
			
		||||
    [Header("Checks")]
 | 
			
		||||
    //Size of groundCheck depends on the size of your character generally you want them slightly small than width (for ground) and height (for the wall check)
 | 
			
		||||
@@ -88,7 +91,7 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    void OnMove(InputValue value)
 | 
			
		||||
    {
 | 
			
		||||
        if (playerBehavior.playerIsAlive) {
 | 
			
		||||
        if (playerBehavior.playerIsAlive && !isDashing) {
 | 
			
		||||
            this._moveInput = value.Get<Vector2>();
 | 
			
		||||
        } else {
 | 
			
		||||
            this._moveInput = Vector2.zero;
 | 
			
		||||
@@ -97,13 +100,15 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    void OnJump()
 | 
			
		||||
    {
 | 
			
		||||
        if (playerBehavior.playerIsAlive) {
 | 
			
		||||
        if (playerBehavior.playerIsAlive && !isDashing) {
 | 
			
		||||
            OnJumpInput();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void Update()
 | 
			
		||||
    {
 | 
			
		||||
        isDashing = playerBehavior.isDash;
 | 
			
		||||
        if(!isDashing){
 | 
			
		||||
        unlockedTrumpet = stateController.unlockedTrumpet;
 | 
			
		||||
        #region TIMERS
 | 
			
		||||
        LastOnGroundTime -= Time.deltaTime;
 | 
			
		||||
@@ -313,10 +318,12 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
            gameUI.ToggleTrumpet(false);
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void FixedUpdate()
 | 
			
		||||
    {
 | 
			
		||||
        if(!isDashing){
 | 
			
		||||
        //Handle Run
 | 
			
		||||
        if (IsWallJumping)
 | 
			
		||||
            Run(Data.wallJumpRunLerp);
 | 
			
		||||
@@ -326,6 +333,7 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
        //Handle Slide
 | 
			
		||||
        if (IsSliding)
 | 
			
		||||
            Slide();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #region INPUT CALLBACKS
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user