using UnityEngine;

namespace Nan.Scripts
{
    public class EnemySpawner : MonoBehaviour
    {
        [SerializeField] private GameObject _enemyGameObject;
        [SerializeField] private PlayerControl _player;
        
        private void Start()
        {
        }

        private void Update()
        {
            if (Random.Range(0, 1.0f) < 0.01f)
            {
                var enemy = Instantiate(_enemyGameObject);
                enemy.transform.position = _player.transform.position +
                                           Quaternion.AngleAxis(Random.Range(0, Mathf.PI * 2), Vector3.forward) * Vector3.right * 20;
            }
        }
    }
}