Assets.Scripts.Enemy.EnemyMeleeAttack.Attack C# (CSharp) Method

Attack() public method

public Attack ( ) : void
return void
        public void Attack()
        {
            if (Vector3.Distance(transform.position, _player.transform.position) < MinDistance)
            {
                GetComponent<EnemySounds>().PlayAttackSound();            
                var hitContext = new HitContext
                {
                    Force = 3,
                    Damage = Damage,
                    Direction = transform.forward,
                    IsMelee = true
                };
                _player.GetComponent<HealthBehavior>().TakeDamage(hitContext);
            }
        }
    }
EnemyMeleeAttack