|
@@ -2,6 +2,7 @@ using System;
|
|
using System.Collections;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
|
|
+using UnityEngine.Audio;
|
|
using KairoEngine.Core;
|
|
using KairoEngine.Core;
|
|
using KairoEngine.Core.ModuleSystem;
|
|
using KairoEngine.Core.ModuleSystem;
|
|
using Sirenix.OdinInspector;
|
|
using Sirenix.OdinInspector;
|
|
@@ -13,12 +14,15 @@ namespace KairoEngine.SoundtrackSystem
|
|
{
|
|
{
|
|
public override string name => "Soundtrack Module";
|
|
public override string name => "Soundtrack Module";
|
|
|
|
|
|
|
|
+ [FoldoutGroup("@name"), NonSerialized, ShowInInspector] public AudioMixerGroup audioMixerChannel;
|
|
|
|
+
|
|
[FoldoutGroup("@name"), NonSerialized, ShowInInspector]
|
|
[FoldoutGroup("@name"), NonSerialized, ShowInInspector]
|
|
public Playlist playlist;
|
|
public Playlist playlist;
|
|
|
|
|
|
[FoldoutGroup("@name")] public int currentTrackIndex = 0;
|
|
[FoldoutGroup("@name")] public int currentTrackIndex = 0;
|
|
[FoldoutGroup("@name")] public bool playOnStart = true;
|
|
[FoldoutGroup("@name")] public bool playOnStart = true;
|
|
[FoldoutGroup("@name")] public bool showDebug = false;
|
|
[FoldoutGroup("@name")] public bool showDebug = false;
|
|
|
|
+
|
|
|
|
|
|
public SoundtrackModule(GameConfig config) : base(config)
|
|
public SoundtrackModule(GameConfig config) : base(config)
|
|
{
|
|
{
|
|
@@ -40,6 +44,8 @@ namespace KairoEngine.SoundtrackSystem
|
|
manager.audioSource2 = obj.AddComponent<AudioSource>();
|
|
manager.audioSource2 = obj.AddComponent<AudioSource>();
|
|
manager.audioSource1.playOnAwake = false;
|
|
manager.audioSource1.playOnAwake = false;
|
|
manager.audioSource2.playOnAwake = false;
|
|
manager.audioSource2.playOnAwake = false;
|
|
|
|
+ manager.audioSource1.outputAudioMixerGroup = audioMixerChannel;
|
|
|
|
+ manager.audioSource2.outputAudioMixerGroup = audioMixerChannel;
|
|
manager.playOnStart = this.playOnStart;
|
|
manager.playOnStart = this.playOnStart;
|
|
manager.showDebug = this.showDebug;
|
|
manager.showDebug = this.showDebug;
|
|
manager.currentTrackIndex = this.currentTrackIndex;
|
|
manager.currentTrackIndex = this.currentTrackIndex;
|
|
@@ -80,11 +86,13 @@ namespace KairoEngine.SoundtrackSystem
|
|
public override void OnBeforeSerialize(ObjectSerializer serializer)
|
|
public override void OnBeforeSerialize(ObjectSerializer serializer)
|
|
{
|
|
{
|
|
if(playlist != null) serializer.AddScriptableObject("SoundtrackModule_Playlist", playlist);
|
|
if(playlist != null) serializer.AddScriptableObject("SoundtrackModule_Playlist", playlist);
|
|
|
|
+ if(audioMixerChannel != null) serializer.AddUnityObject("SoundtrackModule_audioMixerChannel", audioMixerChannel);
|
|
}
|
|
}
|
|
|
|
|
|
public override void OnBeforeDeserialize(ObjectSerializer serializer)
|
|
public override void OnBeforeDeserialize(ObjectSerializer serializer)
|
|
{
|
|
{
|
|
playlist = (Playlist)serializer.GetScriptableObject("SoundtrackModule_Playlist");
|
|
playlist = (Playlist)serializer.GetScriptableObject("SoundtrackModule_Playlist");
|
|
|
|
+ audioMixerChannel = (AudioMixerGroup)serializer.GetUnityObject("SoundtrackModule_audioMixerChannel");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|