ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2023ǯ01·î14Æü(ÅÚ) 23:30:05ÍúÎò
¡¡°Ê²¼¤ÎÆâÍƤǽçÈ֤˼ÂÁõ¤ò¿Ê¤á¤Æ¤¤¤¤Þ¤¹¡£
¼ê½ç£±£²¡¡¡¼¥×¥ì¥¤¥ä¡¼¤Î¹¶·â½èÍý¡¼
£±£¹¡¥¥×¥ì¥¤¥ä¡¼¤Î¹¶·â½èÍý
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦¥×¥í¥Ñ¥Æ¥£ ¡¡¡¦¥¯¥é¥¹Æâ¤Ë enum ¤òºîÀ®¤¹¤ë(Æþ¤ì»Ò¹½Â¤) ¡¡¡¦while ʸ¤È¥³¥ë¡¼¥Á¥ó¥á¥½¥Ã¥É¤òÍøÍѤ·¤¿¥ë¡¼¥×½èÍý ¡¡¡¦¥í¡¼¥«¥ë´Ø¿ô
¡¡enum¤òÍøÍѤ·¤¿¥×¥ì¥¤¥ä¡¼¤Î¸½ºß¤Î¾õÂ֤δÉÍýÊýË¡¤Ë¤Ä¤¤¤ÆÀ߷פ·¤Þ¤¹¡£
¡¡PlayerController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢¥×¥ì¥¤¥ä¡¼¤Î¸½ºß¤Î¾õÂÖ¤ò´ÉÍý¤¹¤ë enum ¤Ç¤¢¤ë PlayerState ¤ò¿·¤·¤¯ºîÀ®¤·¤Þ¤¹¡£
¡¡¤³¤Î PlayerState ¤ÎÎóµó»Ò¤Ë¤Ï Move ¤ä Battle_Before ¤È¤¤¤Ã¤¿¡¢¥×¥ì¥¤¥ä¡¼¤Î¥²¡¼¥àÆâ¤Ç¤Î¸½ºß¤Î¾õÂÖ¤òɽ¸½¤¹¤ëÃͤòÍÑ°Õ¤·¡¢¤½¤ì¤ò´ÉÍýÍѤÎÊÑ¿ô¤ËÂåÆþ¤·¤Æ´ÉÍý¤·¤Þ¤¹¡£
ÊÑ¿ô¤Ë¤è¤ê´ÉÍý¤¹¤ë¤³¤È¤Ç¡¢¤¤¤º¤ì¤«¤Î£±¤Ä¤ÎÎóµó»Ò¤Î¾õÂ֤ΤߤòÊÝ»ý¤¹¤ë¤³¤È¤Ë¤Ê¤ë¤¿¤á¡¢¤³¤Îµ¡Ç½¤òÍøÍѤ¹¤ë¤³¤È¤Ç¡¢¥×¥ì¥¤¥ä¡¼¤Î¸½ºß¤Î¾õÂÖ¤ò°ì¸µ²½¤·¤Æ´ÉÍý¤Ç¤¤Þ¤¹¡£
¡ÊÊ£¿ô¤Î°Û¤Ê¤ë¥×¥ì¥¤¥ä¡¼¤Î¾õÂÖ¤¬½Å¤Ê¤ë¤³¤È¤¬¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£Î㤨¤Ð¡¢Move ¤È Reslut ¤È¤¤¤¦Îóµó»Ò¤Î¾õÂ֤˰ì½ï¤Ë¤Ê¤é¤Ê¤¤¤¿¤á¡¢¾õÂÖ¤¬½ÅÊ£¤¹¤ëÌäÂê¤òËɤ²¤Þ¤¹¡Ë
¡¡¥×¥ì¥¤¥ä¡¼¤Î¸½ºß¤Î¾õÂÖ¤ÎÀ©¸æ½èÍý¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£¤¹¤Ù¤Æ PlayerController ¥¹¥¯¥ê¥×¥ÈÆâ¤ÇÀ©¸æ¤ò¹Ô¤¤¤Þ¤¹¡£
£±¡¥Update ¥á¥½¥Ã¥ÉÆâ¤Ë½èÍý¤òÄɲä·¡¢PlayerState ¤¬ Move °Ê³°¤Î¾õÂ֤Ǥϥ᥽¥Ã¥ÉÆâ¤Î½èÍý(°ÜÆ°ÍѤΥ¡¼ÆþÎϽèÍý¤Ê¤É)¤¬¼Â¹Ô¤µ¤ì¤Ê¤¤¤è¤¦¤ËÄä»ß¤¹¤ëÀ©¸æ½èÍý¤òÄɲä¹¤ë ¡¡¡¡¡¡¢ £²¡¥FixedUpdate ¥á¥½¥Ã¥ÉÆâ¤Ë½èÍý¤òÄɲä·¡¢PlayerState¤¬ Move°Ê³°¤Î¾õÂ֤Ǥϥ᥽¥Ã¥ÉÆâ¤Î½èÍý(°ÜÆ°½èÍý¤Ê¤É)¤¬¼Â¹Ô¤µ¤ì¤Ê¤¤¤è¤¦¤ËÄä»ß¤¹¤ëÀ©¸æ½èÍý¤òÄɲä¹¤ë ¡¡¡¡¡¡¢ £³¡¥AutoBattle ¥á¥½¥Ã¥ÉÆâ¤Î½èÍý¤òÄɲä·¡¢¥Ð¥È¥ë¤Î³«»Ï¤Ë¹ç¤µ¤»¤Æ PlayerState ¤ò Battle_Before ¤ËÀÚ¤êÂؤ¨¤ë¡£¤³¤Î¾õÂ֤δ֡¢¥×¥ì¥¤¥ä¡¼¤Ï¹¶·â¤ò·«¤êÊÖ¤¹¤è¤¦¤ËÀ©¸æ¤¹¤ë ¡¡¡¡¾ã³²Êª¤Î Hp ¤¬ 0 °Ê²¼¤Ë¤Ê¤Ã¤¿¤é PlayerState ¤ò Result ¤ËÀÚ¤êÂؤ¨¤ë¡£¤³¤Î¾õÂ֤ˤʤ뤳¤È¤Ç¥×¥ì¥¤¥ä¡¼¤Ï¹¶·â¤ò½ªÎ»¤·¡¢¥Ð¥È¥ë¸å¤Î½èÍý¤Ë°Ü¹Ô¤¹¤ë ¡¡¡¡¤½¤Î¸å¡¢ºÆÅÙ PlayerState ¤ò Move ¤ËÀÚ¤êÂؤ¨¤ë ¡¡¡¡¡¡¢ £´¡¥PlayerState ¤¬ Move ¤Ë¤Ê¤Ã¤¿¤Î¤Ç¡¢Ää»ß¤·¤Æ¤¤¤¿ Update ¥á¥½¥Ã¥É¤È FixedUpdate ¥á¥½¥Ã¥ÉÆâ¤Î½èÍý¤¬Æ°¤»Ï¤á¤ë ¡¡¡¡¡¡¢ £µ¡¥¤³¤ì¤ò·«¤êÊÖ¤¹
¡¡¤³¤Î¤è¤¦¤ÊÀ©¸æ¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡¾ã³²Êª¤ËÂѵ×ÎÏ¡¦ÂÎÎϤγµÇ°¤òÍ¿¤¨¤Þ¤¹¡£º£²ó¤Ï hp ¤È¤¤¤¦Ì¾Á°¤Î int ·¿¤ÎÊÑ¿ô¤òºîÀ®¤·¡¢¤³¤ÎÃͤò¾ã³²Êª¤ÎÂѵ×ÎϤȤ·¤ÆÍøÍѤ·¤Þ¤¹¡£
ÊÑ¿ô¤Î̾Á°¤ÏǤ°Õ¤Ç¤¹¤¬¡¢¤½¤ÎÊÑ¿ô¤ò¥×¥í¥°¥é¥àÆâ¤Ë¤ª¤¤¤Æ¡¢¤É¤¦¤¤¤Ã¤¿Ìò³ä¤È¤·¤ÆÍøÍѤ¹¤ë¤«¤òÀ߷פ·¤¿¾å¤Ç̾¾Î¤ò¹Í¤¨¤ë¤Èʬ¤«¤ê¤ä¤¹¤¯¤Ê¤ê¤Þ¤¹¡£
¡¡¤Þ¤¿ hp ÊÑ¿ô¤Ï private ½¤¾þ»Ò¤È¤·¤Æ³°Éô¤Î¥¯¥é¥¹¤«¤é¤ÏľÀÜ¥¢¥¯¥»¥¹¤Ç¤¤Ê¤¤¾õÂ֤ˤ·¤Æ¤ª¤¤Þ¤¹¡£
Âå¤ï¤ê¤Ë¥×¥í¥Ñ¥Æ¥£¤òºîÀ®¤·¡¢¥×¥í¥Ñ¥Æ¥£¤òÄ̤¸¤Æ¡¢hp ÊÑ¿ô¤Ø¤Î¥¢¥¯¥»¥¹¤ò¹Ô¤¦¤è¤¦¤ËÀ߷פ·¤Þ¤¹¡£
¡¡¤¿¤À¤·¡¢¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤è¤ê¡¢ÃͤòǤ°Õ¤ËÆþÎÏ¡¦Êѹ¹¡¦³Îǧ¤Ç¤¤ë¤è¤¦¤Ë¤·¤Æ¤ª¤¯¤¿¤á¡¢hp ÊÑ¿ô¤Ë¤Ï SerializeField °À¤ò°ì»þŪ¤ËÉÕÍ¿¤·¤Æ¤ª¤¤Þ¤¹¡£
¤³¤¦¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¥Ç¥Ð¥Ã¥°¤ò¹Ô¤¤¤ä¤¹¤¯¤Ê¤ê¤Þ¤¹¡£
Àµ¼°¤Ê±¿ÍѤ¬»Ï¤Þ¤Ã¤¿¤é¡¢SerializeField °À¤Ïºï½ü¤·¡¢private ½¤¾þ»Ò¤Î¤ß¤ÎÊÑ¿ô¤È¤·¤Þ¤¹¡£
¡¡¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¥×¥í¥°¥é¥ß¥ó¥°¤Ë¤Ï¥«¥×¥»¥ë²½¤È¤¤¤¦³µÇ°¤¬¤¢¤ê¡¢¤Ê¤ë¤Ù¤¯ÊÑ¿ô¤Ï£±¤Ä¤Î¥¯¥é¥¹Æâ¤Ç¤Î¤ß¥¢¥¯¥»¥¹¤·¤Æ´ÉÍý¤Ç¤¤ë¤è¤¦¤Ë¿´¤¬¤±¤Þ¤¹¡£
¤¿¤À¤·¡¢³°Éô¤Î¥¯¥é¥¹¤ËÂФ·¤Æ¾ðÊó¤òÄ󶡤·¤¿¤¤¾õ¶·¤â¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢¤½¤¦¤¤¤Ã¤¿¥±¡¼¥¹¤ËÂбþ¤¹¤ë¤¿¤á¤Ë¥×¥í¥Ñ¥Æ¥£¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
ObstacleBase.cs
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¡¢¥»¡¼¥Ö¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤Î¤Ç¡¢¤³¤Î¥¹¥¯¥ê¥×¥È¤¬¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¾ã³²Êª¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥Ò¥¨¥é¥ë¥¡¼¤ÇÁªÂò¤·¤Æ³Îǧ¤·¤Þ¤¹¡£
¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤è¤ê ObstacleBase ¥¹¥¯¥ê¥×¥È¤ò³Îǧ¤¹¤ë¤È¡¢Hp ÊÑ¿ô¤¬Äɲ䵤ì¤Æ¤¤¤Þ¤¹¡£
¤³¤ÎÃͤˤĤ¤¤Æ¤Ï¡¢ºÇ¸å¤Î¥Ç¥Ð¥Ã¥°¤ÎÃʳ¬¤ÇÆþÎϤ·¤Þ¤¹¤Î¤Ç¡¢¸½»þÅÀ¤Ç¤Ï 0 ¤Î¤Þ¤Þ¤ÇÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡ã¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü¡ä
¡ã¥×¥í¥Ñ¥Æ¥£¡ä
¡¡¥×¥í¥Ñ¥Æ¥£¤È¤Ï¡¢¥¯¥é¥¹³°Éô¤«¤é¸«¤ë¤È¥á¥ó¥Ð¡¼ÊÑ¿ô¤Î¤è¤¦¤Ë¿¶¤ëÉñ¤¤¡¢ ¥¯¥é¥¹ÆâÉô¤«¤é¸«¤ë¤È¥á¥½¥Ã¥É¤Î¤è¤¦¤Ë¿¶¤ëÉñ¤¦µ¡Ç½¤Ç¤¹¡£
¤½¤Î¤¿¤á¡¢¼ÂÁõ¾õÂÖ(private½¤¾þ»Ò¤Î¤Þ¤Þ)¤òÊѹ¹¤¹¤ë¤³¤È¤Ê¤¯¡¢³°Éô¥¯¥é¥¹¤Ø¤Î»²¾È¡¦Êѹ¹¤ò¹Ô¤¨¤ëµ¡Ç½¤Ç¤¢¤ë¤¿¤á¡¢°·¤¤¤ò³Ð¤¨¤Æ¤ª¤¯¤ÈÈó¾ï¤ËÊØÍø¤Ç¤¹¡£
¡¡¤³¤ÎÆÃÀ¤è¤ê¡¢¥×¥í¥Ñ¥Æ¥£¤òºîÀ®¤¹¤ë¾ì¹ç¡¢Â¿¤¯¤Ï private ½¤¾þ»Ò¤ÎÊÑ¿ô¤Î¾ðÊó¤ò°·¤¦¤¿¤á¤ËºîÀ®¤·¤Þ¤¹¡£
º£²ó¤Î¾ì¹ç¤Ï¡¢ObstacleBase ¥¯¥é¥¹¤Î hp ÊÑ¿ô¤ËÂФ·¤Æ¤Î¥×¥í¥Ñ¥Æ¥£¤òºîÀ®¤·¤Þ¤¹¡£
¡ã¥×¥í¥Ñ¥Æ¥£¤ÎºîÀ®¡ä
private int hp; ¡¡¡¡/// <summary> /// hp ¤Î¥×¥í¥Ñ¥Æ¥£ /// </summary> public int Hp { get { return hp; } set { hp = value; } }
¡¡¾åµ¤Î¤è¤¦¤Ê¥×¥í¥Ñ¥Æ¥£¤òºîÀ®¤¹¤ë¤³¤È¤Ç¡¢private ½¤¾þ»Ò¤ÇÀë¸À¤·¤Æ¤¤¤ë hp ÊÑ¿ô¤ò
¥×¥í¥Ñ¥Æ¥£¤òÍøÍѤ¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢³°Éô¥¯¥é¥¹¤«¤é»²¾È½ÐÍè¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£
¡¡¥×¥í¥Ñ¥Æ¥£¤Ï public ½¤¾þ»Ò¤Ç¤Ï¤¢¤ê¤Þ¤¹¤¬¡¢¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ë¤Ïɽ¼¨¤µ¤ì¤Þ¤»¤ó¡£
¤½¤Î¤¿¤á¥Ç¥Ð¥Ã¥°ºî¶È¤Î¸úΨ²½¤Î¤¿¤á¡¢hp ÊÑ¿ô¤Ë SerializeField °À¤òÉÕÍ¿¤·¤Æ¡¢private ¤Ç¤¢¤ë¾ðÊó¤ò¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ëɽ¼¨¤·¤Æ¤â¤è¤¤¤Ç¤·¤ç¤¦¡£
¡¡private ½¤¾þ»Ò¤Ë¤ÆÀë¸À¥Õ¥£¡¼¥ë¥É¤ÇÀë¸À¤·¤¿ÊÑ¿ô¤Ë¤Ä¤¤¤Æ¤Ï¡¢³°Éô¤Î¥¯¥é¥¹¤«¤é¤Ï»²¾È¡¦Êѹ¹¤ò¹Ô¤¦¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£
¤³¤Î¤È¤»²¾È¤ò¹Ô¤¤¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢ÊÑ¿ô¤Î½¤¾þ»Ò¤ò public ½¤¾þ»Ò¤ËÊѹ¹¤·¤ÆÂбþ¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯
¥×¥í¥Ñ¥Æ¥£¤Î»ý¤Ä get ¥¡¼¥ï¡¼¥É¤òÍøÍѤ·¤Æ¡¢Ìá¤êÃͤòÍøÍѤ·¤Æ private ½¤¾þ»Ò¤ÎÊÑ¿ô¤ò³°Éô¥¯¥é¥¹¤Ë»²¾È¤µ¤»¤ë¤³¤È¤ÇÂбþ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡¤³¤¦¤¤¤Ã¤¿µ¡Ç½¤òÃΤäƤ¤¤ë¤«¤É¤¦¤«¤ÇÀß·×Éôʬ¤¬Â礤¯ÊѤï¤ê¤Þ¤¹¡£
¿§¡¹¤Êµ¡Ç½¤òÃΤäƤ¤¤ì¤Ð¡¢Î㤨¤Ð¡¢º£²ó¤Ï¥×¥í¥Ñ¥Æ¥£¤ò»È¤ª¤¦¤«¡¢¤É¤¦¤·¤è¤¦¤«¡¢¤È¤¤¤¦ÁªÂò»è¤¬Áý¤¨¤Þ¤¹¤¬¡¢ÃΤé¤Ê¤±¤ì¤ÐÁªÂò»è¼«ÂΤ¬À¸¤Þ¤ì¤Þ¤»¤ó¡£
¡¡À߷פΰú¤½Ð¤·¤ò¹¤²¤ë¾å¤Ç¤â¡¢¿·¤·¤¤µ»½Ñ¤ò³Ð¤¨¤ë¤³¤È¡¢¾ï¤Ë³Ø½¬¤¹¤ë°ÕÍߤȸþ¾å¿´¤ò»ý¤Ä¤³¤È¤¬¥×¥í¥°¥é¥à³Ø½¬¤Î¥Ý¥¤¥ó¥È¤Ç¤¹¡£
¡¡¥×¥í¥Ñ¥Æ¥£¤òÍøÍѤ·¤¿À߷פˤè¤ê¡¢public ¤Ç¤Ï¤Ê¤¤ÊÑ¿ô¤ò³°Éô¥¯¥é¥¹¤ÇÍøÍѤǤ¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
³°Éô¤«¤é¥×¥í¥Ñ¥Æ¥£¤ò¸Æ¤Ó½Ð¤·¤ÆÌá¤êÃͤò»²¾È¤¹¤ë½èÍý¤Î¤³¤È¤ò¥²¥Ã¥¿¡¼(getter)¤È¸Æ¤Ó¤Þ¤¹¡£
get { return hp; }
¡¡Æ±Íͤˡ¢private ½¤¾þ»Ò¤ÎÃͤò³°Éô¥¯¥é¥¹¤è¤êÊѹ¹¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢¥×¥í¥Ñ¥Æ¥£¤òÃç²ð¤¹¤ë¼êË¡¤ò»È¤Ã¤Æ½ñ¤´¹¤¨¤ë½èÍý¤ò¼ÂÁõ½ÐÍè¤Þ¤¹¡£
¤³¤Á¤é¤Î½èÍý¤Ï set ¥¡¼¥ï¡¼¥É¤òÍøÍѤ·¤Æ½èÍý¤òµ½Ò¤·¤Þ¤¹¡£¤½¤Î¤¿¤á¡¢¤³¤Î½èÍý¤ò¥»¥Ã¥¿¡¼(setter)¤È¸Æ¤Ó¤Þ¤¹¡£
¡¡set ¥¡¼¥ï¡¼¥ÉÆâ¤Ë¤Ï¸Æ¤Ó½Ð¤·¸µ¤«¤é value ¤ÎÃͤǾðÊó¤¬ÆϤ¤¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢value ¤ÎÃͤòÍøÍѤ¹¤ë¤³¤È¤Ç private ½¤¾þ»Ò¤ÎÊÑ¿ô¤ËÂåÆþ½èÍý¤ò¹Ô¤¦¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
set { hp = value; }
¡¡¤³¤Î½èÍý¤ò³°Éô¤Î¥¯¥é¥¹¤«¤é¼Â¹Ô¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢»²¾È¤¹¤ë¾ì¹ç¤ÈƱ¤¸¤Ç¡Ö¥¯¥é¥¹¤ÎÊÑ¿ô.¥×¥í¥Ñ¥Æ¥£Ì¾¡×¤Èµ½Ò¤¹¤ë¤³¤È¤ÇÃͤνñ¤´¹¤¨¤¬²Äǽ¤Ç¤¹¡£
¡¡get¡¢set ¥¡¼¥ï¡¼¥É¤Ï¤É¤Á¤é¤«ÊÒÊý¤À¤±¤Ç¤âµ½Ò¤Ç¤¤Þ¤¹¡£¤Þ¤¿¡¢µ½Ò¤¹¤ë½çÈÖ¤âǤ°Õ¤Ç¤¹¡£set ¤«¤é½ñ¤»Ï¤á¤ë¤³¤È¤â½ÐÍè¤Þ¤¹¡£
¤Þ¤¿¥×¥í¥Ñ¥Æ¥£ÆâÉô¤Ë¾ò·ï¼°¤òÍÑ°Õ¤·¤Æ¡¢¤½¤Î·ë²Ì¤Ë¹ç¤ï¤»¤Æ½èÍý¤òÊѹ¹¤¹¤ëµ½Ò¤â½ÐÍè¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
̤³ÎǧÈô¹Ô C ÍÍ
¥×¥í¥Ñ¥Æ¥£
https://ufcpp.net/study/csharp/oo_property.html
FEnet¥¤¥ó¥Õ¥éÍÍ¡¡¥Æ¥Ã¥¯¥Ö¥í¥°
C#¤Î¥×¥í¥Ñ¥Æ¥£¤ò»È¤¤¤³¤Ê¤½¤¦¡ª¤µ¤Þ¤¶¤Þ¤Ê¼ÂÁõÊýË¡¤ò¾Ò²ð
https://www.fenet.jp/infla/column/technology/c%E3%...
¡¡PlayerState ¤Î enum ¤òºîÀ®¤·¡¢¥×¥ì¥¤¥ä¡¼¤Î¾õÂ֤ˤĤ¤¤Æ¼ïÎà¤ÎÅÐÏ¿¤ò¹Ô¤¤¤Þ¤¹¡£
¤Þ¤¿¡¢ PlayerState ·¿¤ÎÊÑ¿ô¤âºîÀ®¤·¡¢¸½ºß¤Î¾õÂÖ¤ò´ÉÍý½ÐÍè¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡ºîÀ®¤·¤¿ PlayerState ¤òÍøÍѤ·¤¿À©¸æ¤Î½èÍý¤òÄɲä·¡¢¥×¥ì¥¤¥ä¡¼¤Î¹¶·â¤Î½èÍý¡¢
¤ª¤è¤Ó¡¢¹¶·â¤Î´Ö¤Ï°ÜÆ°¤ä¥¡¼ÆþÎϤòÀ©¸Â¤¹¤ëÀ©¸æ¤Î½èÍý¤òÄɲä·¤Þ¤¹¡£
¡¡
¡¡¤É¤¦¤¤¤Ã¤¿½èÍý¤¬¡¢¤É¤Î¥¿¥¤¥ß¥ó¥°¤Ç¼Â¹Ô¤µ¤ì¤ì¤ÐÀ©¸æ¤È¤·¤ÆÀ®Î©¤¹¤ë¤Î¤«¤ò¹Í¤¨¤Æ¤«¤é¡¢½èÍý¤ÎÆâÍƤò³Îǧ¤·¤Æ¼ÂÁõ¤·¤Æ¤¯¤À¤µ¤¤¡£
PlayerController.cs
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤ò¤·¤Þ¤¹¡£
¡¡enum(¥¤¥Ë¥å¡¼¥à) ¤Ï¥²¡¼¥àÆâ¤ËÅо줵¤»¤¿¤¤¼ïÎà¤Î¾ðÊó¤ò¡¢Îóµó»Ò(¤ì¤Ã¤¤ç¤·)¤È¤¤¤¦·Á¤Ç¼ïÎà¤òºîÀ®¤Ç¤¤Þ¤¹¡£
º£²ó¤Ï¡¢¥×¥ì¥¤¥ä¡¼¤Î¾õÂ֤μïÎà¤È¤¤¤¦¾ðÊó¤ò PlayerState ¤È¤¤¤¦Ì¾Á°¤ÇºîÀ®¤·¡¢¤½¤ÎÃæ¤Ë¥×¥ì¥¤¥ä¡¼¤Î¾õÂ֤μïÎà¤òÅÐÏ¿¤·¤Æ¤ª¤¤Þ¤¹¡£
¤³¤ì¤ÏÄɲòÄǽ¤Ê¾ðÊó¤Ç¤¹¤Î¤Ç¡¢À衹¤Ë¥×¥ì¥¤¥ä¡¼¤Î¾õÂ֤μïÎबÁý¤¨¤Æ¤âÂбþ¤Ç¤¤Þ¤¹¡£
¡¡enum ·¿¤ÎÀë¸À¤Ï£±¤Ä¤Î¥¹¥¯¥ê¥×¥È¡¦¥Õ¥¡¥¤¥ë¤ËÀë¸À¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¤·¡¢¥¯¥é¥¹Æâ¤ËÀë¸À¤¹¤ë(Æþ¤ì»Ò¹½Â¤¤È¤¤¤¤¤Þ¤¹)¤³¤È¤â½ÐÍè¤Þ¤¹¡£
º£²ó¤Ï PlayerController ¥¯¥é¥¹Æâ¤ËÆþ¤ì»Ò¹½Â¤¤Ç PlayerState ·¿¤Î enum ¤ÎÀë¸À¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£
PlayerController.cs
using System.Collections.Generic; using UnityEngine; [System.Serializable] public class PlayerController : MonoBehaviour { ¡¡¡¡// ¾¤ÎÊÑ¿ô¤ÎÀë¸À /// <summary> /// ¥×¥ì¥¤¥ä¡¼¤Î¾õÂ֤μïÎà /// </summary> public enum PlayerState { Move, Battle_Before, Battle_After, Result, Info, GameUp } ¡Á¾Êά¡Á }
¡¡¤³¤³¤ÇÀë¸À¤·¤¿¾ðÊó¤Ï¡¢¿·¤·¤¯ PlayerState ·¿¤ÎÊÑ¿ô¤òºîÀ®¤¹¤ë¤³¤È¤ÇÍøÍѤǤ¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
public PlayerState currentPlayerstate;
¡¡¤³¤ÎÊÑ¿ô¤Ë¤Ï¡¢PlayerState ·¿¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÎóµó»Ò¤Î¤¦¤Á¡¢¤¤¤º¤ì¤«£±¤Ä¤À¤±¤¬ÂåÆþ¤µ¤ì¤Þ¤¹¡£
Î㤨¤Ð¡¢Move ¤È Result ¤¬°ì½ï¤Ë¤Ê¤ê½ÅÊ£¤·¤Æ¤·¤Þ¤¦¥±¡¼¥¹¤òÈò¤±¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡£²¤Ä°Ê¾å¤Î¾ðÊó¤ò´ÉÍý¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢enum ¤Ç¤½¤Î¼ïÎà¤òÅÐÏ¿¤·¤Æ¤ª¤¯¤³¤È¤ò¤ª¤¹¤¹¤á¤·¤Þ¤¹¡£
enum ¤òÍøÍѤ¹¤ë¾ì¹ç¡¢¤½¤ÎÅÐÏ¿¤·¤Æ¤¢¤ëÎóµó»Ò¤«¤é¤·¤«¾ðÊó¤ò»ØÄê¤Ç¤¤Þ¤»¤ó¤Î¤Ç¡¢
Î㤨¤Ð¡¢Ê¸»úÎó¤È°Û¤Ê¤ê¡¢»ØÄê¤ËºÝ¤·¤ÆÂǤÁ´Ö°ã¤¨¤¬È¯À¸¤·¤Þ¤»¤ó¤Î¤Ç¡¢ÉÔÈ÷¤ÎÃͤ¬Æþ¤ë¤³¤È¤âËɤ°¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡¥²¡¼¥à¤ÎÆâÍƤ˱þ¤¸¤¿ enum ¤ò¹Í¤¨¤ÆºîÀ®¤·¤Æ±¿ÍѤ·¤Þ¤¹¡£
¥×¥ì¥¤¥ä¡¼¤Î¥Ð¥Õ¡¦¥Ç¥Ð¥ÕÍÑ(ÆÇ¡¢º®Íð¡¢áã¤ì¤È¤«)¡¢¥¢¥¤¥Æ¥à¤Î¼ïÎà(¾ÃÌ×ÉÊ¡¢Éð´ï¡¢Ëɶñ¡¢¤Ê¤É)¡¢
¥²¡¼¥à¤Î¾õÂÖ´ÉÍý(¥²¡¼¥à³«»ÏÁ°¡¢¥²¡¼¥àÃæ¡¢¥²¡¼¥à½ªÎ»¡Ë¤Ê¤É¡¢Èó¾ï¤Ë±þÍѤ¬Íø¤¯µ¡Ç½¤Ç¤¹¡£
¡¡¤Ê¤ª enum ¤Ç¤Ï³ÆÎóµó»Ò¤Ë¼«Æ°Åª¤ËÀ°¿ô¤ÎÈֹ椬Ϳ¤¨¤é¤ì¤Þ¤¹¡£°ìÈ־夫¤é 0 ¤ÇÏ¢È֤ˤʤäƤ¤¤Þ¤¹¡£
º£²ó¤Î¾ì¹ç¤Ç¤¢¤ì¤Ð¡¢Talk ¤Ë¤Ï 0¡¢Search ¤Ë¤Ï 1 ¤Î¿ô»ú¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡¤³¤ÎÈÖ¹æ¤Ï¸«¤¨¤Ê¤¤¾ðÊó¤Ç¤¹¤¬¡¢Îóµó»Ò¤ò int ·¿¤Ë¥¥ã¥¹¥È¤ò¹Ô¤¦¤³¤È¤Ç¼èÆÀ¤·¤ÆÍøÍѽÐÍè¤Þ¤¹¡£
²¼µ¤ÎÎã¤Î¾ì¹ç¡¢eventValue ¤Ë¤Ï 0 ¤¬ÂåÆþ¤µ¤ì¤Þ¤¹¡£
¡ãenum ¤ÎÎóµó»Ò¤Î¥¥ã¥¹¥È¡ä
int value = (int)PlayerState.Move;
¡¡¤Þ¤¿¡¢Îóµó»Ò¤ÎÀë¸À»þ¤Ë¿ô»ú¤ò»ØÄꤷ¤ÆÂåÆþ¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£¤½¤Î¾ì¹ç¤Ë¤ÏÏ¢È֤ǤϤʤ¯¡¢»ØÄꤷ¤¿¿ôÃͤò¼èÆÀ½ÐÍè¤Þ¤¹¡£
¡ã¿ô»ú¤ÎÂåÆþ¤ÎÎã(º£²ó¤³¤ÎÊý¼°¤ÏÍøÍѤ·¤Þ¤»¤ó)¡ä
EnemyType.cs
public enum PlayerState { Move = 10, Result = 5, }
¡¡¾åµ¤Î¤è¤¦¤ËÂåÆþ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢Îóµó»Ò¤ò int ·¿¤Ë¥¥ã¥¹¥È¤¹¤ë¤È¡¢ÂåÆþ¤·¤Æ¤¢¤ëÃͤ¬¼èÆÀ½ÐÍè¤Þ¤¹¡£
º£²ó¤Ï¿ô»ú¤ÎÂåÆþ¤Ï¹Ô¤Ã¤Æ¤¤¤Þ¤»¤ó¤Î¤Ç°ìÈÖ¾å¤ÎÎóµó»Ò¤Ë¤Ï 0 ¤«¤é½çÈ֤˺ÎÈÖ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡while(¥Û¥ï¥¤¥ë) ʸ¤ÏÈ¿Éü½èÍý¤È¸Æ¤Ð¤ì¤ë½èÍý¤Ç¤¹¡£¾ò·ï¤òËþ¤¿¤·¤Æ¤¤¤ë¸Â¤ê¡¢·«¤êÊÖ¤·½èÍý¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡º£²ó¤Î¥±¡¼¥¹¤Ç¤Ï¾ò·ï¤¬¡ÖcurrentPlayerState ¤ÎÃͤ¬ Battle_Before ¤Î´Ö¡×¤Ç¤¹¡£
¤è¤Ã¤Æ¡¢currentPlayerState ¤ÎÃͤ¬ Battle_Before °Ê³°¤ÎÃͤˤʤë¤Þ¤Ç¤Ï¤º¤Ã¤È·«¤êÊÖ¤µ¤ì¤Æ½ª¤ï¤ë¤³¤È¤Î¤Ê¤¤½èÍý¤Ë¤Ê¤ê¤Þ¤¹¡£¡¡
¡¡Â礤¯Ê¬¤±¤Æ¡¢for ʸ¤Ë¤è¤ë·«¤êÊÖ¤·¤Î½èÍý¤Ï·«¤êÊÖ¤¹²ó¿ô¤¬·è¤Þ¤Ã¤Æ¤¤¤ë¾ì¹ç¤ËÍøÍѤ·¡¢
·«¤êÊÖ¤·¤Î½èÍý¤ò²ó¿ô¤Ç¤Ï¤Ê¤¯¾ò·ï¤Ë¤è¤Ã¤ÆÀßÄꤷ¤¿¤¤¾ì¹ç¤Ë¤Ï while ʸ¤òÍøÍѤ·¤Þ¤¹¡£
¡¡whileʸ¤Ë¤è¤ë¥ë¡¼¥×½èÍý¤Ï¥³¥ë¡¼¥Á¥ó¥á¥½¥Ã¥ÉÆâ¤Ç¤âµ½Ò¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¤³¤Î¾ì¹ç¤Ë¤Ï²¿Éøå¤Ë¥ë¡¼¥×¤¹¤ë¡¢¤È¤¤¤Ã¤¿½ÀÆð¤Ê½ñ¼°¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
yield return null ¤òÍøÍѤ·¡¢£±¥Õ¥ì¡¼¥à¤À¤±ÂÔµ¡¤·¤Æ¥ë¡¼¥×¤¹¤ë¤È¤¤¤¦½èÍý¤â¼ÂÁõ¤Ç¤¤Þ¤¹¡£
¡¡¤Ê¤ª¡¢whileʸ¤Ï¾ò·ï¼°¤ò¸í¤ë¤È̵¸Â¥ë¡¼¥×¤ËÆþ¤Ã¤Æ¤·¤Þ¤Ã¤ÆUnity¥¨¥Ç¥£¥¿¡¼¤¬Ää»ß¤·¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
¤³¤¦¤Ê¤ë¤ÈºÆµ¯Æ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¯¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢whileʸ¤ò»ÈÍѤ¹¤ëºÝ¤Ë¤ÏÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
// while ʸ¤Ï ¾ò·ï¼° ¤òËþ¤¿¤¹¸Â¤ê¥ë¡¼¥×¤¹¤ë¡£¤³¤³¤Ç¤Ï typeCount ÊÑ¿ô¤ÎÃͤ¬ 0 ¤è¤ê¤âÂ礤¤´Ö¤Ï while Æâ¤Î½èÍý¤¬·«¤êÊÖ¤·¼Â¹Ô¤µ¤ì¤ë while (currentPlayerState == PlayerState.Battle_Before) { // ½èÍý¤òµ½Ò¤¹¤ë ¡¡¡¡¡¡¡¡AttackPlayer(); // ½èÍý¤ò 0.25 ÉÃÂÔµ¡¤µ¤»¤ÆºÆ³«¤¹¤ë yield return new WaitForSeconds(0.25f); } // whileʸ¤Î³°¤Ë½èÍý¤¬µ½Ò¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ë¤Ï¡¢¾åµ¤Îwhileʸ¤Î½èÍý¤¬½ªÎ»¤·¤Æ¤«¤é¤Ç¤Ê¤¤¤È½èÍý¤¬¼Â¹Ô¤µ¤ì¤Ê¤¤ }
¡¡º£²ó¼ÂÁõ¤·¤Æ¤¤¤ë while ʸÆâ¤Î½èÍý¤Ï£²¤Ä¤¢¤ê¡¢£±¤Ä¤Ï AttackPlayer() ¥á¥½¥Ã¥É¤Î¼Â¹Ô½èÍý¤Ç¤¹¡£
¥×¥ì¥¤¥ä¡¼¤Ë¤è¤ë¾ã³²Êª¤Ø¤Î¹¶·â¤ò¼Â¹Ô¤¹¤ëÀ©¸æ¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡¤â¤¦£±¤Ä¤Ï yield ¤Ë¤è¤ëÃæÃÇ(ÂÔµ¡¡¦ÃÙ±ä)¤Î½èÍý¤Ç¤¹¡£ yield return new WaitForSeconds(0.25f) ¤Ë¤è¤ê¡¢0.25 ÉäÀ¤±½èÍý¤òÃæÃǤ·¤Þ¤¹¡£
¡¡¤½¤Î¤¿¤á¡¢¤³¤Î while ʸ¤Ë¤è¤ë·«¤êÊÖ¤·¤Î½èÍý¤Ï¼¡¤Î¤è¤¦¤ÊµóÆ°¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡£±¡¥while ʸ¤Î¾ò·ï¤òËþ¤¿¤·¤Æ¤¤¤ë¤«¡¢³Îǧ¤¹¤ë¡£Ëþ¤¿¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢½èÍý¤ò½ªÎ»¤¹¤ë ¡¡£²¡¥¾ò·ï¤òËþ¤¿¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢while ʸÆâ¤Î½èÍý¤ò¼Â¹Ô¤¹¤ë¡£AttackPlayer ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë ¡¡£³¡¥0.25 ÉÃÂÔ¤Ä ¡¡£´¡¥¡Ú£±¡Û¤Î½èÍý¤ËÌá¤ë
¡¡Update ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¤¤¤Þ¤»¤ó¤¬¡¢while ʸ¤Ë¤è¤ëÈ¿Éü½èÍý¤Ë¤è¤ê¡¢¤·¤Ã¤«¤ê¤È°ìÄê¤Î´Ö³Ö¤Ç·«¤êÊÖ¤·¹¶·â¤ò½èÍý¤ò¼ÂÁõ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤·¤¿¡£
¡¡¤Ê¤ª¡¢while ʸ¤Ç¤Ï½èÍý¤òÃæÃǤ¹¤ë½èÍý¤ò¶´¤Þ¤Ê¤¤¤È·«¤êÊÖ¤·¤Î½èÍý¤¬»ß¤Þ¤é¤Ê¤¯¤Ê¤Ã¤Æ¡¢Unity ¤Î¥¨¥Ç¥£¥¿¡¼¤¬Æ°¤«¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
¤³¤¦¤Ê¤Ã¤Æ¤·¤Þ¤¦¤ÈºÆµ¯Æ°¤¹¤ë¤·¤«¤Ê¤¯¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢while ʸ¤ÏÆä˵¤¤òÉÕ¤±¤Æºî¶È¤·¤Æ¤¯¤À¤µ¤¤¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥Þ¥Ë¥å¥¢¥ë
¥³¥ë¡¼¥Á¥ó
̤³ÎǧÈô¹Ô C ÍÍ
È¿Éü½èÍý
@kwstÍÍ
¥³¥ë¡¼¥Á¥ó¤Î½éÊâŪ¤Ê»È¤¤Êý¡ÚUnity, ½é¿´¼Ô¡Û
¡¡Â¾¤Ë¤â¼«Æ°Åª¤Ë¹¶·â¤ò¹Ô¤¦¤è¤¦¤Ë¤¹¤ë½èÍý¤Ï¹Í¤¨¤é¤ì¤Þ¤¹¡£¿§¡¹¤Ê½èÍý¤ò»î¤·¤Æ¤ª¤¯¤³¤È¤Ç½èÍý¤Î°ú¤½Ð¤·¤¬¹¤¬¤ê¡¢
¤è¤ê¿¤¯¤Î½èÍý¤ò¼ÂÁõ¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢¤¤¤Ä¤â»È¤Ã¤Æ¤¤¤ë½èÍý¤À¤±¤Ç¤Ï¤Ê¤¯¡¢¿·¤·¤¤µ»½Ñ¤â¼è¤êÆþ¤ì¤Æ¤¤¤¤Þ¤·¤ç¤¦¡£
¡¡¥á¥½¥Ã¥ÉÆâ¤Ë¤Ï¡¢½¤¾þ»Ò¤ò»ý¤¿¤Ê¤¤¥á¥½¥Ã¥É¤òÆþ¤ì»Ò¤È¤·¤ÆÀë¸À(ºîÀ®)¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
¤³¤Î¤è¤¦¤ÊÆþ¤ì»Ò¤Ë¤Ê¤Ã¤Æ¤¤¤ë¥×¥é¥¤¥Ù¡¼¥È¤Ê¥á¥½¥Ã¥É¤ò¥í¡¼¥«¥ë´Ø¿ô¤È¤¤¤¤¤Þ¤¹¡£
¡ã»²¹Í¥µ¥¤¥È¡ä
MicroSoft
¥í¡¼¥«¥ë´Ø¿ô (C# ¥×¥í¥°¥é¥ß¥ó¥° ¥¬¥¤¥É)
https://docs.microsoft.com/ja-jp/dotnet/csharp/pro...
¡¡¥í¡¼¥«¥ë´Ø¿ô¤Ï¡¢Æþ¤ì»Ò¤È¤·¤ÆÀë¸À¤·¤Æ¤¤¤ë¥á¥½¥Ã¥É(¿Æ¥á¥½¥Ã¥É)Æâ¤Ç¤Î¤ß¡¢¸Æ¤Ó½Ð¤·¤ÎÌ¿Î᤬²Äǽ¤Ç¤¹¡£
¡¡ÍøÍѤ¹¤ë¼ç¤Ê¥±¡¼¥¹¤È¤·¤Æ¤Ï¡¢¥¯¥é¥¹Æâ¤Ç¤Î¸Æ¤Ó½Ð¤·Ì¿Î᤬£±¤Ä¤Ç¤¢¤ë¥á¥½¥Ã¥É(£±²Õ½ê¤«¤é¤·¤«¸Æ¤Ó½Ð¤·Ì¿Î᤬¤Ê¤¤¥á¥½¥Ã¥É)¤¬¥í¡¼¥«¥ë´Ø¿ô¤È¤·¤ÆÀë¸À¤¹¤ë¥á¥½¥Ã¥É¤ÎÂоݤȤʤê¤Þ¤¹¡£
¤Þ¤¿¡¢¥í¡¼¥«¥ë´Ø¿ô¤Ï½èÍý¤ò±£Ê乤뤳¤È¤Ë¤â¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢Ä̾ï¤Î¥á¥½¥Ã¥É¤è¤ê¤âÆâÉôŪ¤Ê½èÍý¤òµ½Ò¤¹¤ë¤³¤È¤¬¤Ç¤¡¢¥¹¥³¡¼¥×¤¬Ã»¤¯¤Ê¤ë¤³¤È¤Ç¡¢¥¨¥é¡¼¤ÎÆÃÄ꤬ÁᤤÃʳ¬¤ÇȽÃǤǤ¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡º£²ó¤Ï¡¢AttackPlayer ¥á¥½¥Ã¥É¤ò AutoBattle ¥á¥½¥Ã¥ÉÆâ¤ËÀë¸À¤·¤ÆºîÀ®¤·¤Æ¤¤¤Þ¤¹¡£
¤Ä¤Þ¤ê¡¢AutoBattle ¥á¥½¥Ã¥É¤¬¿Æ¥á¥½¥Ã¥É¡¢AttackPlayer ¥á¥½¥Ã¥É¤¬Æþ¤ì»Ò¥á¥½¥Ã¥É¤Ç¤¹¡£
¤½¤Î¤¿¤á¡¢¤³¤Î AttackPlayer ¥á¥½¥Ã¥É¤Ï¡¢AutoBattle ¥á¥½¥Ã¥ÉÆ⤫¤é¤Î¤ß¡¢¸Æ¤Ó½Ð¤·Ì¿Îá¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
¡¡ËÜÍè AttackPlayer ¥á¥½¥Ã¥É¤Ï¡¢ÉáÄ̤Υ᥽¥Ã¥É¤Î¤è¤¦¤Ëµ½Ò¤Ç¤¤Þ¤¹¤¬¡¢¤¹¤Ù¤Æ¤Î½èÍý¤ò½ñ¤¤¤Æ¤«¤éÀººº¤·¤¿ºÝ¡¢
¸Æ¤Ó½Ð¤·Ì¿Î᤬ AutoBattle ¥á¥½¥Ã¥É¤«¤é¸ºß¤·¤Æ¤¤¤Ê¤¤¤¿¤á¡¢¥í¡¼¥«¥ë´Ø¿ô¤È¤·¤ÆÀë¸À¤·¤Æ¤¤¤Þ¤¹¡£
¡¡¥í¡¼¥«¥ë´Ø¿ô¤Ï¡¢¸Æ¤Ó½Ð¤·Ì¿Îá¤È¡¢´Ø¿ô¤òÀë¸À¤·¤Æ¤¤¤ë¾ì½ê¤¬Æ±¤¸¥á¥½¥Ã¥ÉÆâ¤Ë¤¢¤ë¤¿¤á¡¢
¤è¤ê½èÍý¤ò¥³¥ó¥Ñ¥¯¥È¤Ë¤Þ¤È¤á¤Æ¡¢¥¹¥³¡¼¥×¤ò¶¹¤¯¤¹¤ë¤³¤È¤Ç¡¢¸«¤ä¤¹¤¯¡¢´ÉÍý¤·¤ä¤¹¤¤¥á¥½¥Ã¥É¤È¤·¤Æµ¡Ç½¤·¤Æ¤¤¤Þ¤¹¡£
¡¡º£²ó¼ÂÁõ¤·¤Æ¤¤¤ëÉôʬ¤Ç¤¹¡£ÆâÉô¤Î½èÍý¤ò¾Êά¤·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢³Æ¥á¥½¥Ã¥É¤Î¥Ö¥í¥Ã¥¯({ }) ¤Ë¤Ä¤¤¤ÆÃíÌܤ·¤Æ¤¯¤À¤µ¤¤¡£
³Æ¥Ö¥í¥Ã¥¯¤ò¤ï¤«¤ê¤ä¤¹¤¯¤¹¤ë¤¿¤á¤Ë¡¢¿ô»ú¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£
¡ã¥í¡¼¥«¥ë´Ø¿ô¡ä
¡¡¡¡/// <summary> /// ¼«Æ°¥Ð¥È¥ë /// </summary> /// <param name="obstacle"></param> /// <returns></returns> private IEnumerator AutoBattle(ObstacleBase obstacle) {¡¡¡¡¡¢ª¡¡¥¹¥¿¡¼¥È // AutoBattle ¥á¥½¥Ã¥ÉÆâ¤Î½èÍý /// <summary> /// ¥×¥ì¥¤¥ä¡¼¤Î¹¶·â(¥í¡¼¥«¥ë´Ø¿ô) /// </summary> ¡¡¡¡¡¡¡¡void AttackPlayer() {¡¡¢¡¡¢ª¡¡¥¹¥¿¡¼¥È ¡¡¡¡¡¡¡¡¡¡¡¡// AttackPlayer ¥á¥½¥Ã¥ÉÆâ¤Î½èÍý }¡¡¢ª¡¡¢¡¡½ª¤ï¤ê }¡¡¡¡¡½ª¤ï¤ê
¡¡¥á¥½¥Ã¥ÉÆâ¤Ç¤¢¤ì¤Ð¡¢½èÍý¤ÎÅÓÃæ¤Ç¤âÀë¸À¤Ç¤¤Þ¤¹¡£ºÇ¸å¤Ë¤Þ¤È¤á¤Æ¥í¡¼¥«¥ë´Ø¿ô¤òÀë¸À¤¹¤ë¤³¤È¤â½ÐÍè¤Þ¤¹¡£
¤Þ¤¿¡¢¥í¡¼¥«¥ë´Ø¿ô¤ÎÃæ¤ËÆþ¤ì»Ò¹½Â¤¤È¤·¤Æ¡¢ÊÌ¤Î¥í¡¼¥«¥ë´Ø¿ô¤òÀë¸À¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£
¤¿¤À¤·¡¢Æþ¤ì»Ò¤¬¿¼¤¯¤Ê¤ë¤È½èÍý¤¬Æɤߤˤ¯¤¯¤Ê¤ë¤¿¤á¡¢¥í¡¼¥«¥ë´Ø¿ôÆâ¤ÎÆþ¤ì»Ò¤È¤Ê¤ë¥í¡¼¥«¥ë´Ø¿ô¤Ï¤Ê¤ë¤Ù¤¯¤Ê¤¤Êý¤¬¤è¤¤¤Ç¤·¤ç¤¦¡£
¡¡¿·¤·¤¤µ¡Ç½¤ò¤¿¤¯¤µ¤ó¼ÂÁõ¤·¤Æ¤¤¤ë¤Î¤Ç¡¢¤½¤ì¤é¤ÎÉü½¬¤ò¹Ô¤¤¤Ê¤¬¤é¡¢½èÍý¤ÎÍý²ò¤ò¿¼¤á¤Æ¤¤¤¤Þ¤·¤ç¤¦¡£
¡¡¤Þ¤º¡¢¾ã³²Êª¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÁªÂò¤·¡¢¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤è¤ê ObstacleBase ¥¹¥¯¥ê¥×¥È¤ò³Îǧ¤·¤Þ¤¹¡£
Hp ÊÑ¿ô¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤³¤Á¤é¤ËǤ°Õ¤ÎÃͤòÆþÎϤ·¤Þ¤¹¡£¤³¤ÎÎã¤Ç¤Ï 5 ¤È¤·¤Æ¤¤¤Þ¤¹¡£
¡ã¾ã³²Êª¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î ObstacleBase ¥¹¥¯¥ê¥×¥È¡ä
¡¡¤É¤Î¤è¤¦¤Ê½èÍý¤¬Æ°¤¯¤Î¤«¡¢Íý²ò¤Ç¤¤¿¤é¡¢¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¥Ç¥Ð¥Ã¥°¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡¤Þ¤º¡¢Game ¥Ó¥å¡¼¤Ç¤Î½èÍý¤ÏÊѤï¤ê¤Þ¤»¤ó¡£¥×¥ì¥¤¥ä¡¼¤È¾ã³²Êª¤È¤¬ÀÜ¿¨¤·¤Æ¡¢°ìÄê»þ´Ö¸å¤ËÇ˲õ¤µ¤ì¤Þ¤¹¡£
¡¡¤¿¤À¤·¡¢Console ¥Ó¥å¡¼¤Ë¡Ú¾ã³²Êª¤Î»Ä¤ê HP : ¡Û¤È¤¤¤¦·Á¤Ç¥Ç¥Ð¥Ã¥°¤ÎÆâÍƤ¬É½¼¨¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢
¤³¤Á¤é¤Ç Hp ¤¬ 0 ¤Ë¤Ê¤Ã¤¿¤é¾ã³²Êª¤¬Ç˲õ¤µ¤ì¤Æ¡¢ºÆÅÙ¡¢¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¤¬²Äǽ¤Ë¤Ê¤ë¤³¤È¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤½¤Î¤¿¤á¡¢ObstacleBase ¥¹¥¯¥ê¥×¥È¤Î Hp ÊÑ¿ô¤òÊѤ¨¤ë¤È¡¢Ç˲õ¤µ¤ì¤ë¤Þ¤Ç¤Î»þ´Ö¤ËÊѲ½¤¬¸½¤ì¤Þ¤¹¡£
¡ãGame ¥Ó¥å¡¼¡¡Æ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡ãConsole ¥Ó¥å¡¼¡ä
¡¡¤½¤ì°Ê³°¤Ë¤âÃíÌܤ¹¤Ù¤¥í¥¸¥Ã¥¯¤È¤·¤Æ¤Ï¡¢PlayerState ¤ÎÍøÍѤ¬¤¢¤ê¤Þ¤¹¡£
¹¶·â¤Î½èÍý¡¢¥Ð¥È¥ë¸å¤Î½èÍý¤Ë¤è¤ê¡¢°ÜÆ°¤ÎÀ©¸Â¤ÈºÆ°ÜÆ°¤Îµö²Ä¤¬½Ð¤ë¤è¤¦¤ËÀ©¸æ½èÍý¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡¤É¤Î¤è¤¦¤Ê¾õÂ֤ΤȤ°ÜÆ°¤Ç¤¤ë(¤½¤·¤Æ°ÜÆ°¤Ç¤¤Ê¤¤)¤Î¤«¡¢¤É¤Î¥¿¥¤¥ß¥ó¥°¤Ç PlayerState ¤ÎÀÚ¤êÂؤ¨¤ò¹Ô¤¤¡¢
¥í¥¸¥Ã¥¯¤È¤·¤ÆÀ®Î©¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ë¤Î¤«¤ò¡¢Æɤ߲ò¤¡¢Íý²ò¤Ç¤¤ë¤è¤¦¤ËÉü½¬¤ò¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£
¡¡¼¡¤Ï¡¡¼ê½ç£±£³¡¡¡Ý¾ã³²Êª¤Î¹¶·â½èÍý¡Ý¡¡¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯