Page 361 - MDP2022-3
P. 361

}
                    void  Fire()            //탄환  발사
                    {
                            if  (!isButtonA)


                                    return;
                            if  (curshortDelay  <  maxshortDelay)   //탄화  딜레이  설정
                                    return;
                            switch  (power)                                 //플레이어  파워에  맞게  발사

                            {
                                    case  1:
                                            GameObject  bullet  =  objectManager.MakeObj("bulletPlayerA");
                                            bullet.transform.position  =  transform.position;
                                            Rigidbody2D  rigid  =  bullet.GetComponent<Rigidbody2D>();
                                            rigid.AddForce(Vector2.up  *  10,  ForceMode2D.Impulse);

                                            curshortDelay  =  0;
                                            break;
                                    case  2:
                                            GameObject  bulletL  =  objectManager.MakeObj("bulletPlayerA");

                                            bulletL.transform.position  =  transform.position+Vector3.left*0.1f;
                                            GameObject  bulletR  =  objectManager.MakeObj("bulletPlayerA");
                                            bulletR.transform.position  =  transform.position+Vector3.right*0.1f;
                                            Rigidbody2D  rigidL  =  bulletL.GetComponent<Rigidbody2D>();
                                            Rigidbody2D  rigidR  =  bulletR.GetComponent<Rigidbody2D>();
                                            rigidL.AddForce(Vector2.up  *  10,  ForceMode2D.Impulse);

                                            rigidR.AddForce(Vector2.up  *  10,  ForceMode2D.Impulse);
                                            curshortDelay  =  0;
                                            break;
                                    default:

                                            GameObject  bulletRR  =  objectManager.MakeObj("bulletPlayerA");
                                            bulletRR.transform.position  =  transform.position+Vector3.right*0.25f;
                                            GameObject  bulletLL  =  objectManager.MakeObj("bulletPlayerA");
                                            bulletLL.transform.position  =  transform.position+Vector3.left*0.25f;
                                            GameObject  bulletCC  =  objectManager.MakeObj("bulletPlayerB");
                                            bulletCC.transform.position  =  transform.position;



                                            Rigidbody2D  rigidLL  =  bulletLL.GetComponent<Rigidbody2D>();
                                            Rigidbody2D  rigidRR  =  bulletRR.GetComponent<Rigidbody2D>();
                                            Rigidbody2D  rigidCC  =  bulletCC.GetComponent<Rigidbody2D>();


                                            rigidLL.AddForce(Vector2.up  *  10,  ForceMode2D.Impulse);
   356   357   358   359   360   361   362   363   364   365   366