Compare commits

..

3 Commits

4 changed files with 232 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,169 @@
fileFormatVersion: 2
guid: d3b945e9081f3454e92477c61b0af5d7
TextureImporter:
internalIDToNameTable:
- first:
213: 6093286654331370248
second: fez_0
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: fez_0
rect:
serializedVersion: 2
x: 0
y: 17
width: 300
height: 275
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 80bbc02bde3bf8450800000000000000
internalID: 6093286654331370248
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
fez_0: 6093286654331370248
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,6 +1,12 @@
using Core;
using Core.Lifecycle;
using Minigames.StatueDressup.Data;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Audio;
using UnityEngine.InputSystem;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace Minigames.StatueDressup.Events
{
@@ -11,7 +17,12 @@ namespace Minigames.StatueDressup.Events
public class DecorationEventsManager : ManagedBehaviour
{
public static DecorationEventsManager Instance { get; private set; }
private AppleAudioSource _targetAudioPlayer;
// Dictionary to track addressable handles by AudioManager
private Dictionary<AppleAudioSource, AsyncOperationHandle<AudioResource>> _addressableHandles
= new Dictionary<AppleAudioSource, AsyncOperationHandle<AudioResource>>();
// Static events for decoration state changes
public static event System.Action<DecorationEventData> OnDecorationTappedInGrid;
public static event System.Action<DecorationEventData> OnDecorationTappedOnStatue;
@@ -34,6 +45,10 @@ namespace Minigames.StatueDressup.Events
}
Instance = this;
// Get ref to AudioComponent
_targetAudioPlayer = GetComponent<AppleAudioSource>();
// Subscribe to all events
OnDecorationTappedInGrid += HandleDecorationTappedInGrid;
@@ -57,13 +72,32 @@ namespace Minigames.StatueDressup.Events
OnDecorationDroppedOnStatue -= HandleDecorationDroppedOnStatue;
OnDecorationDroppedOut -= HandleDecorationDroppedOut;
OnDecorationFinishedDroppingOut -= HandleDecorationFinishedDroppingOut;
ReleaseAllHandles();
Instance = null;
}
}
private void OnApplicationQuit()
{
ReleaseAllHandles();
}
private void ReleaseAllHandles()
{
foreach (var handle in _addressableHandles.Values)
{
if (handle.IsValid())
{
Addressables.Release(handle);
}
}
_addressableHandles.Clear();
}
#region Static Broadcasting Methods
/// <summary>
/// Broadcast that a decoration was tapped in the grid menu
/// </summary>
@@ -127,19 +161,20 @@ namespace Minigames.StatueDressup.Events
private void HandleDecorationTappedInGrid(DecorationEventData eventData)
{
Logging.Debug($"[DecorationEventsManager] Decoration tapped in grid: {eventData.DecorationData?.DecorationId}");
// TODO: Play tap SFX/VFX
}
private void HandleDecorationTappedOnStatue(DecorationEventData eventData)
{
Logging.Debug($"[DecorationEventsManager] Decoration tapped on statue: {eventData.DecorationData?.DecorationId}");
// TODO: Play tap SFX/VFX (different from grid tap?)
}
private void HandleDecorationStartedDragging(DecorationEventData eventData)
{
Logging.Debug($"[DecorationEventsManager] Decoration started dragging: {eventData.DecorationData?.DecorationId} (FromStatue: {eventData.FromStatue})");
// TODO: Play drag start SFX, maybe show drag VFX
//Play tap SFX/VFX
PlayAdressableAudio("card_albumdrop");
}
private void HandleDecorationFinishedDragging(DecorationEventData eventData)
@@ -151,13 +186,15 @@ namespace Minigames.StatueDressup.Events
private void HandleDecorationDroppedOnStatue(DecorationEventData eventData)
{
Logging.Debug($"[DecorationEventsManager] Decoration dropped on statue: {eventData.DecorationData?.DecorationId}");
// TODO: Play success SFX, maybe show placement VFX
// Play success SFX
PlayAdressableAudio("card_albumdrop_deep");
}
private void HandleDecorationDroppedOut(DecorationEventData eventData)
{
Logging.Debug($"[DecorationEventsManager] Decoration dropped out (animation starting): {eventData.DecorationData?.DecorationId}");
// TODO: Play drop-out SFX (whoosh/disappear sound?)
// Play disappear SFX SFX
PlayAdressableAudio("random_swoosh");
}
private void HandleDecorationFinishedDroppingOut(DecorationEventData eventData)
@@ -165,8 +202,23 @@ namespace Minigames.StatueDressup.Events
Logging.Debug($"[DecorationEventsManager] Decoration finished dropping out: {eventData.DecorationData?.DecorationId}");
// TODO: Play finish SFX (poof sound?), maybe show VFX
}
#endregion
public void PlayAdressableAudio(string key)
{
// Load the asset via addressables
var handle = Addressables.LoadAssetAsync<AudioResource>(key);
var result = handle.WaitForCompletion();
// Store the handle for later release
_addressableHandles[_targetAudioPlayer] = handle;
Logging.Debug($"[DecorationEventsManager] Loaded addressable audio clip: {key}");
_targetAudioPlayer.audioSource.resource = result;
_targetAudioPlayer.Play(0);
}
}
}

View File

@@ -310,7 +310,7 @@ public class AudioManager : ManagedBehaviour, IPausable
// Store the handle for later release
_addressableHandles[uiAudioSource] = handle;
Logging.Debug($"[CinematicsManager] Loaded addressable UI audio clip: {key}");
Logging.Debug($"[AudioManager] Loaded addressable UI audio clip: {key}");
_targetAudioPlayer.audioSource.resource = result;
_targetAudioPlayer.Play(0);