water
This commit is contained in:
@@ -5,6 +5,8 @@ using UnityEngine.InputSystem;
|
||||
|
||||
public class PlayerBehavior : MonoBehaviour
|
||||
{
|
||||
public PlayerData Data;
|
||||
|
||||
[Header("Physics:")]
|
||||
private float _hInput;
|
||||
private Rigidbody2D _rb;
|
||||
@@ -20,7 +22,7 @@ public class PlayerBehavior : MonoBehaviour
|
||||
[Header("Clarinet:")]
|
||||
bool unlockedClarinet;
|
||||
// things for dash
|
||||
public bool isDash = false;
|
||||
private bool isDash = false;
|
||||
public float dashForce = 1.2f;
|
||||
private float dashTime = 1.0f;
|
||||
private float dashInc = 0.1f;
|
||||
@@ -29,8 +31,8 @@ public class PlayerBehavior : MonoBehaviour
|
||||
// things for bounce
|
||||
public float reflectForce = 2f;
|
||||
private Vector2 saveVelocity;
|
||||
public bool isInWater = false;
|
||||
private bool lowSpeed = false;
|
||||
private bool isInWater = false;
|
||||
private bool hasBounced = false;
|
||||
|
||||
[Header("Cymbals:")]
|
||||
private float cymbalActiveTime = 0f;
|
||||
@@ -109,7 +111,7 @@ public class PlayerBehavior : MonoBehaviour
|
||||
unlockedClarinet = StateController.Instance.HasClarinet();
|
||||
if (playerIsAlive && unlockedClarinet)
|
||||
{
|
||||
if (playerInput.actions["ClarinetDive"].WasPressedThisFrame())
|
||||
if (playerInput.actions["ClarinetDive"].WasPressedThisFrame() && !isInWater)
|
||||
{
|
||||
isDash = true;
|
||||
playerInput.DeactivateInput();
|
||||
@@ -262,30 +264,31 @@ public class PlayerBehavior : MonoBehaviour
|
||||
}
|
||||
|
||||
void Bounce()
|
||||
{/*
|
||||
{
|
||||
Vector2 reflect;
|
||||
if (Mathf.Abs(saveVelocity.y) < 1f)
|
||||
if (Mathf.Abs(saveVelocity.y) < 1f && hasBounced)
|
||||
{
|
||||
reflect = Vector2.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
reflect = new Vector2(saveVelocity.x, -(saveVelocity.y) * reflectForce);
|
||||
hasBounced = true;
|
||||
}
|
||||
_rb.AddForce(reflect, ForceMode2D.Impulse);
|
||||
reflect = Vector2.zero;
|
||||
isDash = false;*/
|
||||
isDash = false;
|
||||
}
|
||||
|
||||
void Water()
|
||||
{
|
||||
/*if(isDash)
|
||||
if(isDash)
|
||||
{
|
||||
saveVelocity = _rb.velocity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
playerController.FloatGravity();
|
||||
}
|
||||
/*
|
||||
if (Mathf.Abs(_rb.velocity.y) < 2f)
|
||||
@@ -363,7 +366,9 @@ public class PlayerBehavior : MonoBehaviour
|
||||
{
|
||||
isInWater = false;
|
||||
isDash = false;
|
||||
hasBounced = false;
|
||||
playerInput.ActivateInput();
|
||||
playerController.EndFloatGravity();
|
||||
saveVelocity = Vector2.zero;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user