- 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
52 lines
1.8 KiB
C#
52 lines
1.8 KiB
C#
using UnityEngine;
|
|
|
|
using RR.Game2D.Behaviour;
|
|
using RR.Game2D.Behaviour.ScriptableObjects;
|
|
using RR.Game2D.Core.Managers;
|
|
|
|
namespace RR.Game2D.Animations
|
|
{
|
|
public class EnemyAnimationEvents : MonoBehaviour
|
|
{
|
|
private SFXAsset _stepSounds;
|
|
private SFXAsset _hurtSounds;
|
|
|
|
private void Awake()
|
|
{
|
|
EnemyController controller = GetComponent<EnemyController>();
|
|
_stepSounds = controller.sfxAsset.stepSounds;
|
|
_hurtSounds = controller.sfxAsset.hurtSounds;
|
|
}
|
|
|
|
public void OnDeathBegin()
|
|
{
|
|
// Проигрывание SFX для получения урона
|
|
if (_hurtSounds && _hurtSounds.soundEffects.Length > 0)
|
|
GameManager.Instance.Audio.PlayRandomSfxAt(_hurtSounds.soundEffects, transform.position);
|
|
|
|
gameObject.layer = LayerMask.NameToLayer("No Collision");
|
|
Rigidbody2D rb = GetComponent<Rigidbody2D>();
|
|
Collider2D col = GetComponent<Collider2D>();
|
|
EnemyController controller = GetComponent<EnemyController>();
|
|
EnemyFireScript fireScript = GetComponent<EnemyFireScript>();
|
|
if (controller) controller.enabled = false;
|
|
if (fireScript) fireScript.enabled = false;
|
|
if (col) col.enabled = false;
|
|
if (!rb) return;
|
|
rb.linearVelocity = Vector2.zero;
|
|
rb.bodyType = RigidbodyType2D.Kinematic;
|
|
}
|
|
|
|
public void OnDeathEnd()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
public void Step()
|
|
{
|
|
// Проигрывание SFX для шага
|
|
if (_stepSounds && _stepSounds.soundEffects.Length > 0)
|
|
GameManager.Instance.Audio.PlayRandomSfxAt(_stepSounds.soundEffects, transform.position);
|
|
}
|
|
}
|
|
} |