Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using Sirenix.OdinInspector;
- using UnityEngine;
- [System.Serializable, HideLabel]
- public class GunClip
- {
- [SuffixLabel("Second(s)", Overlay = true)]
- public float reloadLength;
- [ShowInInspector, ReadOnly]
- internal float reloadTime
- {
- get;
- private set;
- }
- internal int ammoLeft
- {
- get { return _ammoCurrent; }
- private set { _ammoCurrent = value; }
- }
- internal int ammoMax
- {
- get { return _ammoMax; }
- set { _ammoMax = value; }
- }
- [ShowInInspector]
- internal int _ammoCurrent = 3;
- internal int _ammoMax = 3;
- internal void ReduceClip(int i)
- {
- ammoLeft -= i;
- }
- internal IEnumerator IsReloading()
- {
- reloadTime = 0;
- while (reloadTime < reloadLength)
- {
- reloadTime += Time.deltaTime;
- yield return null;
- }
- _ammoCurrent = _ammoMax;
- yield return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement