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