moved trumpet jump to new player controller
this should work, though i'm still not 100% sure how the new jump works
This commit is contained in:
parent
01ebd18f5b
commit
716036bc1f
@ -101,7 +101,7 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
if (!IsJumping)
|
if (!IsJumping)
|
||||||
{
|
{
|
||||||
//Ground Check
|
//Ground Check
|
||||||
if (Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping) //checks if set box overlaps with ground
|
if (IsGrounded()) //checks if set box overlaps with ground
|
||||||
{
|
{
|
||||||
LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
|
LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
|
||||||
trumpet = true;
|
trumpet = true;
|
||||||
@ -151,6 +151,13 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
_isJumpCut = false;
|
_isJumpCut = false;
|
||||||
_isJumpFalling = false;
|
_isJumpFalling = false;
|
||||||
Jump();
|
Jump();
|
||||||
|
if (!IsGrounded() && in_range && trumpet) {
|
||||||
|
Destroy(enemy.gameObject);
|
||||||
|
enemy = null;
|
||||||
|
in_range = false;
|
||||||
|
} else if (!IsGrounded() && !in_range && trumpet) {
|
||||||
|
trumpet = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//WALL JUMP
|
//WALL JUMP
|
||||||
// else if (CanWallJump() && LastPressedJumpTime > 0)
|
// else if (CanWallJump() && LastPressedJumpTime > 0)
|
||||||
@ -209,6 +216,7 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
SetGravityScale(Data.gravityScale);
|
SetGravityScale(Data.gravityScale);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
@ -380,6 +388,9 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
private bool CanJump()
|
private bool CanJump()
|
||||||
{
|
{
|
||||||
|
if (!IsGrounded() && trumpet) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return LastOnGroundTime > 0 && !IsJumping;
|
return LastOnGroundTime > 0 && !IsJumping;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,6 +417,10 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsGrounded() {
|
||||||
|
return (Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user