ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2020ǯ11·î24Æü(²Ð) 16:05:00ÍúÎò
¡¡¥×¥ì¥Õ¥¡¥Ö¤ËÍÑ°Õ¤·¤¿¥×¥ì¥¤¥ä¡¼ÍѤΥ¥ã¥é¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ï¡¢¹¶·âÎϤäHP¤Ê¤É¤Î¥Ç¡¼¥¿¤òÊÝ»ý¤·¤Æ¤¤¤Þ¤¹¡£
¤â¤·¤â³°¸«¤¬Æ±¤¸¥¥ã¥é¤Ç¤¢¤Ã¤Æ¤â¤³¤ì¤é¤ÎÃͤ¬ÊѲ½¤¹¤ë¤è¤¦¤Ê¾ì¹ç¡¢¤Þ¤¿¿·¤·¤¯¥×¥ì¥Õ¥¡¥Ö¤òÍÑ°Õ¤¹¤ë¤Î¤Ç¤ÏÂçÊѤǤ¹¡£
¡¡¤³¤Î¼ê½ç¤Ç¤Ï¡¢¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò¥Ç¡¼¥¿¥Ù¡¼¥¹²½¤·¤ÆÍÑ°Õ¤·¡¢¤½¤ì¤ò¡¢¸½ºßÁªÂò¤·¤Æ¤¤¤ë¥¥ã¥é¤Ë±þ¤¸¤Æ¹¶·âÎϤʤɤΥǡ¼¥¿¤òưŪ¤Ë¥²¡¼¥àÆâ¤ËÈ¿±Ç¤Ç¤¤ëµ¡Ç½¤òÄɲä·¤Þ¤¹¡£
¤Þ¤¿¤³¤Îµ¡Ç½¤òŨ¦¤Ë¤âÍøÍѤ·¤Æ¡¢Å¨¤Î¥Ç¡¼¥¿¤â¥×¥ì¥Õ¥¡¥Ö¤«¤éÀßÄꤹ¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò»²¾È¤·¤ÆÊѹ¹¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¤Ï¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òÍøÍѤ·¤Þ¤¹¡£
¡¡À߷פ˴ð¤Å¤¡¢°Ê²¼¤Î¼ê½ç¤Ç¼ÂÁõ¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡£±¡¥MonoBehaviour ¥¯¥é¥¹¤ò·Ñ¾µ¤·¤Ê¤¤¡¢CharaType ¥¹¥¯¥ê¥×¥È¤òºîÀ®¤¹¤ë ¡¡£²¡¥CharaDataList ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë ¡¡£³¡¥GameData ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤¹¤ë ¡¡£´¡¥Enemy ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢CharaDataList ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò¥²¡¼¥àÆâ¤ËÈ¿±Ç¤¹¤ë½èÍý¤òÄɲä¹¤ë ¡¡£µ¡¥GameManager ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢CharaDataList ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò¥²¡¼¥àÆâ¤ËÈ¿±Ç¤¹¤ë½èÍý¤òÄɲä¹¤ë ¡¡£¶¡¥PlayerController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢CharaDataList ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò¥²¡¼¥àÆâ¤ËÈ¿±Ç¤¹¤ë½èÍý¤òÄɲä¹¤ë ¡¡£·¡¥¥²¡¼¥à¤ò¼Â¹Ô¤·¤ÆÆ°ºî¤ò³Îǧ¤¹¤ë
¡¡¿·¤·¤¯³Ø½¬¤¹¤ëÆâÍƤǤ¹¡£
¡¡¡¦MonoBehaviour ¥¯¥é¥¹¤ò·Ñ¾µ¤·¤Ê¤¤enum¤Îºî¤êÊý ¡¡¡¦List.Find¥á¥½¥Ã¥É
¡¡¥²¡¼¥àÆâ¤ËÅо줹¤ë¥¥ã¥é¤ÎʬÎà¤òÎóµó»Ò¤È¤·¤ÆÅÐÏ¿¤·¤Þ¤¹¡£
¤³¤³¤Ç¤Ï²¾¤Ë°Ê²¼¤Î¤è¤¦¤ÊÆâÍƤǺîÀ®¤·¤Æ¤¤¤Þ¤¹¤¬¡¢ºÇ½é¤Ë¥×¥ì¥¤¥¢¥Ö¥ë¥¥ã¥é¤Î¼ïÎà¡¢¼¡¤ËŨ¤Î¼ïÎà¤òÅÐÏ¿¤·¤Þ¤¹¡£
¼«Ê¬¤Î¥²¡¼¥àÆâÍƤ˹ç¤ï¤»¤¿Ì¾Á°¤òÅÐÏ¿¤·¤Æ¤¯¤À¤µ¤¤¡£
CharaType.cs
¡¡¤³¤Î¥¹¥¯¥ê¥×¥È¡¦¥Õ¥¡¥¤¥ë¤Ï MonoBehaviour ¥¯¥é¥¹¤ò·Ñ¾µ¤·¤Æ¤¤¤Þ¤»¤ó¤Î¤Ç¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¢¥¿¥Ã¥Á¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¤¬
¡ÖCharaType.Îóµó»Ò¡×¤È½ñ¤¯¤³¤È¤Ë¤è¤Ã¤Æ¡¢Â¾¤Î¥¯¥é¥¹¤«¤é¼«Í³¤Ë»²¾È¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£(CharaType.Player_A¡¢CharaType.Enemy_C¡¢¤È¤¤¤¦¤è¤¦¤Ë)
¡¡¥²¡¼¥àÆâ¤ÇÍøÍѤ¹¤ë¥¥ã¥é¤Î¾ðÊó¤ò£±¤Ä¤Î¥¯¥é¥¹ CharaData ¤Ë¤Þ¤È¤á¤ÆÀë¸À¤·¤Þ¤¹¡£
¤Þ¤¿¤½¤ì¤òList¤Ë¤·¤Æ´ÉÍý¤ò¹Ô¤¨¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡¥Í¥¹¥È(Æþ¤ì»Ò)¤Ë¤Ê¤Ã¤Æ¤¤¤ë CharaData ¥¯¥é¥¹¤¬¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò°·¤¤¤Þ¤¹¡£
¥×¥ì¥¤¥ä¡¼Â¦¤ÈŨ¦¤ÇƱ¤¸ÆâÍƤËÅý°ì¤·¤Æ¤ª¤¯¤³¤È¤Ç¡¢£±¤Ä¤Î CharaData ¥¯¥é¥¹¤ÇξÊý¤Î¾ðÊó¤òÅÐÏ¿¤Ç¤¤Þ¤¹¡£
¡¡£±¤Ä¤Î CharaData ¤Ë£±¤Äʬ¤Î¥¥ã¥é¤Î¾ðÊó¤òÂåÆþ¤·¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢¥×¥ì¥¤¥¢¥Ö¥ë¥¥ã¥é¤Î¾ðÊó¤ò£²¤ÄÍÑ°Õ¤·¤¿¤¤¾ì¹ç¤Ë¤Ï
CharaData ¥¯¥é¥¹¤¬£²¤ÄÍÑ°Õ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¤½¤ì¤òList¤Ç¤¢¤ë charaDatas ÊÑ¿ô¤¬´ÉÍý¤·¤Æ¤¤¤ëÀ߷פǤ¹¡£
CharaDataList.cs
¡¡CharaDataList ¥¹¥¯¥ê¥×¥È¤ò¸µ¤Ë¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤Þ¤¹¡£
¡¡Unity¤Îº¸¾å¤Î¥á¥Ë¥å¡¼¤«¤é Assets => Create => Create CharaData ¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£
¿·¤·¤¯¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£Ì¾Á°¤Ï¤½¤Î¤Þ¤Þ¤ÇÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡ã¼ê½çÆ°²è¡ä
https://gyazo.com/0a3beaf71c33136886deca1d28389c6b
¥Õ¥©¥ë¥À²èÁü
¡¡CharaDataList ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀßÄê¤ò¹Ô¤¤¤Þ¤¹¡£
CharaDataList ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òÁªÂò¤¹¤ë¤È¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤ÇÀßÄê¤ò¹Ô¤¨¤Þ¤¹¡£
CharaDataList ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡List¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢Size ¤ò 0 => 3 ¤ËÊѹ¹¤·¡¢£³¤ÄÄø¡¢¥¥ã¥é¤Î¥Ç¡¼¥¿¤òÅÐÏ¿¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
¤Þ¤¿ CharaType ¤Ë¤Ä¤¤¤Æ¤Ï Enum ¤Ç¤¹¤Î¤Ç¡¢¥×¥ë¥À¥¦¥ó¥á¥Ë¥å¡¼¤è¤êÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÎóµó»Ò¤«¤éÁªÂò¤¹¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
Size ¤òÊѹ¹¤·¤¿ºÝ¤Î¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
CharaData ¤ò¤¤¤ì¤¿ºÝ¤Î¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü(¼«Ê¬¤Î¥Ç¡¼¥¿¤Ë¹ç¤ï¤»¤ÆÀßÄꤷ¤Æ¤¯¤À¤µ¤¤)
¡¡°Ê¾å¤ÇÀßÄê¤Ï´°Î»¤Ç¤¹¡£
¡¡¥²¡¼¥àÆâ¤Ç¥×¥ì¥¤¥ä¡¼¤¬»ÈÍѤ¹¤ë¥¥ã¥é¤òÁªÂò¤·¤¿ºÝ¤Ë¡¢GameData¤Ë¿·¤·¤¯ÍÑ°Õ¤·¤¿ currentCharaNo ÊÑ¿ô¤ËÅÐÏ¿¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¤³¤¦¤¹¤ë¤³¤È¤Ç¡¢ÁªÂò¥·¡¼¥ó¤Ë¤ª¤¤¤ÆÁªÂò¤·¤¿¥¥ã¥é¤Î¾ðÊó¤ò¡¢¥²¡¼¥à¤Î¥Ð¥È¥ë¥·¡¼¥ó¤ËÁ«°Ü¤·¤¿ºÝ¤Ë¤â»²¾È¤·¤ÆÍøÍѤ¹¤ë¤³¤È¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¤³¤Î¾ðÊó¤ò¸µ¤Ë¤·¤Æ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È(¥Ç¡¼¥¿¥Ù¡¼¥¹)¤«¤éɬÍפʥ¥ã¥é¤Î¾ðÊó¤ò¼èÆÀ¤·¤ÆÍøÍѤ¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
Î㤨¤Ð¡¢¥×¥ì¥¤¥ä¡¼¤¬¥¥ã¥é£²¤òÁªÂò¤·¤¿¾ì¹ç¤Ë¤Ï¡¢currentCharaNo ÊÑ¿ô¤Ë¤Ï 1 ¤òÅÐÏ¿¤·¤Þ¤¹¡£¤½¤ÎÃͤȥǡ¼¥¿¥Ù¡¼¥¹¤Î CharaData ¤Î»ý¤Ä no ÊÑ¿ô¤È¤ò¾È¹ç¤·¡¢
¹çÃפ·¤¿ no ÊÑ¿ô¤ò»ý¤Ä CharaData ¤ò¥¥ã¥é¤Î¾ðÊó¤È¤·¤Æ¥²¡¼¥àÆâ¤ÇÍøÍѤ¹¤ë¤è¤¦¤ËÈ¿±Ç½èÍý¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡¿·¤·¤¯ÊÑ¿ô¤ò£´¤ÄÀë¸À¤·¤Þ¤¹¡£ÆâÍƤˤĤ¤¤Æ¤Ï³ÆÊÑ¿ô¤Î¥³¥á¥ó¥È¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
¤Þ¤¿¥á¥½¥Ã¥É¤ò£³¤ÄÄɲ䷤ơ¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò°·¤¦¤¿¤á¤ËɬÍפʽèÍý¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£
¡¡SetUpPlayableCharaData ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¡¢playableCharaData ÊÑ¿ô¤Ëº£²ó¤Î¥Ð¥È¥ë¤ÇÍøÍѤ¹¤ë CharaData ¤ò¼èÆÀ¤·¤ÆÂåÆþ¤·¤Þ¤¹¡£
¼èÆÀ¤¹¤ëºÝ¤Ë¤Ï GetCharaData ¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤Æ¡¢¤½¤ÎÌá¤êÃͤòÍøÍѤ·¤Æ¤¤¤Þ¤¹¡£
¡¡SetUpCurrentCharaNo ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¡¢currentCharaNo ÊÑ¿ô¤Ë¡¢º£²ó¤Î¥Ð¥È¥ë¤Ç»ÈÍѤ¹¤ë¥¥ã¥é¤ÎÈÖ¹æ¤òÅÐÏ¿¤·¤Þ¤¹¡£
¸½ºß¤Ï¤Þ¤À̤»ÈÍѤǤ¹¤¬¡¢¤³¤Î¥á¥½¥Ã¥É¤ò¥¥ã¥éÁªÂò»þ¤Ë¸Æ¤Ó½Ð¤¹¤³¤È¤Ë¤è¤Ã¤Æ¡¢GameData¤Ë¥¥ã¥é¤ÎÈÖ¹æ¤òÅÐÏ¿¤Ç¤¤Þ¤¹¡£
¤³¤Î½èÍý¤ò¹Ô¤ï¤Ê¤¤¤È¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÅÐÏ¿¤·¤Æ¤¢¤ë CharaData ¤ÎÈÖ¹æ¤È¾È¹ç¤¬½ÐÍè¤Ê¤¤¤¿¤á¡¢¥²¡¼¥àÆâ¤Ë¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÈ¿±Ç¤¬¹Ô¤¨¤Þ¤»¤ó¡£
¡¡¤½¤Î¤¿¤áº£²ó¤Ï¡¢¥²¡¼¥à³«»ÏÁ°¤Ë currentCharaNo ÊÑ¿ô¤ÎÃͤòľÀÜ¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤ÇÁàºî¤ò¹Ô¤Ã¤Æ¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬È¿±Ç¤µ¤ì¤ë¤«¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤ª¤¤Þ¤¹¡£
GameData.cs
¡¡List¤Ë¤Ï Find ¤È¤¤¤¦¥á¥½¥Ã¥É¤¬¤¢¤ê¤Þ¤¹¡£
List Æâ¤ÎÍ×ÁǤòÀèƬ¤«¤é¸¡º÷¤·¤Æ¡¢»ØÄꤷ¤¿¾ò·ï¤Ë¹çÃפ·¤¿ºÇ½é¤ÎÍ×ÁÇ£±¤Ä¤ò¼è¤ê½Ð¤·¤ÆÌá¤êÃͤȤ·¤ÆÊÖ¤·¤Æ¤¯¤ì¤ë½èÍý¤Ç¤¹¡£
¤³¤ì¤Ï foreach ʸ¤Çµ½Ò¤¹¤ëÆâÍƤÈƱ¤¸½èÍý¤ò£±¹Ô¤Ç½èÍý¤Ç¤¤Þ¤¹¡£
charaDataList.charaDatas.Find(x => x.no == charaNo);
foreach (CharaDataList.CharaData charaData in charaDataList.charaDatas) { if(charaData.no == charaNo) { return charaData; } }
¡¡¤³¤Î£²¤Ä¤Î½èÍý¤ÏƱ¤¸ÆâÍƤˤʤê¤Þ¤¹¡£
ºÇ½é¤Ë¹çÃפ·¤¿Ãͤ¬Âоݤˤʤê¤Þ¤¹¤Î¤Ç¡¢¤Þ¤È¤á¤ÆÊ£¿ô¼èÆÀ¤·¤¿¤¤¾ì¹ç¤ä¡¢¹çÃפ¹¤ë¾ò·ï¤òËþ¤¿¤¹Í×ÁǤ¬Ê£¿ô¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢¤³¤Î½èÍý¤À¤±¤Ç¤Ï¼ÂÁõ¤Ç¤¤Þ¤»¤ó¡£
»²¹Í¥µ¥¤¥È
Samurai BlogÍÍ
¡ÚC#ÆþÌç¡ÛList¤ÎÍ×ÁǤò¸¡º÷¤¹¤ëFind¤Î»È¤¤Êý(FindAll/FindIndex)
https://www.sejuku.net/blog/45252
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤Î¤Ç¡¢GameData ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÁªÂò¤·¤Æ¡¢¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤«¤éÀßÄê¤ò¹Ô¤¤¤Þ¤¹¡£
GameData ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡playableCharaData ÊÑ¿ô¤Ï¥²¡¼¥à¤Î¼Â¹Ô»þ¤ËÂåÆþ¤µ¤ì¤ë¾ðÊó¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢Â¾¤Î£³¤Ä¤Î¾ðÊó¤Ë¤Ä¤¤¤Æ¥¢¥µ¥¤¥ó¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡currentCharaNo ÊÑ¿ô¤Ë¤Ï¡¢¥×¥ì¥¤¥¢¥Ö¥ë¥¥ã¥é¤ÎÈÖ¹æ¤òÅÐÏ¿¤·¤Þ¤¹¡£¥Ç¥Ð¥Ã¥°¤ò¹Ô¤¤¤Þ¤¹¤Î¤Ç¡¢ºÇ½é¤Ï 0 ¤Î¤Þ¤Þ¤Ç¹½¤¤¤Þ¤»¤ó¡£
¡¡charaDataList ÊÑ¿ô¤Ë¤Ï CharaDataList ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£
¡¡usePlayableCharaCount ÊÑ¿ô¤Ë¤Ï¡¢¥×¥ì¥¤¥¢¥Ö¥ë¥¥ã¥é¤ÎÁí¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£
º£²ó¤Ï¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Ë£²¤Äʬ¤Î¥×¥ì¥¤¥ä¥Ö¥ë¥¥ã¥é¤Î¾ðÊó¤òÅÐÏ¿¤·¤¿¤Î¤Ç 2 ¤òÀßÄꤷ¤Þ¤¹¡£
¡¡
¡ã¼ê½çÆ°²è¡¡¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥µ¥¤¥ó¡ä
https://gyazo.com/718a6a05cddadbc7766b99c44ba16dac
GameData ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¢¥µ¥¤¥ó¸å¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡CharaData ¥¯¥é¥¹¤òList¤Ç´ÉÍý¤·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢CharaData ¥¯¥é¥¹¤Î¾ðÊó¤ËÂФ·¤Æ¥¢¥¯¥»¥¹¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢
¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎÂåÆþ¤µ¤ì¤Æ¤¤¤ëÊÑ¿ô¤Î»ØÄê¸å¤Ë¡¢¤½¤Î¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Î´ÉÍý¤·¤Æ¤¤¤ëList¤ÎÊÑ¿ô¤ò»ØÄꤷ¡¢¤½¤ì¤«¤é¸ÄÊ̤ÎCharaData ¤Î»ØÄê¤ò¹Ô¤¦½ñ¼°¤Ë¤Ê¤ê¤Þ¤¹¡£
charaDataList.charaDatas[»²¾È¤·¤¿¤¤CharaData¤ÎÍ×ÁÇÈÖ¹æ].CharaData ¥¯¥é¥¹¤Î»ý¤ÄÊÑ¿ô
¡¡¤Þ¤¿¡¢CharaData ¥¯¥é¥¹¤Ï CharaDataList ¥¯¥é¥¹¤Î»Ò¥¯¥é¥¹¤Ç¤¹¤Î¤Ç¡¢Ã±ÂΤǤϷ¿¤È¤·¤Æ½ñ¤±¤Þ¤»¤ó¡£
ɬ¤º¿Æ¥¯¥é¥¹¤Ç¤¢¤ë CharaDataList ¤òÉÕ¤±¤Æ½ñ¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
Àë¸À¤¹¤ë¾ì¹ç
CharaDataList.CharaData chara
£´¡¥Enemy ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢CharaDataList ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò¥²¡¼¥àÆâ¤ËÈ¿±Ç¤¹¤ë½èÍý¤òÄɲ乤ë
¡¡Enemy¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÃͤò»²¾È¤Ç¤¤ë¤è¤¦¤Ë½èÍý¤òÄɲä·¤Þ¤¹¡£
¡¡Á°Äó¤È¤·¤Æ¡¢Å¨¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¥×¥ì¥Õ¥¡¥Ö¤Ç¤¢¤ê¡¢¥¹¥¯¥ê¥×¥È¤«¤é¥¯¥í¡¼¥ó¤òÀ¸À®¤¹¤ë½èÍý¤¬É¬Íפˤʤê¤Þ¤¹¡£
º£²ó¤Ï Enemy ¥¹¥¯¥ê¥×¥È¤È SetUpEnemy ¥á¥½¥Ã¥É¤Î½¤Àµ¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢¤´¼«Ê¬¤ÎŨ¤Î¥Ç¡¼¥¿¤ò´ÉÍý¤·¤Æ¤¤¤ë¥¹¥¯¥ê¥×¥È¤Ë¡¢°Ê²¼¤Î½èÍý¤òÄɵ¤·¤Æ¤¯¤À¤µ¤¤¡£
Enemy.cs
£µ¡¥GameManager ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢CharaDataList ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò¥²¡¼¥àÆâ¤ËÈ¿±Ç¤¹¤ë½èÍý¤òÄɲ乤ë
¡¡¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î½èÍý¤ò¼ÂÁõ¤¹¤ë¤¿¤á¤Ë¡¢¿·¤·¤¤ÊÑ¿ô¤ò£²¤ÄÀë¸À¤·¤Þ¤¹¡£
¥×¥ì¥¤¥ä¡¼¤òÀ¸À®¤¹¤ë¤¿¤á¤ËɬÍפʥץì¥Õ¥¡¥Ö¤Î¾ðÊó¤ò¥¢¥µ¥¤¥ó¤¹¤ëÊÑ¿ô¤È¡¢UIManager ¥¹¥¯¥ê¥×¥È¤Î¾ðÊó¤ò¥¢¥µ¥¤¥ó¤¹¤ëÊÑ¿ô¤òÍÑ°Õ¤·¤Æ¤¤¤Þ¤¹¡£
¤³¤Î¥¯¥é¥¹¤Ç¤Ï UIManager ¤òÍøÍѤ·¤Æ¤¤¤Þ¤»¤ó¤¬¡¢PlayerController ¤Ë¤ª¤¤¤Æ¥¢¥µ¥¤¥ó¤¬É¬Íפˤʤ뤿¤á¡¢¤³¤Î¥¯¥é¥¹¤ò·Ðͳ¤·¤Æ¥¢¥µ¥¤¥ó¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡´û¸¤Î¥á¥½¥Ã¥É¤Ë¤Ä¤¤¤Æ¤Ï¡¢£²¤Ä¤Î¥á¥½¥Ã¥É¤Ç½èÍý¤òÄɲᦽ¤Àµ¤·¤Æ¤¤¤Þ¤¹¡£
¡¡Start ¥á¥½¥Ã¥ÉÆâ¤Ë½èÍý¤ò½¤Àµ¤·¡¢GameData¤Ë¥Ð¥È¥ë¤Ç»ÈÍѤ¹¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤Î¼èÆÀ¤È¡¢¥×¥ì¥¤¥ä¡¼¤ÎÀ¸À®¤òÄɲä·¤Þ¤¹¡£
¡¡GenerateEnemy¥á¥½¥Ã¥ÉÆâ¤Î½èÍý¤ò½¤Àµ¤·¡¢À¸À®¤µ¤ì¤¿Å¨¤¬¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¾ðÊó¤ò»²¾È¤Ç¤¤ë¤è¤¦¤Ë¡¢SetUpEnemy ¥á¥½¥Ã¥É¤Ë°ú¿ô¤òÄɲä·¤Þ¤¹¡£
¡¡¿·¤·¤¯ CreatePlayer ¥á¥½¥Ã¥É¤òÄɲ䷤ơ¢¥×¥ì¥Õ¥¡¥Ö¤«¤é¥×¥ì¥¤¥ä¡¼¤òÀ¸À®¤·¡¢¤½¤Î¸å¡¢¥¥ã¥é¤Î¥Ç¡¼¥¿¤òÍøÍѤ·¤Æ
ÁªÂò¤µ¤ì¤Æ¤¤¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò»ý¤Ã¤¿¥×¥ì¥¤¥ä¡¼¤òºîÀ®¤·¤Þ¤¹¡£
¡¡¤½¤ì°Ê³°¤Î½èÍý¤Ë¤Ä¤¤¤Æ¤Ï³ä°¦¤·¤Æ¤¤¤Þ¤¹¡£
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Þ¤·¤¿¤Î¤Ç¡¢¥¢¥µ¥¤¥ó¾ðÊó¤òÄɲä·¤Þ¤¹¡£
¡¡PlayerPrefab ÊÑ¿ô¤Ë¤Ï¡¢ºîÀ®¤·¤Æ¤¢¤ë¥×¥ì¥¤¥ä¡¼ÍѤΥ¥ã¥é¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¥×¥ì¥Õ¥¡¥Ö¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡UIManager ÊÑ¿ô¤Ë¤Ï UIManager ¥¹¥¯¥ê¥×¥È¤Î¥¢¥µ¥¤¥ó¤¬É¬Íפˤʤê¤Þ¤¹¤Î¤Ç¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë UIManager ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£
GameManager ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
£¶¡¥PlayerController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢CharaDataList ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¤ò¥²¡¼¥àÆâ¤ËÈ¿±Ç¤¹¤ë½èÍý¤òÄɲ乤ë
¡¡InitPlayer ¥á¥½¥Ã¥É¤ò½¤Àµ¤·¤Æ¡¢GameData ¥¹¥¯¥ê¥×¥È¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¡¢º£²ó¤Î¥Ð¥È¥ë¤Ç»ÈÍѤ¹¤ë¥¥ã¥é¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¾ðÊó¤ò¸µ¤Ë¡¢³ÆǽÎÏÃͤÎÃͤòÀßÄꤷ¤Þ¤¹¡£
¡¡¤Þ¤¿ Start ¥á¥½¥Ã¥É¤Ë¤ª¤¤¤Æ InitPlayer ¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢¤½¤Î½èÍý¤Ï¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤½¤ì°Ê³°¤Î½èÍý¤Ë¤Ä¤¤¤Æ¤Ï³ä°¦¤·¤Þ¤¹¡£
PlayerController.cs
¡¡¥×¥ì¥¤¥ä¡¼ÍѤΥ¥ã¥é¤Î¥×¥ì¥Õ¥¡¥Ö¤ò³Îǧ¤·¤Æ¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¼èÆÀ½ÐÍè¤ë¾ðÊó¤Ë¤Ä¤¤¤Æ¤Ï¤¹¤Ù¤Æ½é´ü²½¤·¤Æ¤ª¤¤Þ¤¹¡£(Enum ¤Ï¶õ¤Ë¤Ç¤¤Þ¤»¤ó¤Î¤Ç¡¢Å¬Åö¤ÊÎóµó»Ò¤Ë¤·¤Æ¤ª¤¤Þ¤¹)
¤³¤¦¤·¤Æ¤ª¤¯¤³¤È¤Ë¤è¤ê¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é»ØÄꤵ¤ì¤¿¥¥ã¥é¤Î¥Ç¡¼¥¿¤¬¤Á¤ã¤ó¤ÈÈ¿±Ç¤µ¤ì¤ë¤«¤É¤¦¤«¤ò³Îǧ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¥¥ã¥éÍѤΥץì¥Õ¥¡¥Ö¤Î¥Ç¡¼¥¿(»²¹Í²èÁü¤Ç¤¹¤Î¤Ç¡¢ÊÑ¿ô̾¤Ê¤É¤Ï°Û¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¤¬¤¢¤ê¤Þ¤¹)
¡¡¼¡¤Ï¡¢currentCharaNo ÊÑ¿ô¤ÎÃͤò 1 ¤ËÊѹ¹¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î CharaData.no ¤¬ 1 ¤Ç¤¢¤ë¥Ç¡¼¥¿¤ò¼èÆÀ¤Ç¤¤ì¤ÐÀ®¸ù¤Ç¤¹¡£
¡¡
GameData ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀßÄê
¼Â¹Ô»þ(PlayableCharaData ¤ÎÃͤ¬¤¹¤Ù¤Æ CharaData ¤ÎÃͤǹ¹¿·¤µ¤ì¤ë)
¼Â¹Ô»þ¤Î Player ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀßÄêÃͤˡ¢GameData ¤ÎPlayableCharaData ¤ÎÃͤ¬È¿±Ç¤µ¤ì¤Æ¤¤¤ë
¡¡¥×¥ì¥¤¥ä¡¼¤Ø¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÈ¿±Ç¤¬ÌäÂê¤Ê¤±¤ì¤Ð¡¢¼¡¤ÏŨ¦¤Î³Æ¥Ç¡¼¥¿¤¬¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÃͤò»²¾È¤Ç¤¤ë¤«¤É¤¦¤«¤ò³Îǧ¤·¤Þ¤¹¡£
¡¡ºÇ½é¤Ë¥×¥ì¥¤¥ä¡¼¤Î¥×¥ì¥Õ¥¡¥Ö¤ÈƱ¤¸¤è¤¦¤Ë¡¢Å¨¤Î¥×¥ì¥Õ¥¡¥Ö¤òÁªÂò¤·¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÃͤò»²¾È¤¹¤ë¤â¤Î¤Ë¤Ä¤¤¤Æ¤Ï½é´ü²½¤·¤Æ¤ª¤¤Þ¤¹¡£
¡¡¥²¡¼¥à¤ò¼Â¹Ô¤·¤ÆŨ¤òÀ¸À®¤µ¤»¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ç³ÆÃͤò³Îǧ¤·¡¢Å¨ÍѤΥǡ¼¥¿¤¬ÂåÆþ¤µ¤ì¤Æ¤¤¤ì¤ÐÀ®¸ù¤Ç¤¹¡£
¼Â¹Ô»þ¤Î¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Î Size ¤ò 3 => 4 ¤ËÊѹ¹¤·¤Æ¡¢£²¼ïÎàÌܤÎŨ¤Î¥Ç¡¼¥¿¤ò Element 3 ¤È¤·¤ÆÄɲä·¤Þ¤¹¡£
¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀßÄê²èÁü
¡¡¤Þ¤¿¡¢GameManager ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò³Îǧ¤·¡¢£²¼ïÎàÌܤÎŨ¤Î¥×¥ì¥Õ¥¡¥Ö¤¬¥¢¥µ¥¤¥ó¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤ò³Îǧ¤·¤Þ¤¹¡£
GameManager ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡ºÇ¸å¤Ë StageList ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò³Îǧ¤·¤Æ¡¢AppearNum ¤ÎÃͤò 0¡¢¤¢¤ë¤¤¤Ï 1 ¤ËÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
¤³¤ÎÃͤ¬Å¨¤Î¼ïÎà¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢0 ¤Î¾ì¹ç¤Ë¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î£±¼ïÎàÌÜ(CharaDataList¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎElement 2)¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëŨ¤Î¥Ç¡¼¥¿¤¬»²¾È¤µ¤ì
1 ¤Î¾ì¹ç¤Ë¤Ï £²¼ïÎàÌÜ(CharaDataList¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎElement 3) ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëŨ¤Î¥Ç¡¼¥¿¤¬»²¾È¤µ¤ì¤Þ¤¹¡£
StageList ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Î AppearNum(¤³¤³¤Ç¤Ï 1¡¢0¡¢1)
¡¡¥²¡¼¥à¤ò¼Â¹Ô¤·¤ÆŨ¤Î¼ïÎबÊѤï¤Ã¤¿¾ì¹ç¤Ç¤â¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥Ç¡¼¥¿¤ò»²¾È¤Ç¤¤Æ¤¤¤ë¤«¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
Ʊ¤¸Å¨¤Î¥×¥ì¥Õ¥¡¥Ö¤Î¥Ç¡¼¥¿¤¬¡¢°Û¤Ê¤ë¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÃͤò»²¾È¤¹¤ë¤¿¤áÊѲ½¤¹¤ë
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£¤ª¤Ä¤«¤ì¤µ¤Þ¤Ç¤·¤¿¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯