Пример #1
0
    private void Func00()
    {
        float angle1, angle2;
        int   XDIV  = 12;
        int   YDIV  = 12;
        float speed = 0.15f;

        for (int y = 0; y < YDIV; y++)
        {
            for (int x = 0; x < XDIV; x++)
            {
                int index = FindUnusedBullet();
                if (index >= 0)
                {
                    // 弾生成処理
                    angle1            = Mathf.PI / XDIV * x + frameCount / 100.0f * ((x % 2) * 2 - 1);
                    angle2            = Mathf.PI * 2 / YDIV * y + Mathf.PI / 6 * Mathf.Sin(frameCount / 100.0f) + Mathf.PI / YDIV / 2;
                    bulletList[index] = new BulletWin(
                        new Vector3(0, 0, 0),
                        new Vector3(
                            speed * Mathf.Cos(angle1) * Mathf.Cos(angle2),
                            speed * Mathf.Sin(angle2),
                            speed * Mathf.Sin(angle1) * Mathf.Cos(angle2)
                            ),
                        Color.HSVToRGB(1.0f / XDIV * x, 0.6f, 0.7f)
                        );
                }
            }
        }
    }
Пример #2
0
    // コンピュートバッファの初期化
    void InitializeComputeBuffer()
    {
        bulletsBuffer = new ComputeBuffer(EnemyWin.bulletMax, Marshal.SizeOf(typeof(BulletWin)));

        // 配列に初期値を代入する
        bulletList = new BulletWin[bulletsBuffer.count];

        for (int i = 0; i < EnemyWin.bulletMax; i++)
        {
            bulletList[i]       = new BulletWin(Vector3.zero, Vector3.zero, new Color());
            bulletList[i].state = 0;
        }

        // バッファに適応
        bulletsBuffer.SetData(bulletList);
    }
Пример #3
0
    // 弾生成処理
    // 加速度無し
    static public void BulletCreate(float px, float py, float pz, float speed, float angle1, float angle2, float h, float s, float v, float scale = 1)
    {
        int index = FindUnusedBullet();

        if (index == -1)
        {
            return;
        }
        bulletList[index] = new BulletWin(
            new Vector3(px, py, pz),
            new Vector3(
                speed * Mathf.Cos(angle1) * Mathf.Cos(angle2),
                speed * Mathf.Sin(angle2),
                speed * Mathf.Sin(angle1) * Mathf.Cos(angle2)
                ),
            Color.HSVToRGB(h, s, v)
            );
        bulletList[index].scale = scale;
    }