예제 #1
0
    // Update is called once per frame
    void Update()
    {
        NewEnemyMovement();

        //CaculateMovement();

        if (Time.time > _canFire)
        {
            _fireRate = Random.Range(2f, 5f);
            _canFire  = Time.time + _fireRate;

            if (_waveConfig != null)
            {
                GameObject enemyLaser = Instantiate(_laserPrefab, transform.position, Quaternion.identity);

                Laser[] lasers = enemyLaser.GetComponentsInChildren <Laser>();

                for (int i = 0; i < lasers.Length; i++)
                {
                    lasers[i].AssignEnemyLaser(_waveConfig.GetEnemyTypes());
                }
            }
        }
    }