Esempio n. 1
0
    private void Func01()
    {
        if (frameCount % 180 == 1)
        {
            // 弾の生成
            float angle1 = Random.Range(0, 360);
            float angle2 = Random.Range(0, 360);
            float angle3 = Random.Range(0, 360);
            float col    = Random.Range(0, 1.0f);
            for (int y = 0; y < 64; y++)
            {
                for (int x = 0; x < 32; x++)
                {
                    bullet = Instantiate(this.bulletPrefab[0], this.transform.position, Quaternion.identity);
                    bullet.SetAngle(6.28f / 64 * x, 6.28f / 64 * y);
                    bullet.velocity = Quaternion.Euler(angle1, angle2, angle3) * bullet.velocity;
                    bullet.SetColor(Color.HSVToRGB(col, 0.5f, 0.6f));
                    bulletList.Add(bullet);
                }
            }
        }

        int count = bulletList.Count;

        for (int i = count - 1; i >= 0; i--)
        {
            bulletList[i].Move();
            this.pos = bulletList[i].transform.position;
            if (this.pos.x < -10 || this.pos.x > 10 || this.pos.y < -10 || this.pos.y > 10 || this.pos.z < -10 || this.pos.z > 10)
            {
                Destroy(bulletList[i].gameObject);
                bulletList.Remove(bulletList[i]);
            }
        }
    }
Esempio n. 2
0
    private void Func02()
    {
        if (frameCount % 4 == 0)
        {
            // 弾の生成
            float col = 0.5f + 0.1f * Mathf.Sin(frameCount / 10.0f);
            for (int y = 0; y < 3; y++)
            {
                for (int x = 0; x < 6; x++)
                {
                    bullet = Instantiate(this.bulletPrefab[0], this.transform.position, Quaternion.identity);
                    bullet.SetAngle(6.28f / 6 * x + Mathf.Sin(frameCount / 16.0f) * 6.28f / 12, 6.28f / 16 * 5);
                    bullet.SetSpeed(0.07f - 0.015f * y);
                    bullet.accel.Set(0, -0.0003f, 0);
                    bullet.SetColor(Color.HSVToRGB(col, 0.5f, 0.6f));
                    bulletList.Add(bullet);
                }
            }
        }

        int count = bulletList.Count;

        for (int i = count - 1; i >= 0; i--)
        {
            bulletList[i].velocity += bulletList[i].accel;
            bulletList[i].Move();
            this.pos = bulletList[i].transform.position;
            if (this.pos.x < -10 || this.pos.x > 10 || this.pos.y < -10 || this.pos.y > 10 || this.pos.z < -10 || this.pos.z > 10)
            {
                Destroy(bulletList[i].gameObject);
                bulletList.Remove(bulletList[i]);
            }
        }
    }
Esempio n. 3
0
    // 弾幕
    private void Func00()
    {
        if (frameCount % 2 == 0)
        {
            // 弾の生成
            for (int x = 0; x < 6; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    BulletWebGL targetBullet = FindBullet();
                    if (targetBullet == null)
                    {
                        continue;
                    }

                    // ----- ここから弾幕の設定 -----

                    // 初期座標
                    targetBullet.TransformCache.position = this.transformComponent.position;

                    // 初期速度
                    targetBullet.speed = 0.05f;

                    // 初期角度
                    targetBullet.Angle1 = 6.28f / 6 * (x + y / 7.0f) + frameCount * frameCount / 10000.0f;
                    targetBullet.Angle2 = 6.28f / 3 * y + Mathf.Sin(frameCount / 100f * y) / 12.0f;

                    // 色設定
                    targetBullet.SetColor(Color.HSVToRGB(
                                              (frameCount / 100.0f + x * 0.08f) % 1.0f,
                                              0.5f,
                                              0.6f));

                    // ----- 弾幕設定ここまで -----

                    targetBullet.Activate();
                }
            }
        }

        // 弾の移動処理
        // ここが一番重い
        BulletWebGL target;

        for (int i = 0; i < maxBullet; i++)
        {
            target = bulletList[i];
            if (target.active)
            {
                target.Move(); // 重い:要改善?
                this.pos = target.TransformCache.position;
                if (this.pos.x < -10 || this.pos.x > 10 || this.pos.y < -10 || this.pos.y > 10 || this.pos.z < -10 || this.pos.z > 10)
                {
                    target.Diactivate();
                }
            }
        }
    }
Esempio n. 4
0
 static public void SetColor(float h, float s, float v)
 {
     bullet.SetColor(Color.HSVToRGB(h, s, v));
 }