ºÇ½ª¹¹¿·¡§
orika_ex_miyako 2021ǯ02·î16Æü(²Ð) 15:08:02ÍúÎò
Âѵ×ÎϤÎÃͤò¸º»»¤¹¤ë¤è¤¦¤Ë¤·¤¿¤ê¡¢¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤¬¥×¥ì¥¤¥ä¡¼Ìܳݤ±¤Æȯ¼Í¤µ¤ì¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡ã¼ÂÁõÆ°²è¡¡¡¥Î¡¼¥Þ¥ë¤Î¥¨¥Í¥ß¡¼¤Î°ìÉô¤Ç¥×¥ì¥¤¥ä¡¼¤ÎÊý¸þ¤Ë¸þ¤«¤Ã¤Æ¥Ð¥ì¥Ã¥È¤òȯ¼Í¤µ¤»¤ë¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡ã¼ÂÁõÆ°²è¢¡¡¥Ü¥¹¤â¥×¥ì¥¤¥ä¡¼¤ÎÊý¸þ¤Ë¸þ¤«¤Ã¤Æ¥Ð¥ì¥Ã¥È¤òȯ¼Í¤µ¤»¤ë¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡°Ê²¼¤ÎÆâÍƤǽçÈ֤˼ÂÁõ¤ò¿Ê¤á¤Æ¤¤¤¤Þ¤¹¡£
ȯŸ£±£³¡¡¡¼¥Ð¥ì¥Ã¥È´ØÏ¢¤ÎÄɲýèÍý¤Î¼ÂÁõ¡Ý
£²£µ¡¥¥¨¥Í¥ß¡¼ÍѤΥХì¥Ã¥È¤¬µòÅÀ¤Ë¿¯Æþ¤·¤¿ºÝ¤ËÂѵ×ÎϤò¸º»»¤¹¤ë½èÍý¤òÄɲä¹¤ë £²£¶¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Îȯ¼Í¤¹¤ëÊý¸þ¤ò¿¿¤Ã¤¹¤°²¼Êý¸þ¤«¤é¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ëÊý¸þ¤Øȯ¼Í¤¹¤ë¤è¤¦¤Ë½¤Àµ¤¹¤ë £²£·¡¥¥Ü¥¹¤â¥Ð¥ì¥Ã¥È¤òȯ¼Í¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦¶¦Ä̤¹¤ë½èÍý¤òÊ£¿ô¤«¤«¤Ê¤¤¤è¤¦¤Ë¹Í¤¨¤Æµ½Ò¤¹¤ë ¡¡¡¦Ìá¤êÃͤȰú¿ô¤òÍøÍѤ·¤¿½èÍý¤Î¼ÂÁõÎã
¡¡¥¨¥Í¥ß¡¼¤«¤é¥Ð¥ì¥Ã¥È¤¬¼«Æ°À¸À®¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¤Î¤Ç¡¢¼¡¤Ï¡¢¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤¬µòÅÀ¤Ë¿¯Æþ¤·¤¿ºÝ¤ËÂѵ×ÎϤÎÃͤò¸º»»¤¹¤ë½èÍý¤ò¼ÂÁõ¤·¤Þ¤¹¡£
¼ÂºÝ¤Ë¼«Ê¬¤Ç¥²¡¼¥à¤òºî¤ëºÝ¤â¡¢Á´ÂΤÎÀ߷פò¹Í¤¨¤Æ¤«¤é¡¢£±¤Ä¤º¤Ä½çÈ֤˽èÍý¤ò¼ÂÁõ¤·¤Æ¤¤¤¯¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦¡£
¡ãÀß·×ÆâÍÆ¡ä
¡»£±¡¥ÆÃÄê¤Î¥¨¥Í¥ß¡¼¤¬°ìÄê¤Î´Ö³Ö¤Ç¥Ð¥ì¥Ã¥È¤ò¼«Æ°À¸À®¤·¡¢¥¨¥Í¥ß¡¼¤«¤é¿¿¤Ã¤¹¤°²¼Êý¸þ¤Øȯ¼Í¤¹¤ë ¡þ£²¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤ËÀÜ¿¨¤·¤¿ºÝ¤Ë¡¢µòÅÀ¤ÎÂѵ×ÎϤò¸º»»¤¹¤ë½èÍý¤òÄɲä¹¤ë ¡¡£³¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Îȯ¼Í¤¹¤ëÊý¸þ¤ò¿¿¤Ã¤¹¤°²¼Êý¸þ¤«¤é¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ëÊý¸þ¤Øȯ¼Í¤¹¤ë¤è¤¦¤Ë½¤Àµ¤¹¤ë ¡¡£´¡¥¥Ð¥ì¥Ã¥È¤Î¿Æ»Ò´Ø·¸¤òÊѹ¹¤¹¤ë
¡¡º£²ó¤Î¼ÂÁõ¤Ï¡Ú¡þ£²¡Û¤ÎÉôʬ¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡Âѵ×ÎϤÎÃͤ˴ؤ¹¤ë½èÍý¤Î½¤Àµ¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢µ½Ò¤¬É¬Íפˤʤë¤Î¤Ï DefenseBase ¥¹¥¯¥ê¥×¥È¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Ë¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¥³¥é¥¤¥À¡¼¤ò¸µ¤Ë¡¢¿¯ÆþȽÄê¤ò¤ª¤³¤Ê¤¤¤Þ¤¹¡£
¤¹¤Ç¤Ë OnTriggerEnter2D ¥á¥½¥Ã¥É¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢¤½¤ÎÃæ¤Ë½èÍý¤òµ½Ò¤·¤Þ¤¹¡£
¡¡¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤â¡¢¥¨¥Í¥ß¡¼ËÜÂΤÈƱ¤¸¤Ç Enemy ¤È¤¤¤¦ Tag ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£
Ʊ¤¸ Enemy ¤Î Tag ¤Ç£²¤Ä¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Ê¤Î¤«¡¢¤¢¤ë¤¤¤Ï¥¨¥Í¥ß¡¼ËÜÂΤǤ¢¤ë¤Î¤«¡¢
¤É¤Î¤è¤¦¤ÊÀ©¸æ¤ò¹Ô¤¨¤Ðʬ´ô¤Ç¤¤ë¤«¹Í¤¨¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤Þ¤¿¡¢À©¸æ¸å¤ÎÆâÍƤϡ¢Âѵ×ÎϤÎÃͤò¸º»»¤¹¤ëÃͰʳ°¤ÏƱ¤¸½èÍý¤Ë¤Ê¤ê¤Þ¤¹¡£
¤½¤¦¤¤¤Ã¤¿¾ì¹ç¡¢Æ±¤¸½èÍý¤ò½ñ¤«¤º¤Ëʬ´ô¤¬É¬ÍפÊÉôʬ¤Ë¤À¤±Ê¬´ôÀ©¸æ¤ò¹Ô¤¤¡¢¤¢¤È¤Ï¶¦Ä̤¹¤ë½èÍý¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤Ë¤Ç¤¤ë¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
¡ã¥í¥¸¥Ã¥¯¤Îή¤ì¡ä
¡¡£±¡¥Enemy ¤Î Tag ¤ò»ý¤Ä¥³¥é¥¤¥À¡¼¤¬¿¯Æþ¤·¤¿ ¡¡¡¡¡¡¡¡¡¡¡¡¢¡¡ ¡¡£²¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤«¡¢¥¨¥Í¥ß¡¼ËÜÂΤʤΤ«¤Çʬ´ô¤·¡¢¤½¤ì¤¾¤ì¤Î»ý¤Ä¹¶·âÎÏʬ¤À¤±Âѵ×ÎϤÎÃͤò¸º»»¤¹¤ë ¡¡¡¡¡¡¡¡¡¡¡¡¢ ¡¡£³¡¥¤³¤³¤«¤é¶¦Ä̤νèÍý¡£Âѵ×ÎϤò¹¹¿·¤·¡¢¥²¡¼¥à¥ª¡¼¥Ð¡¼¤ÎȽÄê¤ò¹Ô¤¤¡¢¥¨¥Õ¥§¥¯¥È¤òÀ¸À®¤·¡¢¿¯Æþ¤·¤¿¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÇ˲õ¤¹¤ë
¡¡
¡¡£²¤È£³¤Î½èÍý¤ÎÉôʬ¤Ë½¤Àµ¤¬É¬Íפˤʤê¤Þ¤¹¡£
£³¤ÎÉôʬ¤ò¶¦Ä̤·¤ÆÍøÍѤ¹¤ë¤Ë¤Ï¤É¤Î¤è¤¦¤Ë½¤Àµ¤¹¤ì¤Ð¤è¤¤¤«¡¢OnTriggerEnter2D ¥á¥½¥Ã¥ÉÆâ¤Î½èÍý¤È¡¢UpdateDurability ¥á¥½¥Ã¥É¤Î°ú¿ô¤ËÃíÌܤ·¤Æ½¤Àµ¤ò¹Í¤¨¤Æ¤¯¤À¤µ¤¤¡£
¡¡½èÍý¤ò¼ÂÁõ¤·¤¿¤é¥²¡¼¥à¤ò¼Â¹Ô¤·¤ÆÀ©¸æ¤Ç¤¤ë¤è¤¦¤Ê¤Ã¤Æ¤¤¤ë¤«µóÆ°¤ò³Îǧ¤·¤Þ¤¹¡£
¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤¬µòÅÀ¤Ë¿¯Æþ¤·¤¿¾ì¹ç¤È¡¢¥¨¥Í¥ß¡¼ËÜÂΤ¬µòÅÀ¤Ë¿¯Æþ¤·¤¿¾ì¹ç¤Ë¡¢Âѵ×ÎϤÎÃͤ¬¸º»»¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ì¤ÐÀ©¸æÀ®¸ù¤Ç¤¹¡£
Debug.Log ¥á¥½¥Ã¥É¤â¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢Console ¥Ó¥å¡¼¤Ç¤â½èÍý¤Îή¤ì¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡ã¼ÂÁõÆ°²è¡¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡ã¼ÂÁõÆ°²è¢¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡Ìµ»ö¤Ë¼ÂÁõ¤¬´°À®¤·¤¿¤é¡¢¼¡¤Î¼ê½ç¤Ë¿Ê¤ß¤Þ¤·¤ç¤¦¡£
ÉáÄ̤˥²¡¼¥à¤È¤·¤ÆÍ·¤ó¤Ç¤ß¤Æ¤¯¤À¤µ¤¤¡£¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Ç¤Î¹¶·â¤¬¤¢¤ë¤À¤±¤ÇÎ׾촶¤¬Áý¤·¤Æ¤¤¤ë¤³¤È¤¬Ê¬¤«¤ê¤Þ¤¹¡£
£²£¶¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Îȯ¼Í¤¹¤ëÊý¸þ¤ò¿¿¤Ã¤¹¤°²¼Êý¸þ¤«¤é¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ëÊý¸þ¤Øȯ¼Í¤¹¤ë¤è¤¦¤Ë½¤Àµ¤¹¤ë ![](https://static.seesaawiki.jp/img/usr_second/common/icon_pen.gif)
¡¡¤³¤Î¼ê½ç¤Ç¤Ï¡¢¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤ò¿¿¤Ã¤¹¤°²¼Êý¸þ¤Ç¤Ï¤Ê¤¯¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤˸þ¤«¤Ã¤Æȯ¼Í¤¹¤ë¤è¤¦¤ËÀ©¸æ¤òÊѹ¹¤·¤Þ¤¹¡£
¡ãÀß·×ÆâÍÆ¡ä
¡»£±¡¥ÆÃÄê¤Î¥¨¥Í¥ß¡¼¤¬°ìÄê¤Î´Ö³Ö¤Ç¥Ð¥ì¥Ã¥È¤ò¼«Æ°À¸À®¤·¡¢¥¨¥Í¥ß¡¼¤«¤é¿¿¤Ã¤¹¤°²¼Êý¸þ¤Øȯ¼Í¤¹¤ë ¡»£²¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤ËÀÜ¿¨¤·¤¿ºÝ¤Ë¡¢µòÅÀ¤ÎÂѵ×ÎϤò¸º»»¤¹¤ë½èÍý¤òÄɲä¹¤ë ¡þ£³¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Îȯ¼Í¤¹¤ëÊý¸þ¤ò¿¿¤Ã¤¹¤°²¼Êý¸þ¤«¤é¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ëÊý¸þ¤Øȯ¼Í¤¹¤ë¤è¤¦¤Ë½¤Àµ¤¹¤ë ¡¡£´¡¥¥Ð¥ì¥Ã¥È¤Î¿Æ»Ò´Ø·¸¤òÊѹ¹¤¹¤ë
¡¡¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃÖ¡¢¤È¤¤¤¦¤Î¤Ï¡¢PlayerController ¥¹¥¯¥ê¥×¥È¤ä¡¢¤½¤ì¤¬¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë PlayerSet ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¤³¤È¤ÇÍøÍѤǤ¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¤³¤Î¾ðÊ󤬼èÆÀ¤Ç¤¤ì¤Ð¡¢¤³¤Î°ÌÃ֤ȥ¨¥Í¥ß¡¼¤Î°ÌÃ֤Ȥò·×»»¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡ÖÊý¸þ¡×¤ò»»½Ð¤¹¤ë¤³¤È¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
¤³¤ÎÊý¸þ¤Ï Vector3 ·¿¤Î¾ðÊó¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢¤½¤ì¤ò¥Ð¥ì¥Ã¥È¤Î°ú¿ô¤È¤·¤ÆÅϤ¹¤³¤È¤¬¤Ç¤¤ì¤Ð¡¢¸½ºß¤Ï²¼Êý¸þ¤Ë¸ÇÄꤷ¤Æ¤¤¤ëȯ¼Í¤ÎÊý¸þ¤ò¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤˸þ¤«¤Ã¤Æȯ¼Í½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¸½ºß¡¢PlayerSet ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¾ðÊó¤òÊÑ¿ô¤È¤·¤Æ´ÉÍý¤·¤Æ¤¤¤ë¥¹¥¯¥ê¥×¥È¤Ï¤¢¤ê¤Þ¤»¤ó¡£
Âå¤ï¤ê¤Ë¡¢PlayerController ¥¹¥¯¥ê¥×¥È¤òÊÑ¿ô¤È¤·¤Æ´ÉÍý¤·¡¢°·¤¨¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ë¥¹¥¯¥ê¥×¥È¤Ï¡¢GameManager ¥¹¥¯¥ê¥×¥È¤¬¤¢¤ê¤Þ¤¹¡£
¡¡À߷׾塢¹Í¤¨¤Æ¤¤¤¿¤À¤¤¿¤¤¥Ý¥¤¥ó¥È¤È¤·¤Æ¤Ï¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤ξðÊó¤ò¼èÆÀ¤·¤ÆÍøÍѤ·¤¿¤¤¤Î¤Ï
¥Ð¥ì¥Ã¥È¤òȯ¼Í¤¹¤ë EnemyController ¥¹¥¯¥ê¥×¥È¤Ç¤¹¡£¤¿¤À¤·¡¢¥¨¥Í¥ß¡¼¤Ë¤Ï¡¢¥Ð¥ì¥Ã¥È¤òȯ¼Í¤¹¤ë¥¿¥¤¥×¤È¡¢È¯¼Í¤·¤Ê¤¤¥¿¥¤¥×¤¬¤¤¤Þ¤¹¡£
¡¡¤Ä¤Þ¤ê¡¢EnemyController ¥¹¥¯¥ê¥×¥È¤È¤·¤Æ PlayerController ¥¹¥¯¥ê¥×¥È¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¤Ë¤Ï¡¢ÍøÍÑÈϰϤ¬¸ÂÄꤵ¤ì¤ë¤¿¤á¡¢
¤Ê¤ë¤Ù¤¯¤Ê¤é¤Ð¡¢ÊÑ¿ô¤ÏÍÑ°Õ¤»¤º¤Ë¡¢³°Éô¤Î¥¹¥¯¥ê¥×¥È¤è¤ê¾ðÊó¤ò¼èÆÀ¤·¤ÆÍøÍѤò¤¹¤ë¤³¤È¤ò¸¡Æ¤¤·¤¿¤¤Éôʬ¤Ç¤¹¡£
¡¡»È¤¤¤¿¤¤¾ðÊ󤬤¢¤ë¤«¤é¥¹¥¯¥ê¥×¥È¤Ç¼èÆÀ¤¹¤ë¡¢¤È¤¤¤¦¹Í¤¨Êý¼«ÂΤÏÌäÂꤢ¤ê¤Þ¤»¤ó¤¬¡¢¾¯¤·À߷פ˴·¤ì¤Æ¤¤¿¤ê¡¢
¥¹¥¯¥ê¥×¥ÈÁ´ÂΤò¸«ÅϤ·¤ÆÀ߷פò¹Ô¤¦¤È¤¤¤¦»ëÅÀ¤Ç¸¡Æ¤¤ò¤·¤Æ¤¤¤¿¤À¤¯¤è¤¦¤Ë¤Ê¤ë¤È¡¢¥ï¥ó¥¹¥Æ¥Ã¥×¿Ê¤ó¤ÀÀ߷פ¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡º£²ó¤Ï¤³¤ÎÀ߷פÎÍýÇ°¤Ë´ð¤Å¤¤¤Æ¡¢EnemyController ¥¹¥¯¥ê¥×¥È¤Ç¤Ï PlayerController ¥¹¥¯¥ê¥×¥È¤òÊÑ¿ô¤ä¸¡º÷¤·¤Æ¼èÆÀ¤Ï¤»¤º¤Ë¡¢
¤³¤Î PlayerController ¥¹¥¯¥ê¥×¥È¤Î¾ðÊó¤ò´ÉÍý¤·¤Æ¤¤¤ë GameManager ¥¹¥¯¥ê¥×¥È¤«¤é¾ðÊó¤ò¼õ¤±¼è¤Ã¤ÆÍøÍѤ¹¤ëÀ߷פˤ·¤Þ¤¹¡£
¡¡¼èÆÀ¤¹¤ëÊýË¡¤Ï¡¢PlayerController ¥¹¥¯¥ê¥×¥È¤òľÀÜ°ú¿ô¤Ç¼èÆÀ¤¹¤ë¤À¤±¤Ç¤Ï¤Ê¤¯¡¢Ìá¤êÃͤòÍøÍѤ¹¤ë¤³¤È¤Ç¤â¼èÆÀ¤Ç¤¤Þ¤¹¡£
¤È¤¯¤Ëº£²ó¤ÏPlayerController ¥¹¥¯¥ê¥×¥È¤½¤Î¤â¤Î¤ò¤º¤Ã¤ÈÍøÍѤ¹¤ëÌõ¤Ç¤Ï¤Ê¤¯¡¢¥¨¥Í¥ß¡¼¤Î°ÌÃ֤ȥץ쥤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤ξðÊó¤ò»È¤Ã¤Æ¡ÖÊý¸þ¡×¤ò·×»»¤·¤¿¤¤¡¢¤È¤¤¤¦¥±¡¼¥¹¤Ç¤¹¡£
¤º¤Ã¤È¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃÖ¾ðÊó¤ò´ÉÍý¤¹¤ë¤³¤È¤ÏɬÍפ¢¤ê¤Þ¤»¤ó¤Î¤Ç¡¢¥Ð¥ì¥Ã¥È¤òȯ¼Í¤¹¤ëºÝ¤Ë¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤ξðÊó¤È¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¤«¤é¡ÖÊý¸þ¡×¤¬·×»»¤Ç¤¤ì¤ÐÌäÂê¤Ê¤¤Ìõ¤Ç¤¹¡£
¡¡°Ê¾å¤Î¤³¤È¤«¤é¡¢GameManager ¥¹¥¯¥ê¥×¥È¤Ë¤Ï¡¢¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤ò¼õ¤±¼è¤Ã¤Æ¡¢¼«Ê¬¤Î´ÉÍý¤·¤Æ¤¤¤ë PlayerController ¥¹¥¯¥ê¥×¥È¤Î°ÌÃÖ¾ðÊó¤òÍøÍѤ·¤Æ·×»»¤·¡¢
»»½Ð¤µ¤ì¤¿¡ÖÊý¸þ¡×¤Î¾ðÊó¤ò EnemyController ¥¹¥¯¥ê¥×¥È¤Ø¤ÈÌ᤹¤è¤¦¤Ê½èÍý¤ò¼ÂÁõ¤·¤Þ¤¹¡£
¡¡EnemyController ¥¹¥¯¥ê¥×¥È¤ÏľÀÜ GameManager ¥¹¥¯¥ê¥×¥È¤Ø¤Î»²¾È¤òÊÑ¿ô¤È¤·¤Æ´ÉÍý¤·¤Æ¤¤¤Þ¤»¤ó¤Î¤Ç¡¢
´Ö¤Ë EnemyGenerator ¥¹¥¯¥ê¥×¥È¤ËÆþ¤Ã¤Æ¤â¤é¤Ã¤Æ¡¢EnemyGenerator ¥¹¥¯¥ê¥×¥È·Ðͳ¤Ç GameManager ¥¹¥¯¥ê¥×¥È¤Ë¤¢¤ë¡ÖÊý¸þ¡×¤ò·×»»¤¹¤ë½èÍý¤ò¼Â¹Ô¤·¤Æ¤â¤é¤¤¤Þ¤¹¡£
¡ã¥í¥¸¥Ã¥¯¤Îή¤ì¡ä
¡¡£±¡¥GameManager ¥¹¥¯¥ê¥×¥È¤Ë¡¢¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤ò¼õ¤±¼è¤Ã¤Æ PlayerController ¥¹¥¯¥ê¥×¥È¤Î°ÌÃÖ¾ðÊó¤Èº¹Ê¬¤ò·×»»¤·¡¢¡ÖÊý¸þ¡×¤È¤·¤Æ»»½Ð¤·¤¿·ë²Ì¤òÌá¤êÃͤȤ·¤ÆÌ᤹¥á¥½¥Ã¥É¤òÍÑ°Õ¤¹¤ë ¡¡£²¡¥EnemyGenerator ¥¹¥¯¥ê¥×¥È¤Ë¡¢EnemyController ¥¹¥¯¥ê¥×¥È¤è¤ê¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤ò¼õ¤±¼è¤Ã¤Æ GameManager ¥¹¥¯¥ê¥×¥È¤ËÍÑ°Õ¤µ¤ì¤¿¡ÖÊý¸þ¡×¤ò·×»»¤¹¤ë¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¡¢Ìá¤êÃͤȤ·¤Æ¡ÖÊý¸þ¡×¤Î¾ðÊó¤ò¼õ¤±¼è¤ë ¡¡£³¡¥EnemyController ¥¹¥¯¥ê¥×¥È¤Ë EnemyGenerator ¥¹¥¯¥ê¥×¥È¤ËÍÑ°Õ¤µ¤ì¤¿¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¡¢GameManager ¥¹¥¯¥ê¥×¥È¤Ç½èÍý¤µ¤ì¤Æ¼èÆÀ¤·¤¿¡ÖÊý¸þ¡×¤Î¾ðÊó¤ò¼õ¤±¼è¤ë ¡¡£´¡¥¼õ¤±¼è¤Ã¤¿Êý¸þ¤Î¾ðÊó¤ò Bullet ¥¹¥¯¥ê¥×¥È¤Î°ú¿ô¤È¤·¤ÆÅϤ·¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤˸þ¤«¤Ã¤Æ¥Ð¥ì¥Ã¥È¤òȯ¼Í¤¹¤ë
¡¡°Ê¾å¤Î¤è¤¦¤Êή¤ì¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡£±¤Ä¤º¤Ä½èÍý¤òµ½Ò¤·¤Ê¤¬¤éÆɤ߲ò¤¤¤Æ¤¯¤À¤µ¤¤¡£
º£²ó¤ÏÌá¤êÃͤò»ý¤Ä¥á¥½¥Ã¥É¤ò£²²ó³¤±¤Æ¸Æ¤Ó½Ð¤·¤ÆÍøÍѤ·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤·¤Ã¤«¤ê¤È½èÍý¤òÍý²ò¤·¤Þ¤·¤ç¤¦¡£
¡¡À߷פ˴ð¤Å¤¤¤Æ¡¢É¬ÍפʽèÍý¤òµ½Ò¤·¤Æ¤¤¤¤Þ¤·¤ç¤¦¡£
¤³¤Î¥¹¥¯¥ê¥×¥È¤Ë¤Ï¡¢EnemyGenerator ¥¹¥¯¥ê¥×¥È¤è¤ê¸Æ¤Ó½Ð¤·¤Æ¼Â¹Ô¤·¤Æ¤â¤é¤¦¥á¥½¥Ã¥É¤ò½àÈ÷¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
¤½¤Î¥á¥½¥Ã¥ÉÆâ¤Ç¥×¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¾ðÊó¤È¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤ò·×»»¤·¡¢¡ÖÊý¸þ¡×¤ò»»½Ð¤·¤Æ¡¢½èÍý¤Î·ë²Ì¤ò¸Æ¤Ó½Ð¤·¸µ¤ËÌ᤹¤è¤¦¤Ë¹Í¤¨¤Æ¤¯¤À¤µ¤¤¡£
¡¡¥×¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¾ðÊó¤Ï PlayerController ·¿¤ÎÊÑ¿ô¤«¤é»²¾È¤Ç¤¤Þ¤¹¤¬¡¢GameManager ¥¹¥¯¥ê¥×¥È¤Ï¥¨¥Í¥ß¡¼£±ÂΤ´¤È¤Î°ÌÃÖ¾ðÊó¤Ï´ÉÍý¤·¤Æ¤¤¤Þ¤»¤ó¡£
¤³¤¦¤¤¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢¥á¥½¥Ã¥É¤Ë°ú¿ô¤òÍÑ°Õ¤·¤Æ¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤ò¼õ¤±¼è¤êÍøÍѤ¹¤ë¤è¤¦¤Ë¥í¥¸¥Ã¥¯¤ò¹Í¤¨¤Æ¤¯¤À¤µ¤¤¡£
¤½¤¦¤¹¤ì¤Ð¡¢É¬Íפʥ¨¥Í¥ß¡¼¤Î¾ðÊó¤ò»È¤Ã¤Æ¡¢¥×¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¾ðÊó¤È·×»»¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
GameManager.cs
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡¤³¤Á¤é¤âÀ߷פ˴ð¤Å¤¤¤Æ¡¢É¬Íפʥ᥽¥Ã¥É¤òÄɲ䷤Ƥ¯¤À¤µ¤¤¡£
¡¡É¬ÍפʽèÍý¤Ï¡¢EnemyController ¥¹¥¯¥ê¥×¥È¤è¤ê¸Æ¤Ó½Ð¤·¤Æ¤â¤é¤Ã¤Æ¼Â¹Ô¤¹¤ë¥á¥½¥Ã¥É¤Ë¤Ê¤ê¤Þ¤¹¡£
¤³¤Î½èÍý¤ÎÃæ¤Ç¡¢GameManager ¥¹¥¯¥ê¥×¥È¤ËÍÑ°Õ¤·¤¿¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¤è¤¦¤Ë¥í¥¸¥Ã¥¯¤òÁȤó¤Ç¤¯¤À¤µ¤¤¡£
¡¡GameManager ¥¹¥¯¥ê¥×¥È¤ËÍÑ°Õ¤·¤¿¥á¥½¥Ã¥É¤Ï°ú¿ô¤È¤·¤Æ¡¢¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤òÍ׵ᤷ¤Æ¤¤¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¤³¤Î EnemyGenerator ¥¹¥¯¥ê¥×¥È¤ËÍÑ°Õ¤¹¤ë¥á¥½¥Ã¥É¤â¡¢EnemyController ¥¹¥¯¥ê¥×¥È¤«¤é¸Æ¤Ó½Ð¤¹ºÝ¤Ë
¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤òÍ׵᤹¤ë¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£¤½¤¦¤¹¤ë¤³¤È¤Ç¡¢¥¹¥¯¥ê¥×¥È¤È¥¹¥¯¥ê¥×¥È¤ò·Ðͳ¤·¤Æ
¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤ò GameManager ¥¹¥¯¥ê¥×¥È¤Þ¤ÇÅϤ·¤ÆÆϤ±¤ë¤³¤È¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
EnemyGenerator.cs
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡£³¤Ä¤Î¥¹¥¯¥ê¥×¥È¤Ë¤Þ¤¿¤¬¤Ã¤¿°ìÏ¢¤Î½èÍý¤¬¤É¤Î¤è¤¦¤Ë¼Â¹Ô¤µ¤ì¤Æ¡¢¤É¤Î¤è¤¦¤Ê¾ðÊ󤬼èÆÀ¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤«¤òÆɤ߲ò¤¤Þ¤·¤ç¤¦¡£
£±¡¥EnemyController ¥¹¥¯¥ê¥×¥È¤Î EnemyShot ¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤Æ¡¢EnemyGenerator ¥¹¥¯¥ê¥×¥È¤Ë¤¢¤ë PreparateGetPlayerDirection ¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤ë ![](https://static.seesaawiki.jp/img/usr_second/common/icon_pen.gif)
// ¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Î¥¯¥í¡¼¥ó¤òÀ¸À®¤·¡¢Bullet ¥¹¥¯¥ê¥×¥È¤ò¼èÆÀ¤·¤Æ¡¢ShotBullet ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë Instantiate(enemyBulletPrefab, transform).GetComponent<Bullet>().ShotBullet(enemyGenerator.PreparateGetPlayerDirection(transform.position));
¡¡¾åµ¤Î½èÍý¤ÎÃæ¤Ç¡¢ShotBullet ¥á¥½¥Ã¥É¤Î°ú¿ô¤Ë¡¢Vector3 ·¿¤ÎÌá¤êÃͤò»ý¤Ä EnemyGenerator ¥¹¥¯¥ê¥×¥È¤Ë¤¢¤ë PreparateGetPlayerDirection ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤·¤Æ¤¤¤Þ¤¹¡£
¤³¤Î¥á¥½¥Ã¥É¤Î°ú¿ô¤Ë¤Ï¡¢¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤ò»ØÄꤷ¤ÆÅϤ·¤Æ¤¤¤Þ¤¹¡£
¡¡¥á¥½¥Ã¥É½èÍý¤ò°ú¿ô¤ÎÃæ¤Ëµ½Ò¤Ç¤¤ëÍýͳ¤Ï¡¢ShotBullet ¥á¥½¥Ã¥É¤Î°ú¿ô¤Î»ØÄ꤬ Vector3·¿¤Ç¤¢¤ê¡¢°ú¿ô¤Ç¼Â¹Ô¤¹¤ë¥á¥½¥Ã¥É¤ÎÌá¤êÃͤ¬Æ±¤¸ Vector3 ·¿¤Ç¤¢¤ë¤¿¤á¤Ç¤¹¡£
// ¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Î¥¯¥í¡¼¥ó¤òÀ¸À®¤·¡¢Bullet ¥¹¥¯¥ê¥×¥È¤ò¼èÆÀ¤·¤Æ¡¢ShotBullet ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë Instantiate(enemyBulletPrefab, transform).GetComponent<Bullet>().¡¡;
¡¡¤³¤Î¤è¤¦¤Ê½èÍý¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡¼Â¹Ô¤·¤¿¥á¥½¥Ã¥É¤Î°ú¿ô¤ËÌá¤êÃͤλý¤Ä¥á¥½¥Ã¥É¤Î»ØÄ꤬¤¢¤ë¾ì¹ç¡¢¤½¤ì¤Ï¡¢Ìá¤êÃͤò»ý¤Ä¥á¥½¥Ã¥É¤Î½èÍý¤¬¤¹¤Ù¤Æ½ªÎ»¤·¤Æ¤«¤é¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
º£²ó¤Î¥±¡¼¥¹¤Ç¸À¤¨¤Ð¡¢ShotBullet ¥á¥½¥Ã¥É¤Ï¡¢°ú¿ô¤Ë»ØÄꤷ¤Æ¤¤¤ë PreparateGetPlayerDirection ¥á¥½¥Ã¥É¤Î½èÍý¤Î·ë²Ì¤òÂԤäÆ(Ìá¤êÃͤ¬¼èÆÀ¤Ç¤¤Æ)¤«¤é¼Â¹Ô¤µ¤ì¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¤Á¤ã¤ó¤È Vector3 ·¿¤Î¾ðÊó¤ò ShotBullet ¥á¥½¥Ã¥É¤ËÅϤ¹¤³¤È¤¬½ÐÍè¤Æ¤¤¤Þ¤¹¡£
£²¡¥EnemyGenerator ¥¹¥¯¥ê¥×¥È¤Î PreparateGetPlayerDirection ¤¬¼Â¹Ô¤µ¤ì¤Æ¡¢GameManager ¥¹¥¯¥ê¥×¥È¤Ë¤¢¤ë GetPlayerDirection ¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤ë ![](https://static.seesaawiki.jp/img/usr_second/common/icon_pen.gif)
/// <summary> /// ¥×¥ì¥¤¥ä¡¼¤È¥¨¥Í¥ß¡¼¤È¤Î°ÌÃÖ¤«¤éÊý¸þ¤òȽÄꤹ¤ë½àÈ÷ /// </summary> /// <returns></returns> public Vector3 PreparateGetPlayerDirection(Vector3 enemyPos) { return gameManager.GetPlayerDirection(enemyPos);¡¡¡¡¡¡//¡¡¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¥á¥½¥Ã¥É¤Î½èÍý·ë²Ì¤ò EnemyController ¥¹¥¯¥ê¥×¥È¤Î ShotBullet ¥á¥½¥Ã¥É¤Î°ú¿ô¤È¤·¤ÆÌᤷ¤Æ¤¤¤ë }
¡¡¤³¤Á¤é¤Î¥á¥½¥Ã¥ÉÆâ¤Ç¤â¡¢GameManager ¥¹¥¯¥ê¥×¥È¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡¢Ìá¤êÃͤò»ý¤Ä GetPlayerDirection ¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¤³¤ÎÌá¤êÃͤò»ý¤Ä¥á¥½¥Ã¥É¤¬²ò·è¤µ¤ì¤Æ»Ï¤á¤Æ¡¢EnemyController ¥¹¥¯¥ê¥×¥È¤ÎºÇ½é¤Ë¼Â¹Ô¤·¤Æ¤¤¤ë ShotBullet ¥á¥½¥Ã¥É¤ÎÌá¤êÃͤ¬³ÎÄꤷ¤Þ¤¹¡£
/// <summary> /// ¥×¥ì¥¤¥ä¡¼¤È¥¨¥Í¥ß¡¼¤È¤Î°ÌÃÖ¤«¤éÊý¸þ¤òȽÄê /// </summary> /// <returns></returns> public Vector3 GetPlayerDirection(Vector3 enemyPos) { return (playerController.transform.position - enemyPos).normalized;¡¡¡¡//¡¡¤³¤Î½èÍý·ë²Ì¤¬ EnemyGenerator ¥¹¥¯¥ê¥×¥È¤Î PreparateGetPlayerDirection ¥á¥½¥Ã¥É¤ËÌá¤ë }
¡¡¤³¤Î¥á¥½¥Ã¥ÉÆâ¤Ç¤Ï¡¢°ú¿ô¤È¤·¤Æ¡¢EnemyController ¥¹¥¯¥ê¥×¥È ¢ª¡¡EnemyGenerator ¥¹¥¯¥ê¥×¥È¡¡¢ª¡¡GameManager ¥¹¥¯¥ê¥×¥È¤È·Ðͳ¤·¤Æ
EnemyController ¥¹¥¯¥ê¥×¥È¤«¤é¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¾ðÊó¤¬ Vector3 ·¿¤ÇÆϤ¤¤Æ¤¤¤Þ¤¹¡£¤³¤ÎÃÍ¤È PlayerController ·¿¤ÎÊÑ¿ô¤Ë¤¢¤ë PlayerSet ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃÖ¾ðÊó¤ò·×»»¤·¡¢
»»½Ð¤µ¤ì¤¿º¹Ê¬¤ÎÃͤò normalized ÊÑ¿ô¤òÍøÍѤ·¤Æ®Å٥٥¯¥È¥ë¤ËÊÑ´¹¤·¤Æ¤¤¤Þ¤¹¡£Â®Å٥٥¯¥È¥ë¤Ë¤Ä¤¤¤Æ¤Ï¡¢¥×¥ì¥¤¥ä¡¼¤Î¥Ð¥ì¥Ã¥È¤ÎÉôʬ¤ÇÀâÌÀ¤·¤Æ¤¤¤Þ¤¹¤Î¤ÇÉü½¬¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¤½¤ì¤òºÇ½ªÅª¤ÊÃͤȤ·¤Æ¡¢¤³¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë EnemyGenerator ¥¹¥¯¥ê¥×¥È¤Î PreparateGetPlayerDirection ¥á¥½¥Ã¥É¤ËÌá¤êÃͤȤ·¤ÆÌᤷ¤Æ¤¤¤Þ¤¹¡£
¡¡
¡¡EnemyGenerator ¥¹¥¯¥ê¥×¥È¤Î PreparateGetPlayerDirection ¥á¥½¥Ã¥É¤âÌá¤êÃͤò¤â¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢
GetPlayerDirection ¥á¥½¥Ã¥É¤Î·ë²Ì¤ò ¤µ¤é¤Ë EnemyController ¥¹¥¯¥ê¥×¥È¤Î ShotBullet ¥á¥½¥Ã¥É¤Î°ú¿ô¤È¤·¤ÆÌᤷ¤Æ¤¤¤Þ¤¹¡£
¡ã¥á¥½¥Ã¥É¤ÈÌá¤êÃͤη¿¤Ë¤è¤ë½èÍý¤Îή¤ì¡ä
¡¡ShotBullet(enemyGenerator.PreparateGetPlayerDirection(transform.position))¡¡¢ª¡¡PreparateGetPlayerDirection¡¡¢ª¡¡GetPlayerDirection ¡¡ShotBullet(Vector3)¡¡¢ª¡¡Ìá¤êÃÍ[Vector3 ·¿]¡¡PreparateGetPlayerDirection¡¡¢ª¡¡Ìá¤êÃÍ[Vector3 ·¿] GetPlayerDirection
¡¡¤½¤·¤Æ³Æ¥á¥½¥Ã¥É¤ÎÌá¤êÃͤˤè¤Ã¤Æ¡¢¸µ¤Î½èÍý¤ËÁ̤äÆÃͤ¬Ìá¤Ã¤Æ¤¤¤¤Þ¤¹¡£
¡ãÌá¤êÃͤÎή¤ì¡ä
¡¡¡ ¤³¤Î¥á¥½¥Ã¥É¤Î½èÍý·ë²Ì(Êý¸þ¤Î¾ðÊó)¤òÁ°¤Î¥á¥½¥Ã¥É¤ËÌ᤹ ¡¡Ìá¤êÃÍ[Vector3 ·¿] GetPlayerDirection ¡¡¡¡¡¡¢¡¡¡¡ ¡¡¢¾åµ¤Î¥á¥½¥Ã¥É¤Î½èÍý·ë²Ì¤¬ PreparateGetPlayerDirection ¥á¥½¥Ã¥É¤ËÌá¤Ã¤Æ¤¯¤ë¡¡=¡¡¤³¤Î¥á¥½¥Ã¥É¤Ë¡ÖÊý¸þ¡×¤Î¾ðÊó¤¬ÆϤ¤¤Æ¤¤¤ë ¡¡Ìá¤êÃÍ[Vector3 ·¿]¡¡PreparateGetPlayerDirection ¡¡¡¡¡¡¢¡¡¡¡ ¡¡£¾åµ¤Î¥á¥½¥Ã¥É¤Î½èÍý·ë²Ì¤¬ ShotBullet ¥á¥½¥Ã¥É¤Î°ú¿ô¤ËÌá¤Ã¤Æ¤¯¤ë¡¡=¡¡°ú¿ô¤Ë¡ÖÊý¸þ¡×¤Î¾ðÊó¤¬ÆϤ¤¤Æ¤¤¤ë ¡¡ShotBullet(Vector3 ·¿)
¡¡°Ê¾å¤Î¤è¤¦¤Ê½èÍý¤Î·ë²Ì¤Ë¤è¤Ã¤Æ¡¢EnemyController ¥¹¥¯¥ê¥×¥È¤Î½èÍý¤¬ GameManager ¥¹¥¯¥ê¥×¥È¤Î¥á¥½¥Ã¥É¤Ç·×»»¤µ¤ì¤Æ¡¢
ºÇ½ªÅª¤Ë ShotBullet ¥á¥½¥Ã¥É¤Þ¤ÇÃͤ¬Ìá¤Ã¤Æ¤¤ÆÃͤ¬¼èÆÀ¤Ç¤¤Æ¤¤¤ë¤³¤È¤¬Ê¬¤«¤ê¤Þ¤¹¡£
¡¡
¡¡°Ê¾å¤Î½èÍý¤Îή¤ì¤ò¥¤¥á¡¼¥¸¤·¤Ê¤¬¤é¡¢¼ÂºÝ¤Ë½èÍý¤¬Æ°¤¤¤Æ¤¤¤ë¤«¤ò³Îǧ¤·¤Æ¤¤¤¤Þ¤¹¡£
¥¨¥Í¥ß¡¼¤¬¥Ð¥ì¥Ã¥È¤òȯ¼Í¤·¤¿ºÝ¤Ë¡¢¿¿¤Ã¤¹¤°²¼Êý¸þ¤Ç¤Ï¤Ê¤¯¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤˸þ¤«¤Ã¤Æȯ¼Í¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ì¤ÐÀ©¸æÀ®¸ù¤Ç¤¹¡£
¡¡Ìá¤êÃͤνèÍý¤Î¾ì¹ç¤ÏÅÓÃæ¤Ç½èÍý¤¬¼Â¹Ô¤Ç¤¤Ê¤¤¾ì¹ç¤Ë¤ÏºÇ½é¤Î½èÍý¤Ç¤¢¤ë ShotBullet ¥á¥½¥Ã¥É¤â¼Â¹Ô¤Ç¤¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡½èÍý¤òÆɤßÊÖ¤·¤Æ¡¢Î®¤ì¤ò¤Ä¤«¤ó¤Ç¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡ºÇ¸å¤Ë»Ä¤Ã¤Æ¤¤¤ë¼ê½ç¤òÀ߷פ·¤Æ¼ÂÁõ¤ò¹Ô¤¤¤Þ¤¹¡£
¡ãÀß·×ÆâÍÆ¡ä
¡»£±¡¥ÆÃÄê¤Î¥¨¥Í¥ß¡¼¤¬°ìÄê¤Î´Ö³Ö¤Ç¥Ð¥ì¥Ã¥È¤ò¼«Æ°À¸À®¤·¡¢¥¨¥Í¥ß¡¼¤«¤é¿¿¤Ã¤¹¤°²¼Êý¸þ¤Øȯ¼Í¤¹¤ë ¡»£²¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤ËÀÜ¿¨¤·¤¿ºÝ¤Ë¡¢µòÅÀ¤ÎÂѵ×ÎϤò¸º»»¤¹¤ë½èÍý¤òÄɲä¹¤ë ¡»£³¡¥¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤Îȯ¼Í¤¹¤ëÊý¸þ¤ò¿¿¤Ã¤¹¤°²¼Êý¸þ¤«¤é¡¢¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ëÊý¸þ¤Øȯ¼Í¤¹¤ë¤è¤¦¤Ë½¤Àµ¤¹¤ë ¡þ£´¡¥¥Ð¥ì¥Ã¥È¤Î¿Æ»Ò´Ø·¸¤òÊѹ¹¤¹¤ë
¡¡¤Þ¤º¤Ï¡¢¥Ü¥¹¤¬¥Ð¥ì¥Ã¥È¤òȯ¼Í¤Ç¤¤ë¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦¡£
¡¡¸½ºß¤Ï°ÜÆ°ÊýË¡¤¬ Straight ¤Î¥¨¥Í¥ß¡¼¤Î¤ß¥Ð¥ì¥Ã¥È¤òȯ¼Í¤·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤³¤Î¾ò·ï¤Ë Boss_Horizontal ¤Î°ÜÆ°ÊýË¡¤âÄɲ䷤Ƥ¯¤À¤µ¤¤¡£
¥²¡¼¥à¤ò¼Â¹Ô¤·¡¢¥Ü¥¹¤â¥Ð¥ì¥Ã¥È¤òȯ¼Í¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤«¡¢¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡²¿²ó¤«¼Â¹Ô¤·¤Æ»î¤·¤Æ¤¤¤ë¤È¡¢ÉÔ¼«Á³¤ÊÅÀ¤¬¤¢¤ë¤³¤È¤¬Ê¬¤«¤ê¤Þ¤¹¡£
¡ã¸¡¾ÚÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡¥Ü¥¹¤¬º¸±¦¤ÎÊý¸þ¤òÊѹ¹¤¹¤ë¥¿¥¤¥ß¥ó¥°¤Ç¡¢¥Ð¥ì¥Ã¥È¤ÎÊý¸þ¤¬°ì½ï¤ËÄɽ¾¤·¤ÆÊѹ¹¤·¤Æ¤·¤Þ¤¦¤³¤È¤¬Ê¬¤«¤ê¤Þ¤¹¡£
¤³¤ì¤Ç¤ÏÁÛÄꤷ¤Æ¤¤¤ëµóÆ°¤Ë¤Ê¤ê¤Þ¤»¤ó¡£È¯¼Í¤·¤¿¥Ð¥ì¥Ã¥È¤Ï¡¢¤½¤Î¤Þ¤Þ¥×¥ì¥¤¥ä¡¼¤Î¤¤¤ë°ÌÃ֤˸þ¤«¤Ã¤Æȯ¼Í¤µ¤ì¤ë¤³¤È¤¬ÌÜɸ¤Ç¤¹¡£
¡¡¤³¤ÎÉôʬ¤ò½¤Àµ¤·¤Æ¤¤¤¤Þ¤¹¡£
¡¡¤³¤Î½èÍý¤Î¸¶°ø¤Ï¡¢¥Ð¥ì¥Ã¥È¤òÀ¸À®¤·¤¿ºÝ¤Ë¡¢¥¨¥Í¥ß¡¼¤ò¿Æ¤È¤·¤ÆÀ¸À®¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¿¤á¡¢
»Ò¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë¥Ð¥ì¥Ã¥È¤Ï¿Æ¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÜÆ°°ÌÃÖ¤ËÄɽ¾¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¥Ð¥ì¥Ã¥È¤Î°ÌÃÖ¤â°ì½ï¤ËÊѲ½¤·¤Æ¤·¤Þ¤¦¤³¤È¤Ç¤¹¡£
¡¡°ÊÁ°¡¢¿Æ»Ò´Ø·¸¤Ç¤Ï¥¨¥Õ¥§¥¯¥È¤Ç¤âƱ¤¸ÉÔ¶ñ¹ç¤¬¤¢¤ê¤Þ¤·¤¿¡£
¥¨¥Í¥ß¡¼¤¬Ç˲õ¤µ¤ì¤Æ¤·¤Þ¤¦¤È¡¢¤½¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤ÆÀ¸À®¤µ¤ì¤¿¥¨¥Õ¥§¥¯¥È¤âÇ˲õ¤µ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤¿ÌäÂê¤Ç¤¹¡£
¡¡º£²ó¤â¿Æ»Ò´Ø·¸¤Ç¤ÎÌäÂê¤Ç¤¹¤Î¤Ç¡¢¥Ð¥ì¥Ã¥È¤òÀ¸À®¤·¡¢È¯¼Í¤¹¤ëÉôʬ¤Þ¤Ç½èÍý¤¬½ªÎ»¤·¤¿¤é¡¢¿Æ»Ò´Ø·¸¤ò²ò¾Ã¤·¡¢
¤½¤¦¤¤¤Ã¤¿¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò³ÊǼ¤¹¤ë¤¿¤á¤Î TemporaryObjectContainer ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¿Æ¤È¤·¤ÆºÆ¹½ÃÛ¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦¡£
¡¡µ¤¤òÉÕ¤±¤Æ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ïµ½Ò¤¹¤ë½èÍý¤Î½çÈ֤Ǥ¹¡£
ȯ¼Í¤·¤Æ¤«¤é¿Æ»Ò´Ø·¸¤òÊѹ¹¤·¤Ê¤¤¤È¡¢¿Æ»Ò´Ø·¸¤òÊѹ¹¤·¤¿»þÅÀ¤Ç¥Ð¥ì¥Ã¥È¤Î°ÌÃÖ¤¬Êѹ¹¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¤¿¤á¡¢Àµ¾ï¤Ë¥¨¥Í¥ß¡¼¤Î°ÌÃÖ¤«¤éȯ¼Í¤Ç¤¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
¡¡À߷פ˴ð¤Å¤¤¤Æ½èÍý¤Î¥í¥¸¥Ã¥¯¤ò¹Í¤¨¤Æ¼ÂÁõ¤ò¤·¤Æ¤¤¤¤Þ¤¹¡£
¿Æ»Ò´Ø·¸¤ò¹½ÃÛ¤¹¤ëºÝ¤Î½èÍý¤Ï°ÊÁ°¤Ë¤â¼ÂÁõ¤·¤Æ¤¤¤ë DefenseBase ¥¹¥¯¥ê¥×¥È¤Î½èÍý¤ò»²¹Í¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤Þ¤¿º£¤Þ¤Ç¤Ï¥Ð¥ì¥Ã¥È¤ò¥¤¥ó¥¹¥¿¥ó¥¹¤ÈƱ»þ¤Ë Bullet ¥¹¥¯¥ê¥×¥È¤ò¼èÆÀ¤·¤Æ ShotBullet ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤·¤Æ¤¤¤Þ¤·¤¿¤¬¡¢
¤³¤Î¾ì¹ç¡¢¥¤¥ó¥¹¥¿¥ó¥¹¤µ¤ì¤¿¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¾ðÊ󤬤ɤ³¤Ë¤â¤Ê¤¤¤¿¤á¡¢¤½¤Î¤Þ¤Þ¤Ç¤Ï¿Æ»Ò´Ø·¸¤ò¹½ÃۤǤ¤Þ¤»¤ó¡£
¡¡
¡¡ºÆÅÙ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òõ¤¹½ê¤«¤é»Ï¤á¤ë¤Î¤Ç¤ÏÂçÊѤǤ¹¤Î¤Ç¡¢Instantiate ¥á¥½¥Ã¥É¤ÎÌá¤êÃͤòÍøÍѤ·¤ÆÀ¸À®¤µ¤ì¤¿¥Ð¥ì¥Ã¥È¤ò¿·¤·¤¯ÍÑ°Õ¤·¤¿Æ±·¿¤ÎÊÑ¿ô¤ËÂåÆþ¤·¡¢
¤½¤ÎÊÑ¿ô¤òÍøÍѤ·¤Æ¡¢ShotBullet ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤·¤Æ¤«¤é¡¢¿Æ»Ò´Ø·¸¤ò¹½ÃÛ¤¹¤ë¤è¤¦¤Ë½èÍý¤Î¥í¥¸¥Ã¥¯¤ò½ñ¤´¹¤¨¤Æ¤¯¤À¤µ¤¤¡£
EnemyController.cs
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡¼ÂÁõ¤¬½ªÎ»¤·¤¿¤é¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¡¢¥Ü¥¹¤Î¥¨¥Í¥ß¡¼¤Î¥Ð¥ì¥Ã¥È¤ÎµóÆ°¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¥¨¥Í¥ß¡¼¤¬º¸±¦¤Ë¥¿¡¼¥ó¤¹¤ëºÝ¤Ç¤âȯ¼Í¤·¤¿¥Ð¥ì¥Ã¥È¤Î°ÌÃÖ¤¬Êѹ¹¤µ¤ì¤ë¤³¤È¤Ê¤¯¡¢¥×¥ì¥¤¥ä¡¼¤ÎÊý¸þ¤Ë¸þ¤«¤Ã¤ÆÆ°¤¤¤Æ¤¯¤ì¤ÐÀ©¸æÀ®¸ù¤Ç¤¹¡£
¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£Èó¾ï¤ËÆñ¤·¤¤¼ê½ç¤Ç¤¢¤Ã¤¿¤È»×¤¤¤Þ¤¹¤Î¤Ç¡¢¤·¤Ã¤«¤ê¤ÈÉü½¬¤·¤Æ½èÍý¤Îή¤ì¤ÎÍý²ò¤ò¿¼¤á¤Æ¤¯¤À¤µ¤¤¡£
Ìá¤êÃͤˤĤ¤¤Æ¤Ï¡¢¤³¤ì¤é¤Î½èÍý¤ò»²¹Í¤Ë¤·¤Ê¤¬¤é¡¢²¾¤Î¥×¥í¥°¥é¥à¤ò½ñ¤¤¤Æ¤É¤Î¤è¤¦¤ËÆ°¤¯¤«¤ò³Îǧ¤·¤Æ¤ª¤¯¤È¤¤¤¤¤Ç¤·¤ç¤¦¡£
¡¡¼«Ê¬¤Ç¹Í¤¨¤Æºî¤Ã¤¿½èÍý¤ÎÊý¤¬¡¢¶µºà¤è¤ê¤â²¿ÇܤâÍý²ò¤Ç¤¤Þ¤¹¡£½èÍý¤òÆɤó¤Ç½ñ¤¯¡¢¤Î·«¤êÊÖ¤·¤¬ÂçÀڤǤ¹¡£
¡¡¼¡¤Ï¡¡È¯Å¸£±£´¡¡¡ÝList¤ÎºîÀ®¤È³èÍÑ¡Ý¡¡¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯