public void StartNextLevelBuilder() { if (levelEnemies != null) { foreach (GameObject go in levelEnemies) { if (go != null) { Destroy(go); } } } levelEnemies = null; playerShip = null; HumanShipInput player = FindObjectOfType <HumanShipInput>(); if (player != null) { Destroy(player.gameObject); } foreach (Projectile proj in FindObjectsOfType <Projectile>()) { Destroy(proj.gameObject); } combatUI.SetActive(false); levelVictoryUI.SetActive(false); gameManager.shipBuilderPanel.SetActive(true); // HACK! builder.Initialize(transform.GetChild(currentLevel).GetComponent <LevelSetup>().ToLevelData(), !wonLevel); wonLevel = false; }
// Update is called once per frame void Update() { if (target == null && Time.timeSinceLevelLoad > nextCheck) { target = FindObjectOfType <HumanShipInput>(); nextCheck = Time.timeSinceLevelLoad + 0.5f; } if (target != null) { transform.position = target.transform.position; } }