Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a3552eac81
@ -23,11 +23,13 @@ public class PlayerBehavior : MonoBehaviour
|
||||
public float bonk = 2f;
|
||||
private Vector2 saveVelocity;
|
||||
public bool isInWater = false;
|
||||
//dont know if gravity matters
|
||||
public float dashForce = 1.2f;
|
||||
private float dashTime = 1.0f;
|
||||
private float dashInc = 0.1f;
|
||||
private float currentDash = 0.0f;
|
||||
Vector2 dashVec;
|
||||
private bool lowSpeed = false;
|
||||
|
||||
[Header("Grappling:")]
|
||||
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||
@ -126,6 +128,11 @@ public class PlayerBehavior : MonoBehaviour
|
||||
dashVec = Vector2.zero;
|
||||
playerInput.ActivateInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDash = 0.0f;
|
||||
dashVec = Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,21 +238,27 @@ public class PlayerBehavior : MonoBehaviour
|
||||
|
||||
void Bounce()
|
||||
{
|
||||
if(isDash)
|
||||
Vector2 reflect;
|
||||
if(lowSpeed)
|
||||
{
|
||||
Vector2 reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
|
||||
_rb.AddForce(reflect, ForceMode2D.Impulse);
|
||||
reflect = Vector2.zero;
|
||||
reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * 0.75f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
|
||||
}
|
||||
//reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
|
||||
_rb.AddForce(reflect, ForceMode2D.Impulse);
|
||||
reflect = Vector2.zero;
|
||||
isDash = false;
|
||||
}
|
||||
|
||||
void Water()
|
||||
{
|
||||
if(Mathf.Abs(_rb.velocity.y) < 2f)
|
||||
if (Mathf.Abs(_rb.velocity.y) < 2f)
|
||||
{
|
||||
lowSpeed = true;
|
||||
saveVelocity = Vector2.zero;
|
||||
isInWater = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -276,6 +289,7 @@ public class PlayerBehavior : MonoBehaviour
|
||||
}
|
||||
else if (col.tag == "water")
|
||||
{
|
||||
isInWater = true;
|
||||
Water();
|
||||
}
|
||||
}
|
||||
@ -294,6 +308,8 @@ public class PlayerBehavior : MonoBehaviour
|
||||
else if (col.tag == "water")
|
||||
{
|
||||
isInWater = false;
|
||||
isDash = false;
|
||||
playerInput.ActivateInput();
|
||||
saveVelocity = Vector2.zero;
|
||||
}
|
||||
}
|
||||
@ -342,6 +358,7 @@ public class PlayerBehavior : MonoBehaviour
|
||||
audioSource.clip = deathSound;
|
||||
audioSource.loop = false;
|
||||
audioSource.Play();
|
||||
playerInput.ActivateInput();
|
||||
|
||||
// animate
|
||||
animator.Play("Die");
|
||||
|
Loading…
Reference in New Issue
Block a user