IEnumerator Event_B() { float startTime = Time.time; // current time float duration = _event_B_duration; while (Time.time - startTime < duration) { yield return(new WaitForSeconds(Random.Range(max, min))); TopToDown(); } Debug.Log("event B done"); // start event C //EnemyEventManager.theEventDelegate (); MultipleEnemySpawner theEnemySpawner = GameObject.FindObjectOfType <MultipleEnemySpawner>(); if (theEnemySpawner != null) { print("initiate event C"); theEnemySpawner.spawnEnemy(); } }
// Use this for initialization void Start() { thePlayer = FindObjectOfType <PlayerController>(); multipleEnemySpawner = GameObject.FindObjectOfType <MultipleEnemySpawner>(); posToStop = new Vector2(transform.position.x, 3f); initialPos = transform.position; if (thePlayer) { StartCoroutine(moveToPlayer(posToStop)); } bossHealth = GetComponent <BossHealth>(); }