player can only access items in correct scenes

This commit is contained in:
Sam
2023-05-01 01:52:42 -07:00
parent d3893d3f0e
commit 932af31dc9
12 changed files with 406 additions and 22 deletions

View File

@@ -47,6 +47,7 @@ public class PlayerMovement : MonoBehaviour
Tutorial_GrapplingRope grapplingRope;
bool wasGrappling = false;
bool unlockedTrumpet;
//Set all of these up in the inspector
[Header("Checks")]
@@ -60,6 +61,7 @@ public class PlayerMovement : MonoBehaviour
[SerializeField] private LayerMask _groundLayer;
[HideInInspector] private PlayerBehavior playerBehavior;
[HideInInspector] private StateController stateController;
#endregion
private void Awake()
@@ -67,7 +69,7 @@ public class PlayerMovement : MonoBehaviour
RB = GetComponent<Rigidbody2D>();
playerBehavior = this.gameObject.GetComponent<PlayerBehavior>();
grapplingRope = playerBehavior.grapplingRope;
stateController = GameObject.FindGameObjectWithTag("StateController").GetComponent<StateController>();
}
private void Start()
@@ -94,6 +96,7 @@ public class PlayerMovement : MonoBehaviour
private void Update()
{
unlockedTrumpet = stateController.unlockedTrumpet;
#region TIMERS
LastOnGroundTime -= Time.deltaTime;
LastOnWallTime -= Time.deltaTime;
@@ -125,7 +128,11 @@ public class PlayerMovement : MonoBehaviour
if (IsGrounded()) //checks if set box overlaps with ground
{
LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
trumpet = 2;
if (unlockedTrumpet) {
trumpet = 2;
} else {
trumpet = 0;
}
wasGrappling = false;
}