Page 373 - MDP2022-3
P. 373

break;
                                    case  1:
                                            fire2nd();
                                            break;

                                    case  2:
                                            fire3rd();
                                            break;
                                    case  3:
                                            fire4th();

                                            break;
                            }
                    }
                    void  fire1st()
                    {
                            GameObject  bulletR  =  objectManager.MakeObj("bulletEnemyD");

                            bulletR.transform.position  =  transform.position  +  Vector3.right  *  0.2f;
                            GameObject  bulletRR  =  objectManager.MakeObj("bulletEnemyD");
                            bulletRR.transform.position  =  transform.position  +  Vector3.right  *  0.6f;
                            GameObject  bulletL  =  objectManager.MakeObj("bulletEnemyD");

                            bulletL.transform.position  =  transform.position  +  Vector3.left  *  0.2f;
                            GameObject  bulletLL  =  objectManager.MakeObj("bulletEnemyD");
                            bulletLL.transform.position  =  transform.position  +  Vector3.left  *  0.6f;


                            bulletR.transform.rotation  =  Quaternion.identity;
                            bulletRR.transform.rotation  =  Quaternion.identity;

                            bulletL.transform.rotation  =  Quaternion.identity;
                            bulletLL.transform.rotation  =  Quaternion.identity;





                            Rigidbody2D  rigidR  =  bulletR.GetComponent<Rigidbody2D>();
                            Rigidbody2D  rigidRR  =  bulletRR.GetComponent<Rigidbody2D>();
                            Rigidbody2D  rigidL  =  bulletL.GetComponent<Rigidbody2D>();
                            Rigidbody2D  rigidLL  =  bulletLL.GetComponent<Rigidbody2D>();


                            rigidR.AddForce(Vector2.down  *  8,  ForceMode2D.Impulse);

                            rigidRR.AddForce(Vector2.down  *  8,    ForceMode2D.Impulse);
                            rigidL.AddForce(Vector2.down  *  8  ,  ForceMode2D.Impulse);
                            rigidLL.AddForce(Vector2.down  *  8  ,  ForceMode2D.Impulse);



                            currentPatternCount++;
   368   369   370   371   372   373   374   375   376   377   378