- Increased SFX pool size from 8 to 16 in AudioManager - Enabled preloadAudioData for multiple SFX files - Removed unused VisualScripting import from Checkpoint script - Reordered using statements in several scripts for consistency - Added CoinCollectible component to Coin prefab with pickup effects - Updated sorting layers and mesh LOD settings in Coin prefabs - Fixed typo in Interfaces.cs: optionaAttachPoint to optionalAttachPoint - Modified AddCoin method to accept count parameter and handle coin overflow - Moved projectile scripts (BasicProjectile, EnemyBasicProjectile, PhysicsProjectile, PickableProjectile) - Cleaned up unused namespaces and imports across various scripts
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
using RR.Game2D.Behaviour;
|
|
using RR.Game2D.Behaviour.ScriptableObjects;
|
|
using RR.Game2D.Core.Managers;
|
|
|
|
namespace RR.Common.Audio
|
|
{
|
|
public class LevelPlayerSFX : MonoBehaviour
|
|
{
|
|
public static LevelPlayerSFX Instance {get; private set; }
|
|
|
|
[SerializeField] private SFXAsset levelStepSounds;
|
|
|
|
public event Action SFXChanged;
|
|
|
|
private void OnEnable() => GameManager.Instance.PlayerSpawned += OnPlayerSpawned;
|
|
|
|
private void OnDisable() => GameManager.Instance.PlayerSpawned -= OnPlayerSpawned;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance != null && Instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
Instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
|
|
private void OnPlayerSpawned(GameObject obj)
|
|
{
|
|
PlayerController playerController = obj.GetComponent<PlayerController>();
|
|
|
|
if (playerController == null) return;
|
|
if (levelStepSounds != null)
|
|
{
|
|
playerController.stepSounds = levelStepSounds;
|
|
SFXChanged?.Invoke();
|
|
}
|
|
}
|
|
}
|
|
} |