private IEnumerator Storm(int waves, float aimedAngle) { if (Mathf.Abs(transform.position.x) < 4 || Mathf.Abs(transform.position.y) < 3) { Debug.LogWarning("Close to center."); } arm.rotation = Quaternion.Euler(0f, 0f, aimedAngle); for (int x = 0; x < waves; x++) { // Alternate patterns if (x % 2 == 0) { for (int y = 0; y < SHOTS_PER_WAVE; y++) { GameObject spiritShot = ObjectPooler.instance.GetDanmaku(spiritShotIndex); SpiritShotEnemy spiritShotScript = spiritShot.GetComponent <SpiritShotEnemy>(); spiritShot.transform.position = hand.position; spiritShotScript.SetOwner(gameObject); // Orient each shot spiritShot.transform.rotation = Quaternion.Euler(0, 0, aimedAngle - (STORM_SPREAD_ANGLE / 2f) + (STORM_SPREAD_ANGLE * (y / (float)(SHOTS_PER_WAVE - 1)))); spiritShot.SetActive(true); } } else { float alternatingOffset = STORM_SPREAD_ANGLE / (2 * SHOTS_PER_WAVE); for (int y = 0; y < SHOTS_PER_WAVE + 1; y++) { GameObject spiritShot = ObjectPooler.instance.GetDanmaku(spiritShotIndex); SpiritShotEnemy spiritShotScript = spiritShot.GetComponent <SpiritShotEnemy>(); spiritShot.transform.position = hand.position; spiritShotScript.SetOwner(gameObject); // Orient each shot spiritShot.transform.rotation = Quaternion.Euler(0, 0, aimedAngle - (STORM_SPREAD_ANGLE / 2f) + (STORM_SPREAD_ANGLE * (y / (float)(SHOTS_PER_WAVE - 1))) - alternatingOffset); spiritShot.SetActive(true); } } AudioManager.GetInstance().PlaySound(Sound.Schff); yield return(new WaitForSeconds(0.4f)); } arm.localEulerAngles = new Vector3(0, 0, 0); cooldownTimer = 4f; state = DarkPlayerState.ChoosingAttack; }
private IEnumerator EndlessPursuit() { if (transform.position != Vector3.zero) { Debug.LogWarning("Wrong position"); } float angle = 90f; float duration = 10f; while (duration > 0f) { facingRight = angle <= 90 || angle > 270; arm.rotation = Quaternion.Euler(0, 0, angle); GameObject shot = ObjectPooler.instance.GetDanmaku(spiritShotIndex); SpiritShotEnemy spiritShotScript = shot.GetComponent <SpiritShotEnemy>(); spiritShotScript.SetOwner(gameObject); shot.transform.position = hand.position; shot.transform.rotation = hand.rotation; shot.SetActive(true); AudioManager.GetInstance().PlaySound(Sound.Schff); yield return(new WaitForSeconds(0.1f)); duration -= 0.1f; angle -= 10f; if (angle < 0) { angle += 360f; } angle %= 360f; } arm.localEulerAngles = new Vector3(0, 0, 0); cooldownTimer = 0.5f; state = DarkPlayerState.ChoosingAttack; }