IEnumerator PerformBlizzard() { cDuration = 0; while (cDuration < duration) { thingsHit = Physics.OverlapSphere(transform.position, radius); foreach (Collider c in thingsHit) { if (c.CompareTag("Enemy")) { currentEnemy = c.GetComponent <Goblin_ro_ctrl>(); currentEnemy.ChangeWalkState(1); currentEnemy.slowedTime = 2; //currentEnemy.TakeDamage(damage); } } cDuration += tickRate; yield return(new WaitForSeconds(tickRate)); } thingsHit = Physics.OverlapSphere(transform.position, radius); foreach (Collider c in thingsHit) { if (c.CompareTag("Enemy")) { if (!currentEnemy.dead) { currentEnemy = c.GetComponent <Goblin_ro_ctrl>(); currentEnemy.ChangeWalkState(2); currentEnemy.beingPulled = false; } } } StartCoroutine(PerformFadeIceCircle(1, -1)); }
private void ProgressTutorial() { GetComponent <AudioSource>().Play(); stage++; if (stage == 1) { tutorialText.text = "Add a Yellow Essence and a Magenta Essence to your potion to make it a Fireball potion."; indicator1.transform.localPosition = new Vector3(-0.015f, -.42f, -1.26f); indicator2.transform.localPosition = new Vector3(0.485f, -.42f, -1.26f); indicator1.GetComponent <ParticleSystem>().time = 0; indicator2.GetComponent <ParticleSystem>().time = 0; } if (stage == 2) { tutorialText.text = "Put a cork on your potion and place it on the surface in front of you to boil it."; indicator1.transform.localPosition = new Vector3(-.283f, .47f, -1.205f); indicator2.transform.position = new Vector3(0, 0, 0); } if (stage == 3) { tutorialText.text = "Pick up the potion and press any button on top of that controller to read about what it does."; indicator1.transform.position = new Vector3(0, 0, 0); } if (stage == 4) { tutorialText.text = "Throw your potion at the enemy to your right. \n\nYou can also use the Grip button to shoot your potion out."; } if (stage == 5) { tutorialText.text = "Try combining different ingredients and reading about what each potion does. \nKill all 10 enemies to start the game!"; for (int i = 0; i < 10; i++) { newEnemy = Instantiate(enemy) as Goblin_ro_ctrl; newEnemy.runSpeed = 0; newEnemy.slowedSpeed = 0; float randx = Random.Range(boundary1.position.x, boundary2.position.x); float randz = Random.Range(boundary1.position.z, boundary2.position.z); newEnemy.transform.position = new Vector3(randx, 0.3f, randz); } } if (stage == 6) { tutorialText.text = "Complete"; StartCoroutine("DelaySceneTransition"); } }
IEnumerator PerformBlizzard() { cDuration = 0; while (cDuration < duration) { thingsHit = Physics.OverlapSphere(transform.position, radius); foreach (Collider c in thingsHit) { if (c.CompareTag("Enemy")) { currentEnemy = c.GetComponent <Goblin_ro_ctrl>(); currentEnemy.poisoned = true; } } cDuration += tickRate; yield return(new WaitForSeconds(tickRate)); } StartCoroutine(PerformFadeIceCircle(1, -1)); }
IEnumerator PerformTornado() { cDuration = 0; while (cDuration < duration) { thingsHit = Physics.OverlapSphere(transform.position, radius); foreach (Collider c in thingsHit) { if (c.CompareTag("Enemy")) { currentEnemy = c.GetComponent <Goblin_ro_ctrl>(); if (!currentEnemy.brute) { currentEnemy.ChangeWalkState(0); currentEnemy.beingPulled = true; currentEnemy.pullLocation = transform.position + new Vector3(0, 1, 0); currentEnemy.TakeDamage(damage); } } } cDuration += tickRate; yield return(new WaitForSeconds(tickRate)); } thingsHit = Physics.OverlapSphere(transform.position, radius); foreach (Collider c in thingsHit) { if (c.CompareTag("Enemy")) { if (!currentEnemy.dead) { currentEnemy = c.GetComponent <Goblin_ro_ctrl>(); currentEnemy.ChangeWalkState(2); currentEnemy.beingPulled = false; } } } StartCoroutine(PerformFadeWindCircle(1, -1)); }
IEnumerator DelayForDamage() { cEnemy = null; minDistance = 500; Collider[] thingsHit = Physics.OverlapSphere(transform.position, radius); foreach (Collider c in thingsHit) { if (c.CompareTag("Enemy")) { if (Vector3.Distance(transform.position, c.transform.position) < minDistance) { minDistance = Vector3.Distance(transform.position, c.transform.position); cEnemy = c.GetComponent <Goblin_ro_ctrl>(); } } } animation = Instantiate(lightningBolt) as GameObject; animation.GetComponent <ParticleSystem>().time = 1.9f; if (cEnemy != null) { animation.transform.position = cEnemy.transform.position; } else { animation.transform.position = transform.position; } yield return(new WaitForSeconds(delay)); GetComponent <AudioSource>().Play(); if (cEnemy != null && !cEnemy.dead) { cEnemy.TakeDamage(damage); } StartCoroutine(PerformFadeFireCircle(1, -1)); }