Дополнен 3 года назад
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.UI;
// Ammo checker
public class Ammo
{
public static Text AmmoGui;
public static int GunAmmo;
public static int MaxAmmo;
public static int AllAmmo;
public static float ReloadingTime;
public static string GunName;
public static void Stats(int Ammo, int MAmmo, int AAmmo, float RTime, string Name)
{
GunAmmo = Ammo;
MaxAmmo = MAmmo;
AllAmmo = AAmmo;
ReloadingTime = RTime;
GunName = Name;
}
public static void CheckStats()
{
AmmoGui.text = $"{GunName}\n{GunAmmo}/{AllAmmo}";
}
}
//Main
public class GunManager : MonoBehaviour
{
public GameObject SmallGun;
public GameObject BigGun;
public Text GunStats;
public static bool Reloading;
public void Shoot(int Ammo,int AllAmmo, int MaxAmmo)
{
if(Ammo != 0 && AllAmmo != 0)
{
Ammo--;
}
if(Ammo == 0)
{
StartCoroutine("Reload");
}
Ammo.
}
}