示例#1
0
    //SpinShooting
    void EnemyFire()
    {
        ShootAudio.Play();
        for (int j = 0; j < 5; j++)
        {
            Quaternion zeroQuaternoin   = Quaternion.AngleAxis(transform.localEulerAngles.z, Vector3.forward);
            Quaternion zeroQuaternoin2  = Quaternion.AngleAxis(transform.localEulerAngles.z + 180, Vector3.forward);
            Quaternion leftQuaternoin1  = Quaternion.AngleAxis(transform.localEulerAngles.z + 30, Vector3.forward);
            Quaternion rightQuaternoin1 = Quaternion.AngleAxis(transform.localEulerAngles.z - 30, Vector3.forward);
            Quaternion leftQuaternoin2  = Quaternion.AngleAxis(transform.localEulerAngles.z + 150, Vector3.forward);
            Quaternion rightQuaternoin2 = Quaternion.AngleAxis(transform.localEulerAngles.z - 150, Vector3.forward);
            switch (j)
            {
            case 0:
                Shoot("SpinBullet", FirePoint[1].position, leftQuaternoin1);
                Shoot("SpinBullet", FirePoint[0].position, leftQuaternoin2);
                break;

            case 1:
                Shoot("SpinBullet", FirePoint[1].position, rightQuaternoin1);
                Shoot("SpinBullet", FirePoint[0].position, rightQuaternoin2);
                break;

            case 2:
                Shoot("SpinBullet", FirePoint[1].position, zeroQuaternoin);
                Shoot("SpinBullet", FirePoint[0].position, zeroQuaternoin2);
                break;
            }
        }
    }
示例#2
0
    //CircleShooting
    void EnemyFire()
    {
        ShootAudio.Play();
        float rotationAngle = 0;

        for (int j = 0; j < 30; j++)
        {
            Shoot("CircleBullet", FirePoint[0].position, Quaternion.AngleAxis(rotationAngle, Vector3.forward));
            rotationAngle += 12;
        }
    }
示例#3
0
    //SectorShooting
    void EnemyFire()
    {
        Vector3 PlayerAndEnemyDifference = target.transform.position - transform.position;
        float   rotationZ = Mathf.Atan2(PlayerAndEnemyDifference.y, PlayerAndEnemyDifference.x) * Mathf.Rad2Deg;

        transform.rotation = Quaternion.Euler(0.0f, 0.0f, rotationZ - 90);

        Quaternion zeroQuaternoin   = Quaternion.AngleAxis(transform.localEulerAngles.z + 180, Vector3.forward);
        Quaternion leftQuaternoin1  = Quaternion.AngleAxis(transform.localEulerAngles.z + 195, Vector3.forward);
        Quaternion rightQuaternoin1 = Quaternion.AngleAxis(transform.localEulerAngles.z + 165, Vector3.forward);
        Quaternion leftQuaternoin2  = Quaternion.AngleAxis(transform.localEulerAngles.z + 210, Vector3.forward);
        Quaternion rightQuaternoin2 = Quaternion.AngleAxis(transform.localEulerAngles.z + 150, Vector3.forward);

        for (int j = 0; j < 5; j++)
        {
            ShootAudio.Play();
            switch (j)
            {
            case 0:
                Shoot("SectorBullet", FirePoint[0].position, leftQuaternoin1);
                break;

            case 1:
                Shoot("SectorBullet", FirePoint[0].position, rightQuaternoin1);
                break;

            case 2:
                Shoot("SectorBullet", FirePoint[0].position, leftQuaternoin2);
                break;

            case 3:
                Shoot("SectorBullet", FirePoint[0].position, rightQuaternoin2);
                break;

            case 4:
                Shoot("SectorBullet", FirePoint[0].position, zeroQuaternoin);
                break;
            }
        }
    }