コード例 #1
0
    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");
    }