Миксер

Почини интерфейс
This commit is contained in:
ThomasCharester committed 2026-03-23 23:59:32 +03:00
1 parent 1aceea1b79
commit 60c28f54f2
74 files changed
+8060 -1059

No files matched your search

@@ -1,7 +1,6 @@
using System;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Configs;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.Input;
using Reflex.Attributes;
using UnityEngine;
@@ -15,8 +14,9 @@ namespace Code.Example.Platformer.Entity
private IInputService _inputService;
[Inject]
private void Construct(IInputService inputService, IAudioService audioService)
private void Construct(IInputService inputService, IAudioService audioService, EventBus eventBus)
{
_eventBus = eventBus;
_audioService = audioService;
_inputService = inputService;
@@ -32,8 +32,9 @@ namespace Code.Example.Platformer.Entity
//cameraFactory.GetCinematicCamera(CameraMode.Platformer).Follow = transform; , CameraFactory cameraFactory
}
private void OnDestroy()
protected override void OnDestroy()
{
base.OnDestroy();
if(!health.IsDead) UnbindControls();
}
@@ -72,7 +73,7 @@ namespace Code.Example.Platformer.Entity
_acceleration = 1f;
_audioService.PlayOneShot(AudioNames.Platformer, 6);
_audioService.PlayOneShot(AudioNames.Platformer, 6, AudioGroupType.SFX);
}
[SerializeField] private Vector2 attackOffset;
@@ -83,7 +84,7 @@ namespace Code.Example.Platformer.Entity
//
//
_audioService.PlayOneShot(AudioNames.Platformer, 1);
_audioService.PlayOneShot(AudioNames.Platformer, 1, AudioGroupType.SFX);
animator.SetBool(OnAttack, true);
}
@@ -114,6 +115,7 @@ namespace Code.Example.Platformer.Entity
public void AttackEnd() => animator.SetBool(OnAttack, false);
[SerializeField] private EntityHealth health;
private EventBus _eventBus;
private void Start()
{
@@ -124,6 +126,19 @@ namespace Code.Example.Platformer.Entity
private void OnEntityDamage(int obj)
{
UnityEngine.Debug.Log("Player damaged");
_audioService.PlayOneShot(AudioNames.Platformer, 8, AudioGroupType.SFX);
_audioService.ApplyParameter(
"PlatformerDamage",
1f,
0.5f,
() => _audioService.ApplyParameter(
"PlatformerDamage",
5000f,
1f));
_eventBus.RaiseEvent<IPlayerDamagedHandle>(x=>x.PlayerDamaged());
}
private void OnEntityDeath()
@@ -133,7 +148,19 @@ namespace Code.Example.Platformer.Entity
animator.SetBool(Died, true);
UnbindControls();
_eventBus.RaiseEvent<IPlayerDiedHandle>(x=>x.PlayerDied());
// Destroy(gameObject, 1f);
}
}
public interface IPlayerDiedHandle : IGlobalSubscriber
{
void PlayerDied();
}
public interface IPlayerDamagedHandle : IGlobalSubscriber
{
void PlayerDamaged();
}
}