// Update is called once per frame void Update() { UpdateSpawnRate(); if (Input.GetMouseButtonDown(0)) { Debug.Log(Camera.main.ScreenToWorldPoint(Input.mousePosition)); } if (Time.time > nextSpawn) { GameObject spawnedEnemy; int randomNumber = Random.Range(0, 20); whereToSpawn = transform.position + Vector3.up * 1.5f; if (randomNumber > 17) { spawnedEnemy = Instantiate(bat, whereToSpawn, Quaternion.identity); } else { virusCount++; quarantineTraker.SetHealth(virusCount); spawnedEnemy = Instantiate(virus, whereToSpawn, Quaternion.identity); spawnedEnemy.SendMessage("SetSpawner", this); } if (virusCount > deathTreshold) { SceneManager.LoadScene("MainScene"); } nextSpawn = Time.time + spawnRate; if (virusCount >= quarantineTreshold && !quarantineEnabled) { quarantineEnabled = true; quarantine.StartQuarantine(); teleport.SetDisabledValue(true); } else if (virusCount < quarantineTreshold && quarantineEnabled) { quarantineEnabled = false; quarantine.EndQuarantine(); teleport.SetDisabledValue(false); } } }