Take and replenish health and ammo
This commit is contained in:
@@ -17,6 +17,7 @@ namespace EvilSatellites.Weapons
|
||||
public ISoundEffect sfxSpindown;
|
||||
public ISoundEffect sfxSpinup;
|
||||
public ISoundEffect sfxSpinning;
|
||||
public ISoundEffect sfxEmpty;
|
||||
public GameScreen Screen;
|
||||
public LaserMG(IGameObject wielder, GameScreen screen)
|
||||
{
|
||||
@@ -37,6 +38,8 @@ namespace EvilSatellites.Weapons
|
||||
sfxSpinning = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/spinning.wav", false);
|
||||
sfxSpinning.Loop = true;
|
||||
sfxShoot = new AudioAsset(Screen.Manager.Sound, @"sfx/weapons/LaserMG/fire", 1, 4);
|
||||
sfxEmpty = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/empty.wav", false);
|
||||
sfxEmpty.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||
sfxReload.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||
sfxShoot.AddEffect(Screen.Manager.EnvironmentEffect);
|
||||
sfxSpindown.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||
@@ -84,10 +87,19 @@ namespace EvilSatellites.Weapons
|
||||
{
|
||||
if (TimerEnd - TimerStart > FireRate)
|
||||
{
|
||||
sfxShoot.Play();
|
||||
TimerStart = TimerEnd;
|
||||
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation, _wielder);
|
||||
Screen.AddObject(proj);
|
||||
if (RemainingAmmo > 0)
|
||||
{
|
||||
sfxShoot.Play();
|
||||
RemainingAmmo--;
|
||||
TimerStart = TimerEnd;
|
||||
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation, _wielder);
|
||||
Screen.AddObject(proj);
|
||||
} else
|
||||
{
|
||||
sfxEmpty.Reset();
|
||||
sfxEmpty.Play();
|
||||
TimerStart = TimerEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (State == WeaponState.Stopping)
|
||||
|
||||
Reference in New Issue
Block a user