void OnEnable() { // get special weapon and total ammo, update with gun and current ammo _playerWeapons = GetComponentInParent <PlayerWeapons>(); _isGun = _playerWeapons.DetermineSpecialType(); if (_isGun) { _specialGun = _playerWeapons.weapons[PlayerWeapons.SPECIAL_WEAPON_SLOT].GetComponent <Gun>(); _initialAmmo = _specialGun.ammo; UpdateGunAmmoBar(_specialGun.ammo); } else { _specialBeam = _playerWeapons.weapons[PlayerWeapons.SPECIAL_WEAPON_SLOT].GetComponent <BeamWeapon>(); _initialTime = _specialBeam.duration; UpdateBeamAmmoBar(_initialTime); } }
void OnEnable() { // get special weapon and total ammo, update with gun and current ammo _playerWeapons = GetComponentInParent<PlayerWeapons>(); _isGun = _playerWeapons.DetermineSpecialType(); if ( _isGun ) { _specialGun = _playerWeapons.weapons[PlayerWeapons.SPECIAL_WEAPON_SLOT].GetComponent<Gun>(); _initialAmmo = _specialGun.ammo; UpdateGunAmmoBar( _specialGun.ammo ); } else { _specialBeam = _playerWeapons.weapons[PlayerWeapons.SPECIAL_WEAPON_SLOT].GetComponent<BeamWeapon>(); _initialTime = _specialBeam.duration; UpdateBeamAmmoBar( _initialTime ); } }