fuckin with water
This commit is contained in:
parent
06ae0ab9c2
commit
af754415ea
@ -912,6 +912,10 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2527389465697474493, guid: ff99a7d0beeca415e911378b9b377de4, type: 3}
|
||||
propertyPath: showDropdown
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3422388587178177106, guid: ff99a7d0beeca415e911378b9b377de4, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0
|
||||
|
@ -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