for sammy <3
This commit is contained in:
		@@ -24,6 +24,10 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
    private Vector2 saveVelocity;
 | 
					    private Vector2 saveVelocity;
 | 
				
			||||||
    public bool isInWater = false;
 | 
					    public bool isInWater = false;
 | 
				
			||||||
    public float dashForce = 1.2f;
 | 
					    public float dashForce = 1.2f;
 | 
				
			||||||
 | 
					    private float dashTime = 1.0f;
 | 
				
			||||||
 | 
					    private float dashInc = 0.1f;
 | 
				
			||||||
 | 
					    private float currentDash = 0.0f;
 | 
				
			||||||
 | 
					    Vector2 dashVec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Header("Grappling:")]
 | 
					    [Header("Grappling:")]
 | 
				
			||||||
    [SerializeField] public Tutorial_GrapplingGun grapplingGun;
 | 
					    [SerializeField] public Tutorial_GrapplingGun grapplingGun;
 | 
				
			||||||
@@ -61,6 +65,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
    void Start()
 | 
					    void Start()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        gameUI.UpdateInstrumentUI();
 | 
					        gameUI.UpdateInstrumentUI();
 | 
				
			||||||
 | 
					        currentDash = dashTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void Update()
 | 
					    void Update()
 | 
				
			||||||
@@ -95,25 +100,30 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                isDash = true;
 | 
					                isDash = true;
 | 
				
			||||||
                playerInput.DeactivateInput();
 | 
					                playerInput.DeactivateInput();
 | 
				
			||||||
 | 
					                currentDash = 0.0f;
 | 
				
			||||||
                // set so if in water dash will still be true
 | 
					                // set so if in water dash will still be true
 | 
				
			||||||
                // otherwise turn dash off 
 | 
					                // otherwise turn dash off 
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (!playerController.IsGrounded() && isDash)
 | 
					            if (!playerController.IsGrounded() && isDash && (currentDash < dashTime))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (forward == 1)
 | 
					                if (forward == 1)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Vector2 rightDash = new Vector2(1f, -1f) * dashForce;
 | 
					                    dashVec = new Vector2(1f, -1f) * dashForce;
 | 
				
			||||||
                    _rb.AddForce(rightDash, ForceMode2D.Impulse);
 | 
					                    _rb.AddForce(dashVec, ForceMode2D.Impulse);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Vector2 leftDash = new Vector2(-1f, -1f) * dashForce;
 | 
					                    dashVec = new Vector2(-1f, -1f) * dashForce;
 | 
				
			||||||
                    _rb.AddForce(leftDash, ForceMode2D.Impulse);
 | 
					                    _rb.AddForce(dashVec, ForceMode2D.Impulse);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                currentDash += dashInc;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else if (!isInWater)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                isDash = false;
 | 
					                isDash = false;
 | 
				
			||||||
 | 
					                currentDash = 0.0f;
 | 
				
			||||||
 | 
					                _rb.AddForce(-(dashVec), ForceMode2D.Impulse);
 | 
				
			||||||
 | 
					                dashVec = Vector2.zero;
 | 
				
			||||||
                playerInput.ActivateInput();
 | 
					                playerInput.ActivateInput();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -221,9 +231,13 @@ public class PlayerBehavior : MonoBehaviour
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    void Bounce()
 | 
					    void Bounce()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Vector2 reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
 | 
					        if(isDash)
 | 
				
			||||||
        _rb.AddForce(reflect, ForceMode2D.Impulse);
 | 
					        {
 | 
				
			||||||
        reflect = Vector2.zero;
 | 
					            Vector2 reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
 | 
				
			||||||
 | 
					            _rb.AddForce(reflect, ForceMode2D.Impulse);
 | 
				
			||||||
 | 
					            reflect = Vector2.zero;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void Water()
 | 
					    void Water()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user