working on fixing clarinet
it's all about the parameters now!
This commit is contained in:
parent
257613a4e9
commit
d703883d94
@ -545,12 +545,14 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: b0115312556794123a3cafad4b83d0a7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Data: {fileID: 11400000, guid: fec218a9d55267dedac6ebe31eab6dcd, type: 2}
|
||||
playerInput: {fileID: 1407172087}
|
||||
launcher: {fileID: 6559806128767475056}
|
||||
hasTambourine: 1
|
||||
dashForce: 1.2
|
||||
dashForce: 50
|
||||
dashTime: 1
|
||||
reflectForce: 2
|
||||
waterGravity: 0.5
|
||||
velocityCut: 1.5
|
||||
cymbalAudio: {fileID: 264629194984044240}
|
||||
grapplingGun: {fileID: 3465910379319867675}
|
||||
grapplingRope: {fileID: 7648135587659148198}
|
||||
|
@ -21,10 +21,11 @@ public class PlayerBehavior : MonoBehaviour
|
||||
bool unlockedClarinet;
|
||||
// things for dash
|
||||
private bool isDash = false;
|
||||
public float dashForce = 1.3f;
|
||||
private float dashTime = 1.0f;
|
||||
public float dashForce = 1f;
|
||||
public float dashTime = 1.0f;
|
||||
private float dashInc = 0.1f;
|
||||
private float currentDash = 0.0f;
|
||||
private bool forceAdded = false;
|
||||
Vector2 dashVec;
|
||||
// things for bounce
|
||||
public float reflectForce = 1.1f;
|
||||
@ -32,6 +33,7 @@ public class PlayerBehavior : MonoBehaviour
|
||||
private bool isInWater = false;
|
||||
private bool hasBounced = false;
|
||||
public float waterGravity = 0.5f;
|
||||
public float velocityCut = 1f;
|
||||
|
||||
[Header("Cymbals:")]
|
||||
private float cymbalActiveTime = 0f;
|
||||
@ -77,6 +79,8 @@ public class PlayerBehavior : MonoBehaviour
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (playerIsAlive)
|
||||
{
|
||||
if (this.cymbalActiveTime < 0)
|
||||
{
|
||||
@ -84,10 +88,8 @@ public class PlayerBehavior : MonoBehaviour
|
||||
}
|
||||
this.cymbalActiveTime -= Time.deltaTime;
|
||||
|
||||
unlockedTambourine = StateController.Instance.HasTambourine();
|
||||
if (playerIsAlive)
|
||||
{
|
||||
// throw tambourine
|
||||
unlockedTambourine = StateController.Instance.HasTambourine();
|
||||
if (playerInput.actions["ThrowTambourine"].WasPressedThisFrame())
|
||||
{
|
||||
ThrowTambourine();
|
||||
@ -104,42 +106,42 @@ public class PlayerBehavior : MonoBehaviour
|
||||
LetGoOfGrapple();
|
||||
}
|
||||
|
||||
Animate();
|
||||
}
|
||||
|
||||
// clarinet
|
||||
unlockedClarinet = StateController.Instance.HasClarinet();
|
||||
if (playerIsAlive && unlockedClarinet)
|
||||
if (unlockedClarinet)
|
||||
{
|
||||
if (playerInput.actions["ClarinetDive"].WasPressedThisFrame() && !isInWater)
|
||||
if (playerInput.actions["ClarinetDive"].WasPressedThisFrame() && !isInWater && !playerController.IsGrounded())
|
||||
{
|
||||
isDash = true;
|
||||
playerInput.DeactivateInput();
|
||||
currentDash = 0.0f;
|
||||
}
|
||||
|
||||
if (!playerController.IsGrounded() && isDash && (currentDash < dashTime))
|
||||
{
|
||||
if (forward == 1)
|
||||
{
|
||||
dashVec = new Vector2(1f, -1f) * dashForce;
|
||||
if (!forceAdded) {
|
||||
dashVec = new Vector2(1f * forward, -1f) * dashForce;
|
||||
_rb.AddForce(dashVec, ForceMode2D.Impulse);
|
||||
forceAdded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashVec = new Vector2(-1f, -1f) * dashForce;
|
||||
_rb.AddForce(dashVec, ForceMode2D.Impulse);
|
||||
}
|
||||
currentDash += dashInc;
|
||||
}
|
||||
else if ((currentDash == dashTime || currentDash > dashTime) && !isInWater)
|
||||
|
||||
currentDash += Time.deltaTime;
|
||||
}
|
||||
else if ((currentDash >= dashTime)) // dash ends
|
||||
{
|
||||
if (!isInWater) {
|
||||
isDash = false;
|
||||
currentDash = 0.0f;
|
||||
forceAdded = false;
|
||||
_rb.AddForce(-(dashVec), ForceMode2D.Impulse);
|
||||
dashVec = Vector2.zero;
|
||||
playerInput.ActivateInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDash = 0.0f;
|
||||
dashVec = Vector2.zero;
|
||||
}
|
||||
else {
|
||||
isDash = false;
|
||||
forceAdded = false;
|
||||
playerInput.ActivateInput();
|
||||
currentDash = 0.0f;
|
||||
dashVec = Vector2.zero;
|
||||
}
|
||||
@ -160,6 +162,9 @@ public class PlayerBehavior : MonoBehaviour
|
||||
this.cymbalActiveTime = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Animate();
|
||||
}
|
||||
}
|
||||
|
||||
void Animate()
|
||||
@ -201,13 +206,6 @@ public class PlayerBehavior : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
void FlipScale()
|
||||
{ // DOENST WORK RIGHT (that's so sad for you)
|
||||
Vector3 currentScale = this.gameObject.transform.localScale;
|
||||
currentScale.x *= -1;
|
||||
this.gameObject.transform.localScale = currentScale;
|
||||
}
|
||||
|
||||
void FlipRenderer()
|
||||
{
|
||||
GetComponent<SpriteRenderer>().flipX = !GetComponent<SpriteRenderer>().flipX;
|
||||
@ -285,7 +283,11 @@ public class PlayerBehavior : MonoBehaviour
|
||||
print("water dash " + isDash);
|
||||
if(isDash)
|
||||
{
|
||||
saveVelocity = _rb.velocity;
|
||||
saveVelocity = _rb.velocity / velocityCut;
|
||||
if (isDash) {
|
||||
dashVec = new Vector2(1f * forward, -1f) * (dashForce / velocityCut);
|
||||
_rb.AddForce(dashVec, ForceMode2D.Force);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user