コード例 #1
0
    public IEnumerator ShootCircles(float EndCircleDelay, string BulletTag, float EndCircleRotation, Vector2 pos, Color?rainbowcol = null, SkeleBulletType type = SkeleBulletType.SANS)
    {
        yield return(new WaitForSeconds(EndCircleDelay));

        StageController.AudioManager.PlaySFX("shootbullet", 0.3f);

        const float velocity    = 5.5f;
        const int   numInCircle = 8;

        for (int i = 0; i < numInCircle; i++)
        {
            GameObject bullet = ObjectPooler.Spawn(BulletTag, pos, Quaternion.identity);

            if (BulletTag == "Kunai" || BulletTag == "Star")
            {
                switch (type)
                {
                case SkeleBulletType.INK:
                    float hue = 360f / numInCircle * i / 360f;
                    rainbowcol = Color.HSVToRGB(hue, 0.7f, 1);
                    break;

                case SkeleBulletType.ERROR:
                    int r = Random.Range(0, 7);

                    if (r == 0)
                    {
                        rainbowcol = Color.blue;
                    }
                    else if (r == 1)
                    {
                        rainbowcol = Color.yellow;
                    }
                    else if (r == 2)
                    {
                        rainbowcol = Color.red;
                    }
                    else
                    {
                        rainbowcol = GravitateMovement.GetCol(74, 74, 74);
                    }
                    break;

                case SkeleBulletType.DREAM:
                    rainbowcol = GravitateMovement.GetCol(255, 252, 186);
                    break;
                }

                bullet.GetComponent <SpriteRenderer>().color = rainbowcol.Value;
            }

            bullet.transform.Rotate(new Vector3(0, 0, (360 / numInCircle * i) - 90 + EndCircleRotation));
            bullet.GetComponent <Rigidbody2D>().velocity = bullet.transform.up * velocity;

            if (type == SkeleBulletType.ZEPHYR)
            {
                ZephyrBullets.Add(bullet);
            }
        }

        if (type == SkeleBulletType.ZEPHYR)
        {
            StartCoroutine(ZephyrCircle());
        }
    }
コード例 #2
0
 public void ShootCirclesStart(float EndCircleDelay, string BulletTag, float EndCircleRotation, Vector2 pos, Color?rainbowcol = null, SkeleBulletType type = SkeleBulletType.SANS)
 {
     StartCoroutine(ShootCircles(EndCircleDelay, BulletTag, EndCircleRotation, pos, rainbowcol, type));
 }