// void Awake() { try { player = GameManager._player.transform; // Reference to 'Player' GameObject. } catch (NullReferenceException) { Debug.Log("No Player"); } AIMove = GetComponentInParent <AI_movement>(); foreach (var stvol in weapons) { stvol.SetActive(false); } }
// void Start() { try { player = GameManager._player.transform; // Reference to 'Player' transform. } catch (NullReferenceException) { Debug.Log("No Player"); } // Object Pooling; EnemyBullets = new GameObject("Enemy bullets"); // create parent GameObject; EnemyBullets.transform.parent = GameManager._gameManager.PoolParent.transform; // Instantiate bullets and add them to bullets list for (int i = 0; i < maxBulletAmount; i++) { GameObject bullet = Instantiate(bulletPrefab); bullet.transform.parent = EnemyBullets.transform; bullet.SetActive(false); bullets.Add(bullet); } AIMove = GetComponentInParent <AI_movement>(); }
// void Start() { Player = GameManager._player; // reference to player GameObject; AIMove = GetComponentInParent <AI_movement>(); }