//**********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 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*********\\ 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(); }
//**********Action Coroutines*********\\ public IEnumerator SwordSlash() { bool takeAuraDamage = false; if (EnemyActionController.currentTarget.Equals("mavrus")) { MoveToMavrus(); yield return(new WaitForSeconds(0.7f)); if (FirewallControl.fireWallActive) { FirewallControl.ActivateFirewall(); EnemyHealthControl.TakeDamage(20, EnemyActionController.currentEnemy); } SortingControl.ChangeGroupLayer("BehindPlayers", bodySpriteRenderers); SortingControl.ChangeLayer("BetweenMavandHard", armSprite); yield return(new WaitForSeconds(1.8f)); } else if (EnemyActionController.currentTarget.Equals("hardwon")) { if (AuraControl.auraActive) { takeAuraDamage = true; } MoveToHardwon(); yield return(new WaitForSeconds(0.7f)); if (FirewallControl.fireWallActive) { FirewallControl.ActivateFirewall(); EnemyHealthControl.TakeDamage(20, EnemyActionController.currentEnemy); } SortingControl.ChangeGroupLayer("BetweenMavandHard", bodySpriteRenderers); SortingControl.ChangeLayer("BetweenHardandAlan", armSprite); yield return(new WaitForSeconds(0.8f)); } else if (EnemyActionController.currentTarget.Equals("alanis")) { MoveToAlanis(); yield return(new WaitForSeconds(0.7f)); if (FirewallControl.fireWallActive) { FirewallControl.ActivateFirewall(); EnemyHealthControl.TakeDamage(18, EnemyActionController.currentEnemy); } SortingControl.ChangeGroupLayer("BetweenHardandAlan", bodySpriteRenderers); SortingControl.ChangeLayer("FrontofPlayers", armSprite); yield return(new WaitForSeconds(1.3f)); } bevSrAnim.SetBool("SwordSlashState", true); //total length of 150/60 yield return(new WaitForSeconds(1.5f)); //end of stab at 85/60 GameObject.Find("BattleAudioManager").GetComponent <AudioControl>().Play("swordSlash"); PlayerHealthController.TakeDamage(12, EnemyActionController.currentTarget); if (takeAuraDamage) { EnemyHealthControl.TakeDamage(7, EnemyActionController.currentEnemy); } if (EnemyHealthControl.activeEnemies.Contains(EnemyActionController.currentEnemy))//wasn't killed by aura { MoveToSpawnPosition(); yield return(new WaitForSeconds(.7f)); SortingControl.ChangeGroupLayer("BevSr", bodySpriteRenderers); yield return(new WaitForSeconds(.3f));//end of slash bevSrAnim.SetBool("SwordSlashState", false); yield return(new WaitForSeconds(1));//end of move to spawn } EnemyTurnTaker.turnTaken = true; }