Wwise Audio Integration

This commit is contained in:
Reinier Vens 2021-04-30 06:39:57 +01:00
commit 7d67d7ec2c
72 changed files with 4551 additions and 11819 deletions

View file

@ -39,6 +39,12 @@ public class AetherDriveData : BehaviorData
[Inspectable, JsonProperty("passiveCoupling"), Key(10), RuntimeInspectable]
public PerformanceStat PassiveCoupling;
[InspectableAudioParameter, JsonProperty("rpmAudio"), Key(11), RuntimeInspectable]
public uint RpmAudioParameter;
[InspectableAudioParameter, JsonProperty("torqueAudio"), Key(12), RuntimeInspectable]
public uint TorqueRatioAudioParameter;
public override Behavior CreateInstance(EquippedItem item)
{
@ -119,6 +125,10 @@ public class AetherDrive : Behavior
var torqueRatio = actualRpmDelta / potentialRpmDelta;
var draw = torqueRatio * Evaluate(_data.EnergyDraw) / 3;
Item.SetAudioParameter(SpecialAudioParameter.Intensity, max(max(_axis.x, _axis.y), _axis.z));
Item.SetAudioParameter(_data.RpmAudioParameter, (Rpm.x + Rpm.y + Rpm.z) / 3 / MaximumRpm);
Item.SetAudioParameter(_data.TorqueRatioAudioParameter, max(max(torqueRatio.x, torqueRatio.y), torqueRatio.z));
if (Entity.TryConsumeEnergy((draw.x + draw.y + draw.z)*dt))
{
Rpm += actualRpmDelta;

View file

@ -127,6 +127,7 @@ public class ChargedWeapon : InstantWeapon
if (_charging)
{
_charge += dt / ChargeTime;
Item.SetAudioParameter(SpecialAudioParameter.ChargeLevel, saturate(_charge));
if (!_charged)
{
AddHeat(ChargeHeat * (dt / ChargeTime));
@ -143,6 +144,7 @@ public class ChargedWeapon : InstantWeapon
_coolingDown = true;
_charge = 0;
OnFailed?.Invoke();
Item.FireAudioEvent(ChargedWeaponAudioEvent.Fail);
CauseDamage(_data.FailureDamage);
}
}
@ -154,6 +156,7 @@ public class ChargedWeapon : InstantWeapon
if(!_charging && !_coolingDown)
{
OnStartCharging?.Invoke();
Item.FireAudioEvent(ChargedWeaponAudioEvent.Start);
_charging = true;
_charged = false;
}
@ -169,6 +172,7 @@ public class ChargedWeapon : InstantWeapon
_charge = 0;
}
OnStopCharging?.Invoke();
Item.FireAudioEvent(ChargedWeaponAudioEvent.Stop);
_charging = false;
}
}

View file

@ -165,7 +165,8 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior
OnCooldownComplete?.Invoke();
}
}
var firedThisFrame = false;
_burstTimer += dt;
while (_burstRemaining > 0 && _burstTimer > 0)
{
@ -180,6 +181,11 @@ public class InstantWeapon : Weapon, IProgressBehavior, IEventBehavior
_burstRemaining--;
_burstTimer -= _burstInterval;
OnFire?.Invoke();
if(!firedThisFrame)
{
Item.FireAudioEvent(WeaponAudioEvent.Fire);
firedThisFrame = true;
}
CauseWearDamage(1);
AddHeat(Heat);
Entity.VisibilitySources[this] = Visibility;

View file

@ -140,6 +140,8 @@ public class Reactor : Behavior, IOrderedBehavior, IDisposable
CurrentLoadRatio = 1;
}
Item.SetAudioParameter(SpecialAudioParameter.Intensity, max(.25f, 1 - 1 / CurrentLoadRatio));
AddHeat(heat);
return true;
}

View file

@ -72,6 +72,7 @@ public class Thruster : Behavior, IAnalogBehavior
public override bool Execute(float dt)
{
Item.SetAudioParameter(SpecialAudioParameter.Intensity, _input);
if(_input > .01f && Entity.TryConsumeEnergy(_input * Evaluate(_data.EnergyUsage)))
{
Thrust = Evaluate(_data.Thrust);