Weapon Switch

This commit is contained in:
Noah4ever
2021-11-16 17:50:32 +01:00
parent 7299b292a7
commit facc42b03f
12 changed files with 633 additions and 1583 deletions

View File

@@ -8,7 +8,6 @@ using Mirror;
public class DebugCanvas : MonoBehaviour
{
public TextMeshProUGUI DebugTextGrounded;
public TextMeshProUGUI DebugTextAmmunition;
public TextMeshProUGUI DebugTextClientServer;
public GameObject Player;
public GameObject GameManager;
@@ -37,8 +36,6 @@ public class DebugCanvas : MonoBehaviour
else
{
DebugTextGrounded.text = "isGrounded: " + Player.GetComponent<PlayerController>().isGrounded.ToString();
DebugTextAmmunition.text = Player.GetComponent<Shoot>().CurAmmo.ToString() + " / " + Player.GetComponent<Shoot>().TotalAmmo.ToString();
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
float fps = 1.0f / deltaTime;
fpsText.text = Mathf.Ceil(fps).ToString() + "FPS";

View File

@@ -47,7 +47,7 @@ public class Shoot : NetworkBehaviour
if (Input.GetButtonDown("Fire")) {
updateCanvas = true;
Debug.Log(" click");
if (weapon.AllowAction)
if (weapon.AllowAction && weapon.CurrentAmmunition > 0)
{
shootAnim.Recoil(0.1f);
}