Ejemplo n.º 1
0
 void fireType32()
 {
     GameObject.Instantiate(bullet[0], transform.position, Quaternion.identity);
     mbull = bullet[0].GetComponent <MonsterBullet>();
     mbull.bulletNumber = 32;
     mbull.rotaAngle    = -10f + 90f;
 }
Ejemplo n.º 2
0
 // 8颗子弹其发射
 void fireType5()
 {
     for (int i = 0; i < 8; i++)
     {
         GameObject.Instantiate(bullet[0], transform.position, Quaternion.identity);
         mbull = bullet[0].GetComponent <MonsterBullet>();
         mbull.bulletNumber = 5;
         mbull.rotaAngle    = i * 45f;
     }
 }
Ejemplo n.º 3
0
 void fireType8()
 {
     if (audio != null)
     {
         audio.Play();
     }
     for (int i = 0, k = bullet.Length; i < k; i++)
     {
         GameObject.Instantiate(bullet[i], transform.position, Quaternion.identity);
         mbull = bullet[i].GetComponent <MonsterBullet>();
         mbull.bulletNumber = 8;
     }
 }
Ejemplo n.º 4
0
    void fireType4()
    {
        GameObject.Instantiate(bullet[0], transform.position, Quaternion.identity);
        mbull = bullet[0].GetComponent <MonsterBullet>();
        mbull.bulletNumber = 4;

        GameObject player = GameObject.FindGameObjectWithTag("Player");

        if (player != null)
        {
            float angle = Utils.ComputeAngle(
                player.transform.position,
                transform.parent.transform.position
                );
            mbull.rotaAngle = angle;
        }
    }
Ejemplo n.º 5
0
 void fireType6()
 {
     GameObject.Instantiate(bullet[0], transform.position, Quaternion.identity);
     mbull = bullet[0].GetComponent <MonsterBullet>();
     mbull.bulletNumber = 6;
 }
Ejemplo n.º 6
0
    void fireType3()
    {
        n3++;
        if (n3 % timerInterval3 == 0)
        {
            if (audio != null)
            {
                audio.Play();
            }

            GameObject.Instantiate(bullet[0], transform.position, Quaternion.identity);
            mbull = bullet[0].GetComponent <MonsterBullet>();
            mbull.bulletNumber = 3;
            int index = n3 / timerInterval3;
            switch (index)
            {
            case 1:
                mbull.upSpeed    = 0f;
                mbull.downSpeed  = 0f;
                mbull.leftSpeed  = 0f;
                mbull.rightSpeed = 1f;
                break;

            case 2:
                mbull.upSpeed    = 0f;
                mbull.downSpeed  = 1f;
                mbull.leftSpeed  = 0f;
                mbull.rightSpeed = 1f;
                break;

            case 3:
                mbull.upSpeed    = 0f;
                mbull.downSpeed  = 1f;
                mbull.leftSpeed  = 0f;
                mbull.rightSpeed = 0f;
                break;

            case 4:
                mbull.upSpeed    = 0f;
                mbull.downSpeed  = 1f;
                mbull.leftSpeed  = 1f;
                mbull.rightSpeed = 0f;
                break;

            case 5:
                mbull.upSpeed    = 0f;
                mbull.downSpeed  = 0f;
                mbull.leftSpeed  = 1f;
                mbull.rightSpeed = 0f;
                break;

            case 6:
                mbull.upSpeed    = 1f;
                mbull.downSpeed  = 0f;
                mbull.leftSpeed  = 1f;
                mbull.rightSpeed = 0f;
                break;

            case 7:
                mbull.upSpeed    = 1f;
                mbull.downSpeed  = 0f;
                mbull.leftSpeed  = 0f;
                mbull.rightSpeed = 0f;
                break;

            case 8:
                mbull.upSpeed    = 1f;
                mbull.downSpeed  = 0f;
                mbull.leftSpeed  = 0f;
                mbull.rightSpeed = 1f;
                break;

            default:
                n3 = 0;
                break;
            }
        }
    }