ugh2
This commit is contained in:
		@@ -21,8 +21,8 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
    [Header("Clarinet:")]
 | 
			
		||||
    bool unlockedClarinet;
 | 
			
		||||
    [SerializeField] private float dashMult = 2;
 | 
			
		||||
    [SerializeField] private float maxDashTime = 10.0f;
 | 
			
		||||
    [SerializeField] private float dashStopSpeed = 0.1f;
 | 
			
		||||
    [SerializeField] private float maxDashTime = 5.0f;
 | 
			
		||||
    [SerializeField] private float dashStopSpeed = 0.01f;
 | 
			
		||||
    private float currentDashTime;
 | 
			
		||||
    public bool isDash = false;
 | 
			
		||||
 | 
			
		||||
@@ -101,22 +101,21 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
            {
 | 
			
		||||
                isDash = true;
 | 
			
		||||
                currentDashTime = 0.0f;
 | 
			
		||||
                playerInput.DeactivateInput();
 | 
			
		||||
            }
 | 
			
		||||
            if (!playerController.IsGrounded())
 | 
			
		||||
            if (!playerController.IsGrounded() && (currentDashTime < maxDashTime))
 | 
			
		||||
            {
 | 
			
		||||
                Vector3 dashSpeed = new Vector3(1f,1f,1f) * dashMult;
 | 
			
		||||
                if (currentDashTime < maxDashTime)
 | 
			
		||||
                {
 | 
			
		||||
                    _rb.AddForce(dashSpeed, ForceMode2D.Force);
 | 
			
		||||
                    currentDashTime += dashStopSpeed;
 | 
			
		||||
                    print("cdt " + currentDashTime);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    isDash = false;
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
                _rb.AddForce(dashSpeed, ForceMode2D.Force);
 | 
			
		||||
                currentDashTime += dashStopSpeed;
 | 
			
		||||
                print("cdt " + currentDashTime);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                isDash = false;
 | 
			
		||||
                playerInput.ActivateInput();
 | 
			
		||||
            }
 | 
			
		||||
            else{isDash = false;}
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -52,6 +52,9 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    //clarinet
 | 
			
		||||
    public bool isDashing = false;
 | 
			
		||||
    private float tempGrav;
 | 
			
		||||
    private float tempFall;
 | 
			
		||||
    private bool isFrozen = false;
 | 
			
		||||
 | 
			
		||||
    //Set all of these up in the inspector
 | 
			
		||||
    [Header("Checks")]
 | 
			
		||||
@@ -108,7 +111,19 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
    private void Update()
 | 
			
		||||
    {
 | 
			
		||||
        isDashing = playerBehavior.isDash;
 | 
			
		||||
        if(!isDashing){
 | 
			
		||||
        if(isDashing)
 | 
			
		||||
        {
 | 
			
		||||
            FreezeControl();
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
        
 | 
			
		||||
        if(isFrozen)
 | 
			
		||||
        {
 | 
			
		||||
            Data.gravityStrength = tempGrav;
 | 
			
		||||
            Data.fallGravityMult = tempFall;
 | 
			
		||||
            isFrozen = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        unlockedTrumpet = stateController.unlockedTrumpet;
 | 
			
		||||
        #region TIMERS
 | 
			
		||||
        LastOnGroundTime -= Time.deltaTime;
 | 
			
		||||
@@ -336,6 +351,20 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void FreezeControl()
 | 
			
		||||
    {
 | 
			
		||||
        if(!isFrozen)
 | 
			
		||||
        {
 | 
			
		||||
            tempGrav = Data.gravityStrength;
 | 
			
		||||
            tempFall = Data.fallGravityMult;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Data.gravityStrength = 0;
 | 
			
		||||
        Data.fallGravityMult = 0;
 | 
			
		||||
 | 
			
		||||
        isFrozen = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #region INPUT CALLBACKS
 | 
			
		||||
    //Methods which whandle input detected in Update()
 | 
			
		||||
    public void OnJumpInput()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user