Exemplo n.º 1
0
        public IEnumerator OnAmmoPickedUpEvent_AmmoDisposed_DontRefillAmmo()
        {
            SetupAmmoPickups();

            const int maxAmmo        = 30;
            const int maxAmmoPerClip = 10;
            var       ammo           = new Ammo(maxAmmo, maxAmmoPerClip);

            ammo.ReduceCurrentAmmo(maxAmmoPerClip);
            ammo.Reload();
            var reloadedCurrentAmmo = ammo.CurrentAmmo;

            Assert.AreEqual(maxAmmo - maxAmmoPerClip, ammo.CurrentMaxAmmo);
            Assert.AreEqual(maxAmmoPerClip, reloadedCurrentAmmo);

            ammo.Dispose();

            yield return(new WaitForFixedUpdate());

            Assert.AreEqual(maxAmmo - maxAmmoPerClip, ammo.CurrentMaxAmmo);
            Assert.AreEqual(maxAmmoPerClip, reloadedCurrentAmmo);
        }