예제 #1
0
    private void Attack()
    {
        if (!droneController)
        {
            transform.LookAt(target.transform);
        }
        attackTimer = attackInterval;
        var damage = GameMath.CalculateDamage(enemyController, target);

        if (animator)
        {
            animator.SetInteger("AttackType", Random.Range(0, 3));
            animator.SetTrigger("AttackTrigger");
        }

        if (droneController)
        {
            droneController.FireGuns(target.Transform, attackInterval * 0.9f);
            var random = Random.value;
            if (random >= 0.75)
            {
                droneController.FireMissiles(target.Transform);
            }
            else if (random >= 0.5)
            {
                droneController.FireMortars(target.Transform);
            }
        }

        target.TakeDamage(enemyController, (int)damage);
    }