Миксер
Почини интерфейс
This commit is contained in:
1 parent
1aceea1b79
commit
60c28f54f2
74 files changed
+8060
-1059
No files matched your search
@@ -18,6 +18,10 @@ namespace Code.Example.Platformer.Entity.Enemies
|
||||
[SerializeField] private EntityHealth health;
|
||||
|
||||
[Inject] private IAudioService _audioService;
|
||||
|
||||
private Transform _target;
|
||||
private float _attackThreshold = 0.5f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
health.OnEntityDamage = OnEntityDamage;
|
||||
@@ -34,12 +38,12 @@ namespace Code.Example.Platformer.Entity.Enemies
|
||||
private async UniTaskVoid Die()
|
||||
{
|
||||
await UniTask.WaitForSeconds(1);
|
||||
_audioService.PlayOneShot(AudioNames.Platformer, 3 );
|
||||
_audioService.PlayOneShot(AudioNames.Platformer, 3 , AudioGroupType.SFX);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
private void OnEntityDamage(int obj)
|
||||
{
|
||||
_audioService.PlayOneShot(AudioNames.Platformer, 2);
|
||||
_audioService.PlayOneShot(AudioNames.Platformer, 2, AudioGroupType.SFX);
|
||||
UnityEngine.Debug.Log(gameObject.name + " damaged");
|
||||
animator.SetTrigger(OnHit);
|
||||
}
|
||||
@@ -83,11 +87,9 @@ namespace Code.Example.Platformer.Entity.Enemies
|
||||
|
||||
private void TryAttack()
|
||||
{
|
||||
if ((transform.position - _target.position).magnitude < attackThreshold) _target.GetComponent<EntityHealth>().GiveDamage(1);
|
||||
if ((transform.position - _target.position).magnitude < _attackThreshold) _target.GetComponent<EntityHealth>().GiveDamage(1);
|
||||
}
|
||||
|
||||
private Transform _target;
|
||||
private float attackThreshold = 0.5f;
|
||||
|
||||
public void GotTarget(Transform target)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user