You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
715 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Autohand {
[RequireComponent(typeof(Grabbable))]
public class AutoAmmo : MonoBehaviour {
public int currentAmmo = 16;
public TMPro.TextMeshPro ammoText;
private void Start() {
SetAmmo(currentAmmo);
}
public bool RemoveAmmo() {
if(currentAmmo > 0) {
SetAmmo(--currentAmmo);
return true;
}
return false;
}
public void SetAmmo(int amount) {
currentAmmo = amount;
if(ammoText != null)
ammoText.text = currentAmmo.ToString();
}
}
}