IEnumerator CircleHell(Vector3 centerPoint, int number, float radius, int numOfCircles, Vector3 playerLoc) { for (int j = 0; j < numOfCircles; j++) { float angleTar = Mathf.Atan2((playerLoc.y - transform.position.y), (playerLoc.x - transform.position.x)); Vector3 bulletTarget = new Vector3(Mathf.Cos(angleTar - (Mathf.PI / 2) + (Mathf.PI * j / numOfCircles)), Mathf.Sin(angleTar - (Mathf.PI / 2) + (Mathf.PI * j / numOfCircles))); for (int i = 0; i < number; i++) { float angle = (-i / (float)number) * 2 * Mathf.PI + Mathf.PI / 2; float xPos = centerPoint.x + radius * Mathf.Cos(angle); float yPos = centerPoint.y + radius * Mathf.Sin(angle); GameObject bloodBullet = bloodPooler.GetDanmaku(bloodBulletIndex); if (bloodBullet != null) { BloodBullet bloodBulletScript = bloodBullet.GetComponent <BloodBullet>(); bloodBullet.transform.position = new Vector3(xPos, yPos, 0f); bloodBulletScript.SetOwner(gameObject); bloodBulletScript.setTarget(bulletTarget); bloodBulletScript.setAttackOne(); bloodBulletScript.setSpeed(j + 3); bloodBulletScript.setTimer(2); bloodBullet.SetActive(true); } //yield return new WaitForSeconds(2f / number); } AudioManager.GetInstance().PlaySound(Sound.VampireBullet); yield return(new WaitForSeconds(0.5f)); animator.SetTrigger("EnterChargeUp"); yield return(new WaitForSeconds(0.5f)); if (j > 0) { animator.SetTrigger("EnterAttack"); } } yield return(new WaitForSeconds(0.5f)); animator.SetTrigger("EnterChargeUp"); yield return(new WaitForSeconds(0.5f)); animator.SetTrigger("EnterAttack"); yield return(new WaitForSeconds(1f)); animator.SetTrigger("EnterIdle"); }
//WIP for another attack IEnumerator BloodBolts(int number, Transform playerLoc, Vector3 centerPoint, float radius, int speedIncrease) { Debug.Log("BloodBolts"); for (int i = 0; i < number; i++) { float angleTar = Mathf.Atan2((playerLoc.position.y - transform.position.y), (playerLoc.position.x - transform.position.x)); target = radius * new Vector3(Mathf.Cos(angleTar - (Mathf.PI / 2) + (Mathf.PI * i)), Mathf.Sin(angleTar - (Mathf.PI / 2) + (Mathf.PI * i))) + transform.position; GameObject bloodBullet = bloodPooler.GetDanmaku(bloodBulletIndex); if (bloodBullet != null) { BloodBullet bloodBulletScript = bloodBullet.GetComponent <BloodBullet>(); bloodBullet.transform.position = target; bloodBulletScript.calcTarget(playerLoc.position); bloodBulletScript.setAttackTwo(); bloodBulletScript.setATK2Speed(15 + speedIncrease); bloodBulletScript.setTimer(.5f); bloodBullet.SetActive(true); } yield return(new WaitForSeconds(1f)); } }
//WIP for another attack IEnumerator BloodBolts(int number, Transform playerLoc, Vector3 centerPoint, float radius, int speedIncrease) { for (int i = 0; i < number; i++) { timer = timer + .1f; float angleTar = Mathf.Atan2((playerLoc.position.y - transform.position.y), (playerLoc.position.x - transform.position.x)); Vector3 bulletTarget = radius * new Vector3(Mathf.Cos(angleTar - (Mathf.PI / 2) + (Mathf.PI * i)), Mathf.Sin(angleTar - (Mathf.PI / 2) + (Mathf.PI * i))) + transform.position; GameObject bloodBullet = bloodPooler.GetDanmaku(bloodBulletIndex); if (bloodBullet != null) { BloodBullet bloodBulletScript = bloodBullet.GetComponent <BloodBullet>(); bloodBullet.transform.position = bulletTarget; bloodBulletScript.SetOwner(gameObject); bloodBulletScript.calcTarget(playerLoc.position); bloodBulletScript.setAttackTwo(); bloodBulletScript.setATK2Speed(15 + speedIncrease); bloodBulletScript.setTimer(.5f); bloodBullet.SetActive(true); } AudioManager.GetInstance().PlaySound(Sound.VampireBullet); yield return(new WaitForSeconds(1f)); } }