示例#1
0
    /// <summary>
    /// 球体弾幕
    /// </summary>
    /// <returns></returns>
    IEnumerator FireBallBulle()
    {
        Vector3    bulletDir   = firPoint.transform.up; //发射方向
        Quaternion rotateQuate = Quaternion.AngleAxis(10, Vector3.forward);
        float      distance    = 1.0f;

        for (int j = 0; j < 8; j++)
        {
            for (int i = 0; i < 36; i++)
            {
                Vector3         creatPoint = firPoint.transform.position + bulletDir * distance;
                BulletCharacter tempBullet = CreatBullet(bulletDir, creatPoint);
                tempBullet.isMove = false;
                StartCoroutine(tempBullet.DirChangeMoveMode(10.0f, 0.4f, 15));
                bulletDir = rotateQuate * bulletDir;
                var clones = GameObject.FindGameObjectsWithTag("bullet");
                foreach (var clone in clones)
                {
                    Destroy(clone, 5f);
                }
            }
            yield return(new WaitForSeconds(0.2f));
        }

        yield return(null);
    }
示例#2
0
    //變大變小圓形彈幕
    IEnumerator FireBallBulle()
    {
        Vector3    bulletDir   = firPoint.transform.up;
        Quaternion rotateQuate = Quaternion.AngleAxis(10, Vector3.forward);
        float      distance    = 1.0f;

        for (int j = 0; j < 8; j++)
        {
            for (int i = 0; i < 36; i++)
            {
                Vector3         creatPoint = firPoint.transform.position + bulletDir * distance;
                BulletCharacter tempBullet = CreatBullet(bulletDir, creatPoint);
                tempBullet.isMove = false;
                StartCoroutine(tempBullet.DirChangeMoveMode(10.0f, 0.4f, 15));
                bulletDir = rotateQuate * bulletDir;
            }
            yield return(new WaitForSeconds(0.2f));
        }

        yield return(null);
    }