Pauser Added + Fixed Bug

TODO: Stop Animations when Paused
This commit is contained in:
2022-02-26 19:53:47 +03:00
parent 33f81e5a1c
commit caab797e6d
10 changed files with 297 additions and 3 deletions

View File

@@ -102,6 +102,9 @@ namespace Player
private void FixedUpdate()
{
if (IsPaused)
return;
//Took from tutorial : https://www.youtube.com/watch?v=7KiK0Aqtmzc
switch (_playerRigidbody2D.velocity.y)
{
@@ -136,6 +139,9 @@ namespace Player
private void Update()
{
if (IsPaused)
return;
_isOnAir = !_playerGroundTrigger.IsCollided;
RespawnCheck();
@@ -156,13 +162,13 @@ namespace Player
public void Pause()
{
IsPaused = true;
_playerRigidbody2D.simulated = IsPaused;
_playerRigidbody2D.simulated = !IsPaused;
}
public void Resume()
{
IsPaused = false;
_playerRigidbody2D.simulated = IsPaused;
_playerRigidbody2D.simulated = !IsPaused;
}
// MOVE METHODS
@@ -292,5 +298,9 @@ namespace Player
}
public void Clop() => clop.PlayClop();
public void OnPause(InputAction.CallbackContext context)
{
}
}
}