//**********Action Coroutines*********\\ public IEnumerator Headbutt() { if (ActionController.currentEnemy.Equals("frontGoblin")) { MoveToFrontGoblin(); yield return(new WaitForSeconds(1.5f)); } else if (ActionController.currentEnemy.Equals("bevSr")) { MoveToBevSr(); SortingControl.ChangeGroupLayer("BetweenBevandFront", bodySpriteRenderers); yield return(new WaitForSeconds(1.5f)); } else if (ActionController.currentEnemy.Equals("backGoblin")) { MoveToBackGoblin(); yield return(new WaitForSeconds(2f)); } alanisAnim.SetBool("HeadButtState", true); yield return(new WaitForSeconds(1f)); alanisAnim.SetBool("HeadButtState", false); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("headButt"); EnemyHealthControl.TakeDamage(6, ActionController.currentEnemy); MoveToSpawnPosition(); yield return(new WaitForSeconds(2)); SortingControl.ChangeGroupLayer("Alanis", bodySpriteRenderers); ActionController.CheckRoundEnd(); }
//**********Action Coroutines**************\\ public IEnumerator Fireball() { mavrusAnim.SetBool("StaffSpellState", true); //StaffSpell is 3 seconds, raised at 45/60 yield return(new WaitForSeconds(0.75f)); //wait for staff raised backGoblinBallSprites.enabled = true; bevSrBallSprites.enabled = true; frontGoblinBallSprites.enabled = true; ballAnim.SetBool("FireballState", true);//1.5 second long yield return(new WaitForSeconds(.5f)); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("fireball"); yield return(new WaitForSeconds(1f)); ballAnim.SetBool("FireballState", false); backGoblinBallSprites.enabled = false; bevSrBallSprites.enabled = false; frontGoblinBallSprites.enabled = false; ArrayList tempActiveEnemies;//need a temporary since we cannot iterate if an enemy is removed from Collection tempActiveEnemies = (ArrayList)EnemyHealthControl.activeEnemies.Clone(); foreach (string enemyName in tempActiveEnemies) { EnemyHealthControl.TakeDamage(7, enemyName); } yield return(new WaitForSeconds(.75f));//wait for staff lower mavrusAnim.SetBool("StaffSpellState", false); ActionController.CheckRoundEnd(); }
//**********Action Coroutines**************\\ public IEnumerator Thunderclap() { if (ActionController.currentEnemy.Equals("frontGoblin")) { thunderTailTrans.localPosition = new Vector3(47, -20, 0); thunderTailTrans.localEulerAngles = new Vector3(0, 0, 65); thunderTailTrans.localScale = new Vector3(37, 70, 1); SortingControl.ChangeGroupLayer("FrontofEnemies", thunderSprites); thunderOrbTrans.localPosition = new Vector3(90, -27, 0); thunderOrbTrans.localScale = new Vector3(70, 70, 1); } else if (ActionController.currentEnemy.Equals("bevSr")) { thunderTailTrans.localPosition = new Vector3(65, -2, 0); thunderTailTrans.localEulerAngles = new Vector3(0, 0, 87); thunderTailTrans.localScale = new Vector3(35, 87, 1); SortingControl.ChangeGroupLayer("BetweenBevandFront", thunderSprites); thunderOrbTrans.localPosition = new Vector3(121, 4, 0); thunderOrbTrans.localScale = new Vector3(55, 60, 1); } else if (ActionController.currentEnemy.Equals("backGoblin")) { thunderTailTrans.localPosition = new Vector3(38, -5, 0); thunderTailTrans.localEulerAngles = new Vector3(0, 0, 80); thunderTailTrans.localScale = new Vector3(27, 52, 1); SortingControl.ChangeGroupLayer("BetweenBackandBev", thunderSprites); thunderOrbTrans.localPosition = new Vector3(73, -4, 0); thunderOrbTrans.localScale = new Vector3(50, 50, 1); } hardwonAnim.SetBool("ThunderclapState", true); yield return(new WaitForSeconds(1.2f));//wait for hammer punch thunderTailSprites.enabled = true; thunderOrbSprites.enabled = true; thunderAnim.SetBool("ThunderclapState", true); yield return(new WaitForSeconds(.5f)); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("thunderClap"); yield return(new WaitForSeconds(1));//wait for lightning end thunderAnim.SetBool("ThunderclapState", false); thunderTailSprites.enabled = false; thunderOrbSprites.enabled = false; EnemyHealthControl.TakeDamage(thunderDamage, ActionController.currentEnemy); yield return(new WaitForSeconds(.5f));//wait for arm return hardwonAnim.SetBool("ThunderclapState", false); ActionController.CheckRoundEnd(); }
//**********Action Coroutines**************\\ public IEnumerator Firebolt() { boltTrans.position = spawnPosition; boltTrans.localScale = spawnScale; Vector3 endPosition = new Vector3(); float endScale = 0; if (ActionController.currentEnemy.Equals("frontGoblin")) { SortingControl.ChangeLayer("FrontofEnemies", boltSprites); boltTrans.localEulerAngles = new Vector3(0, 0, 70); endPosition = frontGoblinBolt.position; endScale = 30; } else if (ActionController.currentEnemy.Equals("bevSr")) { SortingControl.ChangeLayer("BetweenBevandFront", boltSprites); boltTrans.localEulerAngles = new Vector3(0, 0, 85); endPosition = bevSrBolt.position; endScale = 25; } else if (ActionController.currentEnemy.Equals("backGoblin")) { SortingControl.ChangeLayer("BehindPlayers", boltSprites); boltTrans.localEulerAngles = new Vector3(0, 0, 80); endPosition = backGoblinBolt.position; endScale = 20; } mavrusAnim.SetBool("FlickOffState", true); //Flick off is 2 seconds, 1 till raised yield return(new WaitForSeconds(1)); //wait for finger raised boltSprites.enabled = true; boltAnim.SetBool("FireboltState", true);//1 second long StartCoroutine(ScaleOverSeconds(boltTrans, new Vector3(endScale, endScale, endScale), 0.75f)); StartCoroutine(MoveOverSeconds(boltTrans, endPosition, 0.75f)); yield return(new WaitForSeconds(.2f)); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("firebolt"); yield return(new WaitForSeconds(.8f)); boltAnim.SetBool("FireboltState", false);//both animations will finish at same time mavrusAnim.SetBool("FlickOffState", false); EnemyHealthControl.TakeDamage(7, ActionController.currentEnemy); boltSprites.enabled = false; boltTrans.position = spawnPosition; boltTrans.localScale = spawnScale; ActionController.CheckRoundEnd(); }
//**********Action Coroutines**************\\ public void StartSpiritDads() { auraActive = true; auraSprites.enabled = true; auraAnim.SetBool("AuraState", true); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("auraStart"); hammerDescription.text = "9 Damage\nOneEnemy"; thunderDescription.text = "20 Damage\nOneEnemy"; ThunderclapControl.thunderDamage = 20; HardwonMoveControl.meleeDamage = 9; ActionController.CheckRoundEnd(); }
//**********Action Coroutines**************\\ public IEnumerator Whirlwind() { whirlTrans.position = spawnPosition; whirlTrans.localScale = spawnScale; Vector3 endPosition = new Vector3(); float endScale = 0; if (ActionController.currentEnemy.Equals("frontGoblin")) { SortingControl.ChangeLayer("FrontofEnemies", whirlSprites); endPosition = frontGoblinWhirl.position; endScale = 25; } if (ActionController.currentEnemy.Equals("bevSr")) { SortingControl.ChangeLayer("BetweenBevandFront", whirlSprites); endPosition = bevSrWhirl.position; endScale = 20; } if (ActionController.currentEnemy.Equals("backGoblin")) { SortingControl.ChangeLayer("BetweenBackandBev", whirlSprites); endPosition = backGoblinWhirl.position; endScale = 15; } whirlSprites.enabled = true; whirlAnim.SetBool("WhirlingState", true); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("whirlwind"); StartCoroutine(ScaleOverSeconds(whirlTrans, new Vector3(endScale, endScale, endScale), 1.32f)); StartCoroutine(MoveOverSeconds(whirlTrans, endPosition, 1.32f)); yield return(new WaitForSeconds(1.32f)); whirlAnim.SetBool("WhirlingState", false); EnemyHealthControl.TakeDamage(15, ActionController.currentEnemy); whirlSprites.enabled = false; whirlTrans.position = spawnPosition; whirlTrans.localScale = spawnScale; yield return(new WaitForSeconds(.5f)); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Stop("whirlwind"); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("whirlHit"); ActionController.CheckRoundEnd(); }
//**********Action Coroutines**************\\ IEnumerator FirewallSetter() { fireWallActive = true; mavrusAnim.SetBool("StaffSpellState", true); //StaffSpell is 3 seconds, raised at 45/60 yield return(new WaitForSeconds(0.75f)); //wait for staff raised bottomWallSprites.enabled = true; bottomMidWallSprites.enabled = true; topMidWallSprites.enabled = true; topWallSprites.enabled = true; yield return(new WaitForSeconds(2.25f));//wait for staff lower mavrusAnim.SetBool("StaffSpellState", false); ActionController.CheckRoundEnd(); }
//**********Action Coroutines*********\\ public IEnumerator HammerJab() { if (ActionController.currentEnemy.Equals("frontGoblin")) { SortingControl.ChangeGroupLayer("FrontofEnemies", bodySpriteRenderers); SortingControl.ChangeLayer("BetweenBevandFront", torsoSprite); MoveToFrontGoblin(); yield return(new WaitForSeconds(2f)); } else if (ActionController.currentEnemy.Equals("bevSr")) { SortingControl.ChangeGroupLayer("BetweenBevandFront", bodySpriteRenderers); SortingControl.ChangeLayer("BetweenBackandBev", torsoSprite); MoveToBevSr(); yield return(new WaitForSeconds(2f)); } else if (ActionController.currentEnemy.Equals("backGoblin")) { MoveToBackGoblin(); SortingControl.ChangeGroupLayer("BetweenBackandBev", bodySpriteRenderers); SortingControl.ChangeLayer("BehindEnemies", torsoSprite); yield return(new WaitForSeconds(1.5f)); } hardwonAnim.SetBool("JabState", true); yield return(new WaitForSeconds((float)1.25)); hardwonAnim.SetBool("JabState", false); GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("hammerJab"); EnemyHealthControl.TakeDamage(meleeDamage, ActionController.currentEnemy);//starts off at 6, boosted by spirit to 9 MoveToSpawnPosition(); yield return(new WaitForSeconds(2)); SortingControl.ChangeGroupLayer("Hardwon", bodySpriteRenderers); ActionController.CheckRoundEnd(); }