Миксер
Почини интерфейс
This commit is contained in:
1 parent
1aceea1b79
commit
60c28f54f2
74 files changed
+8060
-1059
No files matched your search
@@ -1,4 +1,7 @@
|
||||
using Code.Infrastructure.Audio;
|
||||
using Code.Infrastructure.Configs;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Example.Platformer.Entity.Enemies
|
||||
@@ -9,6 +12,35 @@ namespace Code.Example.Platformer.Entity.Enemies
|
||||
[SerializeField] private Vector2 groundRight;
|
||||
[SerializeField] private bool _directionRight;
|
||||
|
||||
[SerializeField] private EntityHealth health;
|
||||
[Inject] private IAudioService _audioService;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
health.OnEntityDamage = OnEntityDamage;
|
||||
health.OnEntityDeath = OnEntityDeath;
|
||||
}
|
||||
|
||||
private void OnEntityDeath()
|
||||
{
|
||||
animator.SetBool(Died, true);
|
||||
animator.SetTrigger(OnDeath);
|
||||
Die().Forget();
|
||||
}
|
||||
|
||||
private async UniTaskVoid Die()
|
||||
{
|
||||
await UniTask.WaitForSeconds(1);
|
||||
_audioService.PlayOneShot(AudioNames.Platformer, 3 , AudioGroupType.SFX);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
private void OnEntityDamage(int obj)
|
||||
{
|
||||
_audioService.PlayOneShot(AudioNames.Platformer, 2, AudioGroupType.SFX);
|
||||
UnityEngine.Debug.Log(gameObject.name + " damaged");
|
||||
animator.SetTrigger(OnHit);
|
||||
}
|
||||
|
||||
protected override void Move()
|
||||
{
|
||||
CheckupDirection();
|
||||
|
||||
Reference in new issue
Block a user