public IEnumerator RangerArrowFlurry(GameObject prefab) { float rotation = 0; if (direction == Vector2.left) { rotation = 180; } if (direction == Vector2.up) { rotation = 90; } if (direction == Vector2.down) { rotation = 270; } FindObjectOfType <AudioManager>().PlaySound("Throw"); GetComponent <Animator>().SetTrigger("Shoot"); GameObject Arrow1 = Instantiate(prefab, rb2D.position + direction * 3f, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile1 = Arrow1.GetComponent <attack>(); projectile1.damage = 10f; projectile1.life = 1f; projectile1.speed = 1000; projectile1.Launch(direction); yield return(new WaitForSeconds(0.3f)); FindObjectOfType <AudioManager>().PlaySound("Throw"); GetComponent <Animator>().SetTrigger("Shoot"); GameObject Arrow2 = Instantiate(prefab, rb2D.position + direction * 3f, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile2 = Arrow2.GetComponent <attack>(); projectile2.damage = 10f; projectile2.life = 1f; projectile2.speed = 1000; projectile2.Launch(direction); yield return(new WaitForSeconds(0.3f)); FindObjectOfType <AudioManager>().PlaySound("Throw"); GetComponent <Animator>().SetTrigger("Shoot"); GameObject Arrow3 = Instantiate(prefab, rb2D.position + direction * 3f, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile3 = Arrow3.GetComponent <attack>(); projectile3.damage = 10f; projectile3.life = 1f; projectile3.speed = 1000; projectile3.Launch(direction); }
public IEnumerator RangerHeavansFlurry(GameObject prefab) { float rotation = 270; Vector2 off = new Vector2(8, 6f); if (direction == Vector2.left) { off = new Vector2(-8, 6f); } Vector3 tempP = rb2D.position + off + direction * 3f; GameObject Arrow1 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile1 = Arrow1.GetComponent <attack>(); projectile1.damage = 10f; projectile1.life = 1000f; projectile1.speed = 500; projectile1.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow2 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile2 = Arrow2.GetComponent <attack>(); projectile2.damage = 10f; projectile2.life = 1000f; projectile2.speed = 500; projectile2.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow3 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile3 = Arrow3.GetComponent <attack>(); projectile3.damage = 10.5f; projectile3.life = 1000f; projectile3.speed = 500; projectile3.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow4 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile4 = Arrow4.GetComponent <attack>(); projectile4.damage = 10.5f; projectile4.life = 1000f; projectile4.speed = 500; projectile4.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow5 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile5 = Arrow5.GetComponent <attack>(); projectile5.damage = 10.5f; projectile5.life = 1000f; projectile5.speed = 500; projectile5.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow6 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile6 = Arrow6.GetComponent <attack>(); projectile6.damage = 10.5f; projectile6.life = 1000f; projectile6.speed = 500; projectile6.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow7 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile7 = Arrow7.GetComponent <attack>(); projectile7.damage = 10.5f; projectile7.life = 1000f; projectile7.speed = 500; projectile7.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow8 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile8 = Arrow8.GetComponent <attack>(); projectile8.damage = 10.5f; projectile8.life = 1000f; projectile8.speed = 500; projectile8.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow9 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile9 = Arrow9.GetComponent <attack>(); projectile9.damage = 10.5f; projectile9.life = 1000f; projectile9.speed = 500; projectile9.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow10 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile10 = Arrow10.GetComponent <attack>(); projectile10.damage = 10.5f; projectile10.life = 1000f; projectile10.speed = 500; projectile10.Launch(Vector2.down); }