void SpawnCDControl() { timer[0] += Time.deltaTime; if (timer[0] >= SpawnCD[0] && playerHealth.currentHealth > 0) { Invoke("spawnEnemy0", spawnStartTime); timer[0] = 0; } timer[1] += Time.deltaTime; if (timer[1] >= SpawnCD[1] && playerHealth.currentHealth > 0) { Invoke("spawnEnemy1", spawnStartTime); timer[1] = 0; } timer[2] += Time.deltaTime; if (timer[2] >= SpawnCD[2] && playerHealth.currentHealth > 0) { Invoke("spawnEnemy2", spawnStartTime); timer[2] = 0; } timer[3] += Time.deltaTime; if (timer[3] >= SpawnCD[3] && playerHealth.currentHealth > 0) { Invoke("spawnEnemy3", spawnStartTime); timer[3] = 0; } hourglass = GameObject.FindObjectOfType <HourglassUI>(); if (hourglass != null) { AddGlasses[] hourGlass0 = GameObject.FindObjectsOfType <AddGlasses>(); if (hourGlass0.Length + hourglass.currentHGNumber >= 4) { var clones = GameObject.FindGameObjectsWithTag("Enemy"); foreach (var enemyclone in clones) { if (enemyclone.name == "Bat_Red(Clone)") { enemyclone.GetComponent <LootScript>().dropChance = 0; } } enemy[0] = enemy[4]; enemy[1] = enemy[4]; enemy[2] = enemy[4]; enemy[3] = enemy[4]; SpawnCD[0] = skletonSpawntime; SpawnCD[1] = skletonSpawntime; SpawnCD[2] = skletonSpawntime; SpawnCD[3] = skletonSpawntime; } } }
private void OnTriggerEnter(Collider other) { HourglassUI hourglass = GameObject.FindObjectOfType <HourglassUI>(); if (other.tag == "Player") { Messenger.Broadcast(GameEvent.LevelChange); LoadScene(sceneName); hourglass.currentHGNumber = 0; } }
//GameObject bossclone; private void Awake() { HGAudio = GetComponent <AudioSource>(); Messenger.AddListener(GameEvent.ADD_HOURGLASS, AddGlass); #region SingletonRun if (_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { if (this != _instance) { Destroy(this.gameObject); } } #endregion }