56 lines
2.0 KiB
C#
56 lines
2.0 KiB
C#
using Chickensoft.Introspection;
|
|
using Chickensoft.LogicBlocks;
|
|
using System;
|
|
|
|
namespace GameJamDungeon;
|
|
|
|
public partial class InGameAudioLogic
|
|
{
|
|
[Meta]
|
|
public partial record State : StateLogic<State>
|
|
{
|
|
public State()
|
|
{
|
|
OnAttach(() =>
|
|
{
|
|
var gameEventDepot = Get<IGameEventDepot>();
|
|
gameEventDepot.OverworldEntered += OnOverworldEntered;
|
|
gameEventDepot.DungeonAThemeAreaEntered += OnDungeonAThemeEntered;
|
|
gameEventDepot.MenuScrolled += OnMenuScrolled;
|
|
gameEventDepot.MenuBackedOut += OnMenuBackedOut;
|
|
gameEventDepot.EquippedItem += OnEquippedItem;
|
|
gameEventDepot.InventorySorted += OnInventorySorted;
|
|
gameEventDepot.HealingItemConsumed += OnHealingItemConsumed;
|
|
gameEventDepot.TeleportEntered += OnTeleportEntered;
|
|
});
|
|
OnDetach(() =>
|
|
{
|
|
var gameEventDepot = Get<IGameEventDepot>();
|
|
gameEventDepot.OverworldEntered -= OnOverworldEntered;
|
|
gameEventDepot.DungeonAThemeAreaEntered -= OnDungeonAThemeEntered;
|
|
gameEventDepot.MenuScrolled -= OnMenuScrolled;
|
|
gameEventDepot.MenuBackedOut -= OnMenuBackedOut;
|
|
gameEventDepot.EquippedItem -= OnEquippedItem;
|
|
gameEventDepot.InventorySorted -= OnInventorySorted;
|
|
gameEventDepot.TeleportEntered -= OnTeleportEntered;
|
|
});
|
|
}
|
|
|
|
private void OnMenuBackedOut() => Output(new Output.PlayMenuBackSound());
|
|
|
|
private void OnHealingItemConsumed(ConsumableItemStats stats) => Output(new Output.PlayHealingItemSound());
|
|
|
|
private void OnInventorySorted() => Output(new Output.PlayInventorySortedSound());
|
|
|
|
private void OnEquippedItem() => Output(new Output.PlayEquipSound());
|
|
|
|
private void OnOverworldEntered() => Output(new Output.PlayOverworldMusic());
|
|
|
|
private void OnDungeonAThemeEntered() => Output(new Output.PlayDungeonThemeAMusic());
|
|
|
|
private void OnMenuScrolled() => Output(new Output.PlayMenuScrollSound());
|
|
|
|
private void OnTeleportEntered() => Output(new Output.PlayTeleportSound());
|
|
}
|
|
}
|