fuckin with water
This commit is contained in:
parent
06ae0ab9c2
commit
af754415ea
@ -912,6 +912,10 @@ PrefabInstance:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 2527389465697474493, guid: ff99a7d0beeca415e911378b9b377de4, type: 3}
|
||||||
|
propertyPath: showDropdown
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3422388587178177106, guid: ff99a7d0beeca415e911378b9b377de4, type: 3}
|
- target: {fileID: 3422388587178177106, guid: ff99a7d0beeca415e911378b9b377de4, type: 3}
|
||||||
propertyPath: m_Pivot.x
|
propertyPath: m_Pivot.x
|
||||||
value: 0
|
value: 0
|
||||||
|
@ -23,11 +23,13 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
public float bonk = 2f;
|
public float bonk = 2f;
|
||||||
private Vector2 saveVelocity;
|
private Vector2 saveVelocity;
|
||||||
public bool isInWater = false;
|
public bool isInWater = false;
|
||||||
|
//dont know if gravity matters
|
||||||
public float dashForce = 1.2f;
|
public float dashForce = 1.2f;
|
||||||
private float dashTime = 1.0f;
|
private float dashTime = 1.0f;
|
||||||
private float dashInc = 0.1f;
|
private float dashInc = 0.1f;
|
||||||
private float currentDash = 0.0f;
|
private float currentDash = 0.0f;
|
||||||
Vector2 dashVec;
|
Vector2 dashVec;
|
||||||
|
private bool lowSpeed = false;
|
||||||
|
|
||||||
[Header("Grappling:")]
|
[Header("Grappling:")]
|
||||||
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
[SerializeField] public Tutorial_GrapplingGun grapplingGun;
|
||||||
@ -126,6 +128,11 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
dashVec = Vector2.zero;
|
dashVec = Vector2.zero;
|
||||||
playerInput.ActivateInput();
|
playerInput.ActivateInput();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentDash = 0.0f;
|
||||||
|
dashVec = Vector2.zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,21 +238,27 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
|
|
||||||
void Bounce()
|
void Bounce()
|
||||||
{
|
{
|
||||||
if(isDash)
|
Vector2 reflect;
|
||||||
|
if(lowSpeed)
|
||||||
{
|
{
|
||||||
Vector2 reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
|
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);
|
_rb.AddForce(reflect, ForceMode2D.Impulse);
|
||||||
reflect = Vector2.zero;
|
reflect = Vector2.zero;
|
||||||
}
|
isDash = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Water()
|
void Water()
|
||||||
{
|
{
|
||||||
if(Mathf.Abs(_rb.velocity.y) < 2f)
|
if (Mathf.Abs(_rb.velocity.y) < 2f)
|
||||||
{
|
{
|
||||||
|
lowSpeed = true;
|
||||||
saveVelocity = Vector2.zero;
|
saveVelocity = Vector2.zero;
|
||||||
isInWater = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -276,6 +289,7 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else if (col.tag == "water")
|
else if (col.tag == "water")
|
||||||
{
|
{
|
||||||
|
isInWater = true;
|
||||||
Water();
|
Water();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,6 +308,8 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
else if (col.tag == "water")
|
else if (col.tag == "water")
|
||||||
{
|
{
|
||||||
isInWater = false;
|
isInWater = false;
|
||||||
|
isDash = false;
|
||||||
|
playerInput.ActivateInput();
|
||||||
saveVelocity = Vector2.zero;
|
saveVelocity = Vector2.zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -342,6 +358,7 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
audioSource.clip = deathSound;
|
audioSource.clip = deathSound;
|
||||||
audioSource.loop = false;
|
audioSource.loop = false;
|
||||||
audioSource.Play();
|
audioSource.Play();
|
||||||
|
playerInput.ActivateInput();
|
||||||
|
|
||||||
// animate
|
// animate
|
||||||
animator.Play("Die");
|
animator.Play("Die");
|
||||||
|
Loading…
Reference in New Issue
Block a user