Skip to content

Commit

Permalink
try fix gun
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed Jul 12, 2024
1 parent 5806127 commit 693662b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Assets/Scripts/Augment/GunController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ public void Initialize()
localGunZOffset = transform.localPosition.z;
}

public void Reset()
{
stats.Ammo = stats.MagazineSize;
isFiring = false;
}

private void OnDestroy()
{
if (!barrelAnimator)
Expand Down
10 changes: 6 additions & 4 deletions Assets/Scripts/Gamestate/PlayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ protected void TurnIntoRagdoll(DamageInfo info)
playerIK.enabled = false;
// TODO display guns falling to the floor
if (gunController)
gunController.gameObject.SetActive(false);
gunController.enabled = false;
GunHolder.gameObject.SetActive(false);

if (inputManager)
Expand Down Expand Up @@ -254,7 +254,11 @@ public virtual void Respawn(Transform spawnpoint)
healthController.enabled = true;
playerIK.enabled = true;
if (gunController)
gunController.gameObject.SetActive(true);
{
gunController.enabled = false;
gunController.Reset();
gunController.Reload(1);
}
GunHolder.gameObject.SetActive(true);

if (inputManager)
Expand Down Expand Up @@ -285,8 +289,6 @@ public virtual void Respawn(Transform spawnpoint)

hudController.DisplayHUD();

SetPlayerInput(inputManager);

StartCoroutine(SetTransformAfterRespawn(spawnpoint));
}

Expand Down

0 comments on commit 693662b

Please sign in to comment.