From 89ae237941aa31b16c6f270672963e8a4883a29e Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 5 May 2023 20:52:28 -0700 Subject: [PATCH] COYOTE TIME WORKS coyote time mf --- .../Vulture/Vulture_walk_0.controller | 4 ++-- Assets/Scripts/PlayerController.cs | 24 +++++++------------ Assets/Scripts/PlayerMovementData.asset | 2 +- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Assets/Animations/Vulture/Vulture_walk_0.controller b/Assets/Animations/Vulture/Vulture_walk_0.controller index 6de6fe7..e805b53 100644 --- a/Assets/Animations/Vulture/Vulture_walk_0.controller +++ b/Assets/Animations/Vulture/Vulture_walk_0.controller @@ -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 diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 730a6e6..9e8b816 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -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().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 diff --git a/Assets/Scripts/PlayerMovementData.asset b/Assets/Scripts/PlayerMovementData.asset index dff0170..12dc177 100644 --- a/Assets/Scripts/PlayerMovementData.asset +++ b/Assets/Scripts/PlayerMovementData.asset @@ -40,5 +40,5 @@ MonoBehaviour: doTurnOnWallJump: 0 slideSpeed: 0 slideAccel: 0 - coyoteTime: 0.1 + coyoteTime: 0.2 jumpInputBufferTime: 0.1