Фикс трактора
This commit is contained in:
1 parent
2897eb88bf
commit
1e31e1e8b1
3 files changed
+12
-11
No files matched your search
@@ -38,7 +38,7 @@ namespace Code.Gameplay.Enemies
|
||||
private bool _isStunned;
|
||||
private float _currentStunTimer;
|
||||
|
||||
private bool _canAttack = true;
|
||||
protected bool _canAttack = true;
|
||||
private float _attackCooldownTimer;
|
||||
|
||||
private enum IdleState { Moving, Paused }
|
||||
@@ -168,19 +168,19 @@ namespace Code.Gameplay.Enemies
|
||||
|
||||
protected virtual void HandleAttackCooldown()
|
||||
{
|
||||
if (!_canAttack)
|
||||
if (_canAttack) return;
|
||||
|
||||
_attackCooldownTimer -= Time.deltaTime;
|
||||
|
||||
if (_attackCooldownTimer <= 0)
|
||||
{
|
||||
_attackCooldownTimer -= Time.deltaTime;
|
||||
if (_attackCooldownTimer <= 0)
|
||||
{
|
||||
_canAttack = true;
|
||||
}
|
||||
_canAttack = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void DealDamage()
|
||||
{
|
||||
if (!_canAttack || PlayerHealth == null) return;
|
||||
if (PlayerHealth == null) return;
|
||||
|
||||
PlayerHealth.GetDamage(Damage);
|
||||
ApplyEffectsToPlayer();
|
||||
|
||||
@@ -44,13 +44,14 @@ namespace Code.Gameplay.Enemies
|
||||
|
||||
protected override void HandleAttack()
|
||||
{
|
||||
if (!Player) return;
|
||||
if (!Player || !_canAttack) return;
|
||||
|
||||
var distance = Vector3.Distance(transform.position, Player.transform.position);
|
||||
|
||||
audioService.PlayEnemy(EnemiesSounds.Bravo,agent.transform.position);
|
||||
if (!(distance <= AttackRange)) return;
|
||||
|
||||
audioService.PlayEnemy(EnemiesSounds.Bravo,agent.transform.position);
|
||||
|
||||
DealDamage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Code.Gameplay.Enemies
|
||||
}
|
||||
protected override void HandleAttack()
|
||||
{
|
||||
if (!Player) return;
|
||||
if (!Player || !_canAttack) return;
|
||||
|
||||
var distance = Vector3.Distance(transform.position, Player.transform.position);
|
||||
|
||||
|
||||
Reference in new issue
Block a user