1234567891011121314151617181920212223242526272829303132 |
- using UnityEngine;
- using System.Collections;
- public class AmmoWeapon : Weapon
- {
- public int ammo;
- private int _ammoLeft;
- public override void Arm()
- {
- base.Arm();
- _ammoLeft = ammo;
- NotificationCenter.Post(NotificationType.UpdateWeaponUpgradeAmmoLeft, _ammoLeft);
- }
- public override PoolObject Fire()
- {
- AVDebug.Assert(_ammoLeft > 0, "No ammo left in "+type+" but still trying to fire. Incosistent behaviour");
- --_ammoLeft;
- NotificationCenter.Post(NotificationType.UpdateWeaponUpgradeAmmoLeft, _ammoLeft);
- return base.Fire();
- }
- public override bool IsEmpty
- {
- get
- {
- return _ammoLeft <= 0;
- }
- }
- }
|