water
This commit is contained in:
parent
bcec1cf489
commit
b3ab81f7eb
@ -545,13 +545,12 @@ 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
|
||||
isDash: 0
|
||||
bonk: 2
|
||||
isInWater: 0
|
||||
dashForce: 1.2
|
||||
reflectForce: 2
|
||||
cymbalAudio: {fileID: 264629194984044240}
|
||||
grapplingGun: {fileID: 3465910379319867675}
|
||||
grapplingRope: {fileID: 7648135587659148198}
|
||||
|
@ -3845,6 +3845,10 @@ PrefabInstance:
|
||||
propertyPath: m_camera
|
||||
value:
|
||||
objectReference: {fileID: 519420031}
|
||||
- target: {fileID: 3893791749692807526, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
|
||||
propertyPath: Data
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: fec218a9d55267dedac6ebe31eab6dcd, type: 2}
|
||||
- target: {fileID: 3893791749692807526, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
|
||||
propertyPath: bonk
|
||||
value: 1.5
|
||||
|
@ -914,7 +914,7 @@ PrefabInstance:
|
||||
m_Modifications:
|
||||
- target: {fileID: 2527389465697474493, guid: ff99a7d0beeca415e911378b9b377de4, type: 3}
|
||||
propertyPath: showDropdown
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3422388587178177106, guid: ff99a7d0beeca415e911378b9b377de4, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ public class PlayerMovement : MonoBehaviour
|
||||
GameObject trumpetAnimationObject;
|
||||
bool trumpetActive = false;
|
||||
|
||||
//clarinet
|
||||
private float tempFallSpeed;
|
||||
|
||||
//Jump
|
||||
private bool _isJumpCut;
|
||||
@ -91,6 +93,7 @@ public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
SetGravityScale(Data.gravityScale);
|
||||
IsFacingRight = true;
|
||||
tempFallSpeed = Data.maxFallSpeed;
|
||||
}
|
||||
|
||||
void OnMove(InputValue value)
|
||||
@ -313,10 +316,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
//Caps maximum fall speed, so when falling over large distances we don't accelerate to insanely high speeds
|
||||
RB.velocity = new Vector2(RB.velocity.x, Mathf.Max(RB.velocity.y, -Data.maxFallSpeed));
|
||||
}
|
||||
/*else if (playerBehavior.isInWater)
|
||||
{
|
||||
SetGravityScale(0);
|
||||
}*/
|
||||
else
|
||||
{
|
||||
//Default gravity if standing on a platform or moving upwards
|
||||
@ -563,6 +562,16 @@ public class PlayerMovement : MonoBehaviour
|
||||
// print(Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
|
||||
return (Physics2D.OverlapBox(new Vector2(this.transform.position.x, this.transform.position.y - _groundCheckOffset), _groundCheckSize, 0, _groundLayer) && !IsJumping);
|
||||
}
|
||||
|
||||
public void FloatGravity()
|
||||
{
|
||||
Data.maxFallSpeed = 0.1f;
|
||||
}
|
||||
|
||||
public void EndFloatGravity()
|
||||
{
|
||||
Data.maxFallSpeed = tempFallSpeed;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user