COYOTE TIME WORKS

coyote time mf
This commit is contained in:
Sam 2023-05-05 20:52:28 -07:00
parent 7ecafe5fb2
commit 89ae237941
3 changed files with 11 additions and 19 deletions

View File

@ -39,7 +39,7 @@ AnimatorStateMachine:
m_Position: {x: 310, y: 140, z: 0}
- serializedVersion: 1
m_State: {fileID: -2702980334803414039}
m_Position: {x: 352.6087, y: 244.65216, z: 0}
m_Position: {x: 350, y: 240, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
@ -117,7 +117,7 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer

View File

@ -152,7 +152,7 @@ public class PlayerMovement : MonoBehaviour
LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
if (unlockedTrumpet)
{
trumpet = 2;
trumpet = 1;
gameUI.ToggleTrumpet(true);
}
else
@ -218,6 +218,7 @@ public class PlayerMovement : MonoBehaviour
_isJumpFalling = false;
}
//Jump
if (CanJump() && LastPressedJumpTime > 0)
{
@ -225,10 +226,14 @@ public class PlayerMovement : MonoBehaviour
IsWallJumping = false;
_isJumpCut = false;
_isJumpFalling = false;
bool inCoyoteTime = LastOnGroundTime > 0;
print("coyote time: " + inCoyoteTime);
Jump();
// determine if trumpet jump
if (!IsGrounded() && in_range && trumpet > 0)
if (!IsGrounded() && in_range && trumpet > 0 && !inCoyoteTime)
{
StartCoroutine(ActivateTrumpetSprite());
gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play();
@ -236,7 +241,7 @@ public class PlayerMovement : MonoBehaviour
enemy = null;
in_range = false;
}
else if (!IsGrounded() && !in_range && trumpet > 0)
else if (!IsGrounded() && !in_range && trumpet > 0 && !inCoyoteTime)
{
trumpet -= 1;
}
@ -255,19 +260,6 @@ public class PlayerMovement : MonoBehaviour
audioSource.Stop();
soundPlaying = false;
}
//WALL JUMP
// else if (CanWallJump() && LastPressedJumpTime > 0)
// {
// IsWallJumping = true;
// IsJumping = false;
// _isJumpCut = false;
// _isJumpFalling = false;
// _wallJumpStartTime = Time.time;
// _lastWallJumpDir = (LastOnWallRightTime > 0) ? -1 : 1;
//
// WallJump(_lastWallJumpDir);
// }
#endregion
#region GRAPPLE CHECKS

View File

@ -40,5 +40,5 @@ MonoBehaviour:
doTurnOnWallJump: 0
slideSpeed: 0
slideAccel: 0
coyoteTime: 0.1
coyoteTime: 0.2
jumpInputBufferTime: 0.1