Music & SFX

This commit is contained in:
Reinier Vens 2021-04-30 11:19:25 +01:00
commit d955c9da2f
50 changed files with 3099 additions and 2646 deletions

View file

@ -47,6 +47,15 @@ public class Faction : DatabaseEntry, INamedEntry
[InspectableDatabaseLink(typeof(Faction)), RangedFloat(0, 1), JsonProperty("allegiance"), Key(12)]
public Dictionary<Guid, float> Allegiance = new Dictionary<Guid, float>();
[InspectableSoundBank, JsonProperty("overworldMusic"), Key(13)]
public uint OverworldMusic;
[InspectableSoundBank, JsonProperty("combatMusic"), Key(14)]
public uint CombatMusic;
[InspectableSoundBank, JsonProperty("bossMusic"), Key(15)]
public uint BossMusic;
[IgnoreMember] public string EntryName
{

View file

@ -125,6 +125,8 @@ public abstract class Entity
public Subject<Unit> HeatstrokeDeath = new Subject<Unit>();
public Subject<Unit> HypothermiaRisk = new Subject<Unit>();
public Subject<Unit> HypothermiaDeath = new Subject<Unit>();
public Subject<Entity> TargetedBy = new Subject<Entity>();
public ReactiveProperty<int> TargetedByCount = new ReactiveProperty<int>(0);
public UniRx.IObservable<EquippedItem> ItemDestroyed;
public UniRx.IObservable<int2> HullArmorDepleted;
@ -193,6 +195,13 @@ public abstract class Entity
.Merge(HypothermiaDeath.Select(_ => CauseOfDeath.Hypothermia))
.Merge(ItemDestroyed.Where(i=>i.GetBehavior<Cockpit>()!=null).Select(_ => CauseOfDeath.CockpitDestroyed));
Target.Subscribe(entity => entity?.TargetedBy.OnNext(this));
TargetedBy.Subscribe(enemy =>
{
TargetedByCount.Value++;
enemy.Target.Where(t => t != this).Take(1).Subscribe(_ => TargetedByCount.Value--);
});
EntityInfoGathered.ObserveReplace().Subscribe(replace =>
{
if (replace.OldValue < ItemManager.GameplaySettings.TargetDetectionInfoThreshold &&

View file

@ -198,4 +198,11 @@ public enum LoopingAudioEvent
{
Play,
Stop
}
public enum MusicType
{
Overworld,
Combat,
Boss
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Unity.Mathematics;
using static Unity.Mathematics.math;
@ -44,7 +45,10 @@ public class LoadoutGenerator
public EntityPack GenerateShipLoadout(Predicate<HullData> hullFilter = null)
{
var hull = ItemManager.CreateInstance(RandomHull(HullType.Ship, hullFilter)) as EquippableItem;
var hullData = RandomHull(HullType.Ship, hullFilter);
var hull = ItemManager.CreateInstance(hullData) as EquippableItem;
if(hull==null)
ItemManager.Log("WHAT???");
var entity = new Ship(ItemManager, null, hull, ItemManager.GameplaySettings.DefaultEntitySettings);
entity.Faction = Faction;
OutfitEntity(entity);

View file

@ -15,12 +15,18 @@ public class WwiseMetaSoundBanksInfo
public WwiseMetaSoundBank[] SoundBanks;
private Dictionary<uint, WwiseMetaSoundBank> _soundBanks;
public WwiseMetaSoundBank GetSoundBank(uint id)
{
if (_soundBanks == null) _soundBanks = SoundBanks.ToDictionary(sb => sb.Id);
return _soundBanks[id];
}
private Dictionary<string, WwiseMetaSoundBank> _soundBankNames;
public WwiseMetaSoundBank GetSoundBank(string name)
{
if (_soundBankNames == null) _soundBankNames = SoundBanks.ToDictionary(sb => sb.ShortName);
return _soundBankNames[name];
}
}
[JsonObject]
@ -28,6 +34,7 @@ public class WwiseMetaSoundBank
{
public uint Id;
public string ShortName;
public string ObjectPath;
public WwiseMetaObject[] IncludedEvents;
public WwiseMetaObject[] GameParameters;