public void PlayBtn() { MMWaveManager waveManager = FindObjectOfType <MMWaveManager>(); waveManager.enabled = false; target.GetComponent <MMAIController>().enabled = false; target.GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = false; target.GetComponent <Rigidbody>().isKinematic = true; Destroy(target); Camera.main.gameObject.GetComponent <Animator>().enabled = false; startPlayingTheGame = true; defaultCameraLocation = GameObject.Find("DefaultCameraLocation").transform; target = Instantiate(Resources.Load <GameObject>("MainMenuPrefabs/MainMenuAI"), defaultCameraLocation.transform.position, new Quaternion(0f, 180f, 0f, 0f)); target.GetComponent <MMAIController>().enabled = false; target.GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = false; target.GetComponent <Rigidbody>().isKinematic = true; GetComponent <Canvas>().enabled = false; Destroy(GameObject.FindWithTag("AIPlayer"), 1.5f); foreach (GameObject enemy in waveManager.enemies) { Destroy(enemy, 1f); } waveManager.enemies.Clear(); waveManager.StopAllCoroutines(); }
private void Start() { Instance = this; enemy = Resources.Load <GameObject>("MainMenuPrefabs/MainMenuEnemy"); aiEnemy = Resources.Load <GameObject>("MainMenuPrefabs/MainMenuAIEnemy"); }