ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2021ǯ04·î22Æü(ÌÚ) 15:19:04ÍúÎò
¡¡¤³¤Î¼ê½ç¤Ç¤ÏË«¾Þ¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤òºîÀ®¤·¡¢º£¸å±¿ÍѤǤ¤ë¤è¤¦¤Ë¥Ç¡¼¥¿¤ÎÅÐÏ¿¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡
¡ã¼ÂÁõ²èÁü¡ä
¼ê½ç£±£¸¡¡¡ÝË«¾ÞÍѤΥǡ¼¥¿¥Ù¡¼¥¹¤ÎºîÀ®¡Ý
£²£¹¡¥Ë«¾ÞÍѤΥǡ¼¥¿¥Ù¡¼¥¹¤È¤·¤ÆÍøÍѤ¹¤ë¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë¤¿¤á¤Î½àÈ÷¤ò¹Ô¤¦¡¡¡ÝRewardType ¥¹¥¯¥ê¥×¥È¤È RewardData ¥¹¥¯¥ê¥×¥È¤È RewardDataSO ¥¹¥¯¥ê¥×¥È¤òºîÀ®¤¹¤ë¡¼ £³£°¡¥RewardDataSO ¥¹¥¯¥ê¥×¥È¤òÍøÍѤ·¤Æ RewardDataSO ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¡¢Ë«¾Þ¤Î¥Ç¡¼¥¿¤òÅÐÏ¿¤¹¤ë
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦enum ¤À¤±¤Î¥¹¥¯¥ê¥×¥È¡¦¥Õ¥¡¥¤¥ë¤ÎºîÀ® ¡¡¡¦¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎºîÀ®¤È¥Ç¡¼¥¿¤ÎÅÐÏ¿
£²£¹¡¥Ë«¾ÞÍѤΥǡ¼¥¿¥Ù¡¼¥¹¤È¤·¤ÆÍøÍѤ¹¤ë¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë¤¿¤á¤Î½àÈ÷¤ò¹Ô¤¦¡¡¡ÝRewardType ¥¹¥¯¥ê¥×¥È¤È RewardData ¥¹¥¯¥ê¥×¥È¤È RewardDataSO ¥¹¥¯¥ê¥×¥È¤òºîÀ®¤¹¤ë¡¼
¡¡¤ª»È¤¤¤¬´°Î»¤·¤¿ºÝ¤ËÀ¸À®¤µ¤ì¤ë¥¥ã¥é¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥¿¥Ã¥×¤¹¤ë¤È¡¢º£²ó¤Î¤ª»È¤¤¤ÎÀ®²Ì¤È¤·¤ÆË«¾Þ¤ò³ÍÆÀ¤Ç¤¤ë¥·¥¹¥Æ¥à¤òÀ߷פ·¤Æ¼ÂÁõ¤·¤Þ¤¹¡£
º£²ó¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºîÀ®ºî¶È¤ò¹Ô¤Ã¤Æ¤¤¤¤Þ¤¹¡£
¡ãË«¾Þ³ÍÆÀ¤Þ¤Ç¤Î¼ê½ç¡ä
¡¡¡»³ÍÆÀ¤·¤¿Ë«¾Þ¤Î¾ðÊó¤òɽ¼¨¤·¤Æ¥×¥ì¥¤¥ä¡¼¤ËÅÁ¤¨¤ë¤¿¤á¤ÎË«¾Þɽ¼¨Íѥݥåץ¢¥Ã¥×¡¦¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤È¡¢¤½¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÀ©¸æ¤¹¤ë¥¹¥¯¥ê¥×¥È ¡¡¡»¥¥ã¥é¤ò¥¿¥Ã¥×¤·¤¿ºÝ¤Ë¡¢Ë«¾Þɽ¼¨ÍѤΥݥåץ¢¥Ã¥×¡¦¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë½èÍý ¡¡¢¡Ë«¾Þ¤ÎÆâÍƤòÅÐÏ¿¤¹¤ë¤¿¤á¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºîÀ®(º£²ó¤Î¼ê½ç¤ÇºîÀ®) ¡¡¡¦¤ª»È¤¤¤ÎÆñ°×Å٤˱þ¤¸¤¿Ë«¾Þ¤Î¥Ç¡¼¥¿¤ò¥é¥ó¥À¥à¤ÇÃê½Ð¤¹¤ëµ¡Ç½ ¡¡¡¦Ë«¾Þɽ¼¨Íѥݥåץ¢¥Ã¥×¡¦¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¡¢¥é¥ó¥À¥à¤ÇÃê½Ð¤µ¤ì¤¿Ë«¾Þ¤Î¥Ç¡¼¥¿¤òÁ÷¤ê¹þ¤ó¤Çɽ¼¨¤µ¤»¤ëµ¡Ç½ ¡¡¡¦¥»¡¼¥Ö¤·¤Æ¤¢¤ë¤ª»È¤¤¤Î¥Ç¡¼¥¿¤È¡¢ OfflineTimeManager ¥¹¥¯¥ê¥×¥È¤Î List Æ⤫¤éºï½ü¤¹¤ëµ¡Ç½
¡¡¤ª»È¤¤¤Î¾ðÊó¤äË«¾Þ¤Ê¤É¤Î¥Ç¡¼¥¿¤Ê¤É¤ò°·¤¦¾ì¹ç¤Ë¡¢Ê£¿ô¤Î¥Ç¡¼¥¿¤ò£±¤Ä¤Î¤Þ¤È¤Þ¤ê¤È¤·¤Æ´ÉÍý¤Ç¤¤ë¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¤è¤¦¤Ê¤â¤Î¤¬¤¢¤ë¤È°·¤¤¤¬³Ú¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡Unity¤Ë¤Ï¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤È¤¤¤¦µ¡Ç½¡Ê¤³¤Á¤é¤Ï¥¢¥»¥Ã¥È¤È¤·¤Æ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò°·¤¦ÊýË¡¡Ë¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢º£²ó¤Ï¤³¤Îµ¡Ç½¤òÍøÍѤ·¤Æ¤¤¤¤Þ¤¹¡£
¡¡¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë¤¿¤á¤Ë¤Ï¡¢ÀìÍѤΥ¹¥¯¥ê¥×¥È¤òºîÀ®¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¤½¤ÎºîÀ®ÊýË¡¤ò³Ø½¬¤·¤Þ¤¹¡£
¡¡º£²óºîÀ®¤¹¤ë¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÏË«¾Þ¤Î¥Ç¡¼¥¿¤ò´ÉÍý¤¹¤ëÌÜŪ¤ÇºîÀ®¤ò¹Ô¤¤¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¥¹¥¯¥ê¥×¥È¤È¤·¤Æ¤Ï¡¢Ë«¾Þ¤Î¥Ç¡¼¥¿¤ò¤Þ¤È¤á¤ë¤¿¤á¤Î RewardData ¥¯¥é¥¹¤òÍÑ°Õ¤·¤Þ¤¹¡£
¡¡RewardData ¥¯¥é¥¹¤Ï¡¢Ë«¾Þ£±¤Äʬ¤Î¥Ç¡¼¥¿¤ò£±¤Ä¤Ë¤Þ¤È¤á¤Æ¤¤¤ë¾ðÊ󷲤Ǥ¹¡£
Ë«¾Þ¤Î¥Ý¥¤¥ó¥È¤äÃê½Ð¤¹¤ë³ÎΨ¤È¤¤¤Ã¤¿Ãͤò£±¤Ä¤Î¥Ç¡¼¥¿·²¤È¤·¤Æ¤Þ¤È¤á¤Æ´ÉÍý¤¹¤ë¤¿¤á¤Î¥¯¥é¥¹¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¤³¤Î RewardData ¥¯¥é¥¹¤Ï¡¢¥²¡¼¥à¤ËÅо줹¤ëË«¾Þ¤Î¿ô¤À¤±ÍÑ°Õ¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢¤½¤ì¤ò´ÉÍý¤¹¤ë¤¿¤á¤Ë List µ¡Ç½¤òÍøÍѤ·¤Þ¤¹¡£
¤³¤Á¤é¤Ï¤Þ¤¿Ê̤ΠRewardDataSO ¥¹¥¯¥ê¥×¥È¤òºîÀ®¤·¡¢¤½¤ÎÃæ¤ÇÍÑ°Õ¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡¤³¤Î£²¤Ä¤Î¾ðÊó¤ò´ÉÍý¤·¤Æ´°À®¤¹¤ë¤Î¤¬¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ê¤ê¤Þ¤¹¡£(£±¤Ä¤Î¥¹¥¯¥ê¥×¥È¤Ç¤Þ¤È¤á¤ÆºîÀ®¤¹¤ëÊýË¡¤â¤¢¤ê¤Þ¤¹¤¬¡¢º£²ó¤Ïʬ¤±¤ÆºîÀ®¤·¤Þ¤¹)
¤É¤Î¤è¤¦¤Ê¹½À®¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤«¤Ï¥¹¥¯¥ê¥×¥ÈºîÀ®¸å¤ËÀâÌÀ¤ò¤·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤½¤Á¤é¤ò¤·¤Ã¤«¤ê¤È³Ø½¬¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤Þ¤º¤ÏºÇ½é¤Ë¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë¤¿¤á¤ËɬÍפÊË«¾Þ¤Î´õ¾¯Å٤μïÎà¤òÅÐÏ¿¤¹¤ë RarityType ¤ò enum ¤Ë¤ÆºîÀ®¤·¤Æ¤«¤é¡¢
¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥ÈÍѤΥ¹¥¯¥ê¥×¥È¤òºîÀ®¤·¤Þ¤¹¡£
¡¡enum (¥¤¡¼¥Ê¥à) ¤òÍøÍѤ·¤Æ¡¢Ë«¾Þ¤Î´õ¾¯Å٤μïÎà¤ò»öÁ°¤ËÅÐÏ¿¤·¡¢¤³¤Î¾ðÊó¤òË«¾Þ¤Î»ý¤Ä¾ðÊó¤È¤·¤Æ RewardData ¥¯¥é¥¹Æâ¤ËÀßÄê¤Ç¤¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
enum ¤Î¤ß¤Ç¥¹¥¯¥ê¥×¥È¤òºîÀ®¤¹¤ë¾ì¹ç¡¢using ¤ÎÀë¸À¤ä¡¢MonoBehaviour(¥â¥Î¥Ó¥Ø¥¤¥Ó¥¢) ¥¯¥é¥¹¤Î·Ñ¾µ¤ÏÉÔÍפǤ¹¡£
¤½¤·¤Æ¤É¤Î¥¹¥¯¥ê¥×¥È¤«¤é¤Ç¤âÊÑ¿ô¤ÎÂåÆþ¤Ê¤·¤ÇÍøÍѲÄǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡enum ¤Ç¤Ï¥²¡¼¥àÆâ¤ËÅо줵¤»¤¿¤¤¼ïÎà¤Î¾ðÊó¤ò¡¢Îóµó»Ò(¤ì¤Ã¤¤ç¤·)¤È¤¤¤¦·Á¤Ç¼ïÎà¤òºîÀ®¤Ç¤¤Þ¤¹¡£
º£²ó¤Ï¡¢Ë«¾Þ¤Î´õ¾¯Å٤μïÎà¡¢¤È¤¤¤¦¾ðÊó¤ò RarityType ¤È¤¤¤¦Ì¾Á°¤ÇºîÀ®¤·¡¢¤½¤ÎÃæ¤Ë´õ¾¯Å٤μïÎà¤òÅÐÏ¿¤·¤Æ¤ª¤¤Þ¤¹¡£
¤³¤ì¤ÏÄɲòÄǽ¤Ê¾ðÊó¤Ç¤¹¤Î¤Ç¡¢À衹¤Ë´õ¾¯Å٤μïÎबÁý¤¨¤Æ¤âÂбþ¤Ç¤¤Þ¤¹¡£
RarityType.cs
¡¡¥¹¥¯¥ê¥×¥È¤òºîÀ®¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡£²¤Ä°Ê¾å¤Î¾ðÊó¤ò´ÉÍý¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢enum ¤Ç¤½¤Î¼ïÎà¤òÅÐÏ¿¤·¤Æ¤ª¤¯¤³¤È¤ò¤ª¤¹¤¹¤á¤·¤Þ¤¹¡£
enum ¤òÍøÍѤ¹¤ë¾ì¹ç¡¢¤½¤ÎÅÐÏ¿¤·¤Æ¤¢¤ëÎóµó»Ò¤«¤é¤·¤«¾ðÊó¤ò»ØÄê¤Ç¤¤Þ¤»¤ó¤Î¤Ç¡¢
Î㤨¤Ð¡¢Ê¸»úÎó¤È°Û¤Ê¤ê¡¢»ØÄê¤ËºÝ¤·¤ÆÂǤÁ´Ö°ã¤¨¤¬È¯À¸¤·¤Þ¤»¤ó¤Î¤Ç¡¢ÉÔÈ÷¤ÎÃͤ¬Æþ¤ë¤³¤È¤âËɤ°¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡¥²¡¼¥à¤ÎÆâÍƤ˱þ¤¸¤¿ enum ¤ò¹Í¤¨¤ÆºîÀ®¤·¤Æ±¿ÍѤ·¤Þ¤¹¡£
¥×¥ì¥¤¥ä¡¼¤Î¾õÂÖÍÑ(ÆÇ¡¢º®Íð¡¢áã¤ì¤È¤«)¡¢¥¢¥¤¥Æ¥à¤Î¼ïÎà(¾ÃÌ×ÉÊ¡¢Éð´ï¡¢Ëɶñ¡¢¤Ê¤É)¡¢
¥²¡¼¥à¤Î¾õÂÖ´ÉÍý(¥²¡¼¥à³«»ÏÁ°¡¢¥²¡¼¥àÃæ¡¢¥²¡¼¥à½ªÎ»¡Ë¤Ê¤É¡¢Èó¾ï¤Ë±þÍѤ¬Íø¤¯µ¡Ç½¤Ç¤¹¡£
¡¡¤Ê¤ª enum ¤Ç¤Ï³ÆÎóµó»Ò¤Ë¼«Æ°Åª¤ËÀ°¿ô¤ÎÈֹ椬Ϳ¤¨¤é¤ì¤Þ¤¹¡£°ìÈ־夫¤é 0 ¤ÇÏ¢È֤ˤʤäƤ¤¤Þ¤¹¡£
º£²ó¤Î¾ì¹ç¤Ç¤¢¤ì¤Ð¡¢Talk ¤Ë¤Ï 0¡¢Search ¤Ë¤Ï 1 ¤Î¿ô»ú¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡¤³¤ÎÈÖ¹æ¤Ï¸«¤¨¤Ê¤¤¾ðÊó¤Ç¤¹¤¬¡¢Îóµó»Ò¤ò int ·¿¤Ë¥¥ã¥¹¥È¤ò¹Ô¤¦¤³¤È¤Ç¼èÆÀ¤·¤ÆÍøÍѽÐÍè¤Þ¤¹¡£
²¼µ¤ÎÎã¤Î¾ì¹ç¡¢rarityValue ¤Ë¤Ï 0 ¤¬ÂåÆþ¤µ¤ì¤Þ¤¹¡£
¡ãenum ¤ÎÎóµó»Ò¤Î¥¥ã¥¹¥È¡ä
int rarityValue = (int)RarityType.Common;
¡¡¤Þ¤¿¡¢Îóµó»Ò¤ÎÀë¸À»þ¤Ë¿ô»ú¤ò»ØÄꤷ¤ÆÂåÆþ¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£¤½¤Î¾ì¹ç¤Ë¤ÏÏ¢È֤ǤϤʤ¯¡¢»ØÄꤷ¤¿¿ôÃͤò¼èÆÀ½ÐÍè¤Þ¤¹¡£
¡ã¿ô»ú¤ÎÂåÆþ¤ÎÎã(º£²ó¤³¤ÎÊý¼°¤ÏÍøÍѤ·¤Þ¤»¤ó)¡ä
RarityType.cs
public enum RarityType { Common = 100, Uncommon = 200, Rare = 0 }
¡¡¾åµ¤Î¤è¤¦¤ËÂåÆþ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢Îóµó»Ò¤ò int ·¿¤Ë¥¥ã¥¹¥È¤¹¤ë¤È¡¢ÂåÆþ¤·¤Æ¤¢¤ëÃͤ¬¼èÆÀ½ÐÍè¤Þ¤¹¡£
º£²ó¤Ï¿ô»ú¤ÎÂåÆþ¤Ï¹Ô¤Ã¤Æ¤¤¤Þ¤»¤ó¤Î¤Ç°ìÈÖ¾å¤ÎÎóµó»Ò¤Ë¤Ï 0 ¤«¤é½çÈ֤˺ÎÈÖ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡Ë«¾Þ¤Î¥Ç¡¼¥¿¤òÅÐÏ¿¤¹¤ë¤¿¤á¤ÎÊÑ¿ô·²¤ò«¤Í¤ë¥¯¥é¥¹¤òºîÀ®¤·¤Þ¤¹¡£
¤³¤Î¥¯¥é¥¹¤â MonoBehaviour ¥¯¥é¥¹¤Î·Ñ¾µ¤¬¤Ê¤¤¥¯¥é¥¹¤Ç¤¹¤Î¤Ç¡¢¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ï¥¢¥¿¥Ã¥Á¤Ç¤¤Þ¤»¤ó¡£
¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¹Ô¤Ã¤ÆÍøÍѤ·¤Æ¤¤¤¯¥¯¥é¥¹¤Ë¤Ê¤ê¤Þ¤¹¡£
RewardData.cs
¡¡¥¹¥¯¥ê¥×¥È¤òºîÀ®¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë¤¿¤á¤ËɬÍ×¤Ê RewardDataSO ¥¹¥¯¥ê¥×¥È¤òºîÀ®¤·¤Þ¤¹¡£
¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥ÈÀìÍѤΠScriptableObject ¥¯¥é¥¹¤ò·Ñ¾µ¤·¡¢[CreateAssetMenu] °À¤òµ½Ò¤¹¤ë¤³¤È¤ÇºîÀ®²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡
¡¡¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤Ï¡¢List ¤Îµ¡Ç½¤òÍøÍѤ¹¤ë¤³¤È¤Ç¡¢»ØÄꤷ¤¿¥Ç¡¼¥¿¤òÊ£¿ô¤Î¥Ç¡¼¥¿¤È¤·¤Æ¤Þ¤È¤á¤Æ´ÉÍý¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤È¤·¤Æ¤ÎÌò³ä¤ò²Ì¤¿¤¹¤³¤È¤¬²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡º£²ó»ØÄꤷ¤Æ´ÉÍý¤·¤¿¤¤¥Ç¡¼¥¿¤Ï¥¤¥Ù¥ó¥È¤Î¥Ç¡¼¥¿¤Ç¤¹¡£
¤½¤Î¤¿¤á¡¢RewardData ·¿¤Î List ¤òºîÀ®¤·¤Æ¡¢´ÉÍý¤ò¹Ô¤¨¤ë¾õÂ֤Ȥ·¤ÆºîÀ®¤ò¹Ô¤¤¤Þ¤¹¡£
EventDataSO.cs
¡¡¥¹¥¯¥ê¥×¥È¤òºîÀ®¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡½èÍý¤ÎÆâÍƤˤĤ¤¤Æ¡¢½çÈ֤˳Îǧ¤·¤Æ¤¤¤¤Þ¤¹¡£
¡¡£±¡¥Ë«¾Þ£±¤Äñ°Ì¤Ç¤Î¥Ç¡¼¥¿(Ë«¾Þ¤ÎÄ̤·Èֹ桢´õ¾¯ÅÙ¡¢É½¼¨¤¹¤ë²èÁü¤Ê¤É¤Î¥Ç¡¼¥¿·²) ¡¡£²¡¥Ë«¾Þ¤Î¥Ç¡¼¥¿¤ò¤Þ¤È¤á¤ë List(¥ê¥¹¥È)
¡¡Ë«¾Þ¤Ë´ØÏ¢¤¹¤ë¾ðÊó(ÊÑ¿ô)¤ò¥¯¥é¥¹¤Ë¤Þ¤È¤á¤ëÍøÅÀ¤Ï¡¢£±¤Ä¤Î RewardData ¥¯¥é¥¹Æâ¤Ë¤Ï£±¤Äʬ¤Î¥¤¥Ù¥ó¥È¤ÎÁ´¥Ç¡¼¥¿¤¬ÅÐÏ¿¤Ç¤¤ë¤³¤È¤Ç¤¹¡£
¤½¤Î¤¿¤á¡¢Ä̤·ÈÖ¹æÍÑ¡¢²èÁüÅÐÏ¿ÍѤȤ¤¤¦¤è¤¦¤ËÊÑ¿ô¤òRewardData ¤Î Ä̤·Èֹ桢RewardData ¤Î²èÁüÅÐÏ¿ÍѤξðÊó¤È¤¤¤¦·Á¤Ç RewardData ¤ò»²¾È¤·¤ÆÍøÍѤǤ¤ëÉôʬ¤Ç¤¹¡£
Î㤨¤Ð¡¢RewardData.rarity ¤Èµ½Ò¤¹¤ì¤Ð¡¢¤½¤ì¤Ï¤½¤Î RewardData ¥¯¥é¥¹¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë rarity ¤ÎÃͤò»²¾È¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¤³¤³¤«¤é¤Ï¥Ô¥ê¥ª¥É¤Ë¤è¤ë»²¾È½èÍý¤¬Áý¤¨¤Æ¤¤¤¤Þ¤¹¤Î¤Ç¡¢¤·¤Ã¤«¤ê¤È½èÍý¤òÆɤ߲ò¤¤¤Æ¤¤¤¤Þ¤·¤ç¤¦¡£
[System.Serializable] public class RewardData { public int rewardNo; // Ä̤·ÈÖ¹æ public RarityType rarityType; // ´õ¾¯ÅÙ public int rarityRate; // ÅÙ¹ç public Sprite spriteReward; // ²èÁü public int rewardPoint; // ³ÍÆÀ¤Ç¤¤ë¥Ý¥¤¥ó¥È }
¡¡¤³¤Î¤è¤¦¤ËË«¾Þñ°Ì¤Ç£±¤Äʬ¤ËɬÍפˤʤë¥Ç¡¼¥¿¤ò¥¯¥é¥¹¤È¤·¤Æ¤Þ¤È¤á¤Æ¤ª¤¯¤³¤È¤Ç´ÉÍý¤ÈÍøÍѤ¬Íưפˤʤê¤Þ¤¹¡£
¤Þ¤¿¡¢Ë«¾Þ¤Î¾ðÊó¤òÁý¤ä¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢¤³¤Î RewardData ¥¯¥é¥¹Æâ¤Ë ·¿¤ÈÊÑ¿ô¤òÄɵ¤¹¤ì¤Ð¡¢¹¥¤¤Ê¤À¤±Áý¤ä¤¹¤³¤È¤â½ÐÍè¤Þ¤¹¡£
¡¡RewardData ¥¯¥é¥¹¤Ë¤ÏË«¾Þ´ØÏ¢¤Î¾ðÊóÍѤÎÊÑ¿ôÍÑ°Õ¤·¡¢¤Þ¤È¤á¤ÆÅÐÏ¿¤Ç¤¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
¤³¤Î¥Ç¡¼¥¿¤ÏË«¾Þ£±¤Äʬ¤Ç¤¹¤Î¤Ç¡¢¤â¤·¤âÊ£¿ô¤ÎË«¾Þ¤Î¥Ç¡¼¥¿¤òÍÑ°Õ¤·¤ÆÅÐÏ¿¤·¤¿¤¤¾ì¹ç¡¢
¤³¤Î RewardData ¥¯¥é¥¹¤òÊ£¿ôÍÑ°Õ¤·¤Æ¡¢¤½¤ì¤ò´ÉÍý¤¹¤ë¤¿¤á¤ÎÊÑ¿ô¤¬É¬Íפˤʤê¤Þ¤¹¡£
¡¡¤³¤¦¤¤¤Ã¤¿£±¤Ä¤ÎƱ¤¸¥Ç¡¼¥¿·²¤ò¤Þ¤È¤Þ¤Ã¤¿¤â¤Î¤ò¥³¥ì¥¯¥·¥ç¥ó¤È¤¤¤¤¤Þ¤¹¡£
C# ¤Ë¤Ï¥³¥ì¥¯¥·¥ç¥ó¤ò´ÉÍý¤¹¤ëÊýË¡¤È¤·¤Æ¡¢Dictinary(¥Ç¥£¥¯¥·¥ç¥Ê¥ê¡¼) ¤È List(¥ê¥¹¥È) ¤¬¤¢¤ê¤Þ¤¹¡£
¡¡List ¥¯¥é¥¹¤Ï <T> ¤Ë¥¸¥§¥Í¥ê¥Ã¥¯·¿¡ÊǤ°Õ¤Î·¿¡Ë¤ò»ØÄꤷ¤Æ¡¢Æ±¤¸¥Ç¡¼¥¿·¿¤ò¤Þ¤È¤á¤Æ´ÉÍý¤¹¤ë¥³¥ì¥¯¥·¥ç¥óµ¡Ç½¤ò»ý¤Ä¥¯¥é¥¹¤Ç¤¹¡£
ÇÛÎó¤È°Û¤Ê¤ê¡¢Í×ÁǤò¼«Í³¤ËÄɲᦺï½ü¤Ç¤¤Þ¤¹¡£(Í×ÁÇ¿ô¤¬²ÄÊѤ¹¤ë)
List ¤Ï¥µ¥¤¥º(Ťµ)¤¬²ÄÊѲÄǽ¤ÊÇÛÎó¤Î¥¤¥á¡¼¥¸¤Ç¤¹¡£
¡¡List ¤òÍøÍѤ¹¤ë¾ì¹ç¤Ë¤ÏÇÛÎó¤ÈƱÍͤ˽é´ü²½¤¬²Äǽ¤Ç¤¹¤¬¡¢List¤Ç¤Ï½é´ü²½»þ¤ËÍ×ÁÇ¿ô¤ÎÀë¸À¤¬ÉÔÍפǤ¹¡£
¡¡º£²ó¼ÂÁõ¤·¤¿¤è¤¦¤Ë¡¢public ½¤¾þ»Ò¤Ë¤Æ List ¤òÀë¸À¤¹¤ë¤³¤È¤Ç¡¢¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¾å¤Ç¥µ¥¤¥º¤ÎÊѹ¹¤¬²Äǽ¤Ç¤¹¡£
Î㤨¤ÐË«¾Þ¤Î¥Ç¡¼¥¿¤ò£³¤Äʬºî¤Ã¤ÆÅÐÏ¿¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ç List ¤Î¥µ¥¤¥º¤ò 3 ¤ËÀßÄꤹ¤ì¤Ð
RewardData ¥¯¥é¥¹¤¬ 3 ¤Ä¡¢Element 0 ¡Á Element 2 ¤È¤·¤ÆºîÀ®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢¤³¤³¤ËË«¾Þ¤Î¥Ç¡¼¥¿¤ò£±¤Ä¤º¤Ä¡¢¹ç·×£³¤Äʬ¤Ëʬ¤±¤ÆÅÐÏ¿¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡ãRewardData ¥¯¥é¥¹¤ò°·¤¦ List¡ä
¡¡public List<RewardData> rewardDatasList = new List<RewardData>();
£³£°¡¥RewardDataSO ¥¹¥¯¥ê¥×¥È¤òÍøÍѤ·¤Æ RewardDataSO ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¡¢Ë«¾Þ¤Î¥Ç¡¼¥¿¤òÅÐÏ¿¤¹¤ë
¡¡RewardDataSO ¥¹¥¯¥ê¥×¥È¤ò¸µ¤Ë RewardDataSO ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤Þ¤¹¡£
RewardDataSO ¥¹¥¯¥ê¥×¥È¤ËÍÑ°Õ¤·¤Æ¤¢¤ë RewardData ·¿¤Î List ¤Ç¤¢¤ë rewardDatasList ÊÑ¿ô¤¬¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÌò³ä¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡RewardData ¥¯¥é¥¹¤Ï£±¤Ä¤Î¥Ç¡¼¥¿¾ðÊó¤ò°·¤¦¤³¤È¤¬½ÐÍè¤Þ¤¹¡£º£²ó¤Ç¤¢¤ì¤Ð¥¤¥Ù¥ó¥È£±¤Äʬ¤Î¾ðÊó¤Ç¤¹¡£
¤½¤Î¤¿¤áÊ£¿ô¤Î¥¤¥Ù¥ó¥È¤Î¾ðÊó¤ò°·¤¦É¬Íפ¬¤¢¤ëº£²ó¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¤Ï¡¢¤½¤Îʬ¤À¤± RewardData ¥¯¥é¥¹¤òÄɲ䷤ƺîÀ®¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
¡¡¤½¤ì¤é¤ò´ÉÍý¤¹¤ë¤¿¤á¤Ë RewardData ·¿¤Î List ¤òºî¤ê¡¢¤Þ¤È¤á¤Æ´ÉÍý¤ò½ÐÍè¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£
¤³¤³¤ÇÂçÀڤʤ³¤È¤Ï¡¢£±¤Ä£±¤Ä¤ÎÊ̤ÎÊÑ¿ô¤Ë¸ÄÊÌ¤Ë RewardData ¤¬Â¸ºß¤·¤Æ¤¤¤¿¤Î¤Ç¤Ï¤Þ¤È¤á¤Æ´ÉÍý¤·¤Æ¤¤¤ë¤³¤È¤Ë¤Ï¤Ê¤ê¤Þ¤»¤ó¡£
RewardData ¤Î¥ê¥¹¥È¤È¤Ï¤¹¤Ê¤ï¤Á¡¢RewardData ¤ò¤Þ¤È¤á¤Æ°·¤Ã¤Æ¤¤¤ë¥Ç¡¼¥¿¤Î½¸¹çÂΤˤʤê¤Þ¤¹¤Î¤Ç¡¢¤³¤³¤Ë¥Ç¡¼¥¿¥Ù¡¼¥¹¤È¤·¤ÆÌò³ä¤òÀ®Î©¤µ¤»¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡ºÇ½é¤Ë¡¢¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò´ÉÍý¤¹¤ë¤¿¤á¤Î¥Õ¥©¥ë¥À¤òºîÀ®¤·¤Æ¤ª¤¤Þ¤¹¡£
Project Æâ¤Ç±¦¥¯¥ê¥Ã¥¯¤ò¤·¤Æ¥á¥Ë¥å¡¼¤ò³«¤¡¢Datas ¥Õ¥©¥ë¥À¤òºîÀ®¤·¤Æ¤¯¤À¤µ¤¤¡£
¤³¤ÎÃæ¤ËºîÀ®¤µ¤ì¤¿¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òÆþ¤ì¤Æ´ÉÍý¤·¤Þ¤¹¡£
¡¡Unity ¤Îº¸¾å¤Î¥á¥Ë¥å¡¼¤è¤ê¡¢Assets => Create => Create RewardDataSO ¤òÁªÂò¤·¤Þ¤¹¡£
¿·¤·¤¯ RewardDataSO ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£Ì¾Á°¤Ï¤½¤Î¤Þ¤Þ¤Ç¹½¤¤¤Þ¤»¤ó¡£
¡¡¤³¤Î¥¢¥¤¥³¥ó¤Î·Á¤¬°ã¤¦¥Õ¥¡¥¤¥ë¤¬¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ê¤ê¤Þ¤¹¡£
¤³¤ì¤Ï¥¢¥»¥Ã¥È¤È¤·¤Æ¼è¤ê°·¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¾ðÊó¤Ç¤¹¡£
¡¡RewardDataSO ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò Datas ¥Õ¥©¥ë¥À¤Ø°ÜÆ°¤·¤Æ¤¯¤À¤µ¤¤¡£
º£¸å¤â¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤¿¤é¡¢Datas ¥Õ¥©¥ë¥ÀÆâ¤Ç´ÉÍý¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡ã¥Õ¥©¥ë¥À´ÉÍý¡ä
¡¡Áᮥ¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ò³èÍѤ·¤Æ¡¢¥¤¥Ù¥ó¥È¤Î¥Ç¡¼¥¿¤òÅÐÏ¿¤·¤Æ¤¤¤¤Þ¤·¤ç¤¦¡£
¡¡ºîÀ®¤µ¤ì¤¿ RewardDataSO ¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤òÁªÂò¤·¤Æ¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤ò³Îǧ¤·¤Þ¤¹¡£
RewardDataSO ¥¹¥¯¥ê¥×¥È¤Ë¤ÆÀë¸À¤·¤¿ rewardDatasList ÊÑ¿ô¤¬¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ëɽ¼¨¤µ¤ì¤Æ¡¢ Size¤¬ 0 ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¤³¤ì¤¬¥¹¥¯¥ê¥×¥¿¥Ö¥ë¡¦¥ª¥Ö¥¸¥§¥¯¥È¤ÎÃæ¿È¤Ç¤¹¡£
¡¡Size ¤ËǤ°Õ¤Î¿ô¤òÆþÎϤ¹¤ë¤È¡¢Æ±¿ô¤Î Element ¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£¤³¤ì¤¬ List ¤Ç´ÉÍý¤¹¤ë RewardData ¥¯¥é¥¹¤Î¾ðÊ󷲤ˤʤê¤Þ¤¹¡£
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡Ë«¾ÞÍѤΥǡ¼¥¿¤ò£¶¤ÄʬÅÐÏ¿¤·¤Æ¤ª¤¤¿¤¤¤È»×¤¤¤Þ¤¹¡£
rewardDatasList ÊÑ¿ô¤Î Size ¤ò 6 ¤ËÊѹ¹¤·¤Æ¤¯¤À¤µ¤¤¡£Element 0 ¡Á 5 ¤¬²¼¤ËºîÀ®¤µ¤ì¤Þ¤¹¡£
¡¡Element ¤È¤Ï List ¤ÎÍ×ÁÇ(Ãæ¿È)¤Î¤³¤È¤Ç¤¹¡£
¤½¤Î¤¿¤á¡¢Element £±¤Ä¤¬ RewardData £±¤Ä¤Ë¤Ê¤ê¤Þ¤¹¡£Element ¤ÎÈÖ¹æ¤Ï 0 ¤«¤é»Ï¤Þ¤ê¤Þ¤¹¡£
¡¡°Ê¾å¤Î¤³¤È¤«¤é¡¢£±¤Ä¤Î Element ¤Ë¤Ï£±¤Ä¤Î RewardData ¥¯¥é¥¹¤ÎÆâÍƤòÀßÄê¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¤³¤Î¤È¤¡¢RewardData ¥¯¥é¥¹¤Î¾å¤Ë [Serializable] °À¤òÀë¸À¤·¤Æ¤¤¤ë¤Î¤Ç¡¢RewardData ¥¯¥é¥¹¤ÎÆâÍƤ¬¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ëɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡»î¤·¤Ë¤³¤Î°À¤ò¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£RewardData ¤¬°ìÀÚ¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ëɽ¼¨¤µ¤ì¤Ê¤¯¤Ê¤ê¡¢ÊÔ½¸¤Ç¤¤Ê¤¤¾õÂ֤ˤʤê¤Þ¤¹¡£
¡¡²¼µ¤Î²èÁü¤Î¤è¤¦¤ËÀßÄê¤ò¹Ô¤Ã¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
spriteReward ÊÑ¿ô¤Ë¤Ï²èÁü¤òÅÐÏ¿¤Ç¤¤Þ¤¹¡£¼«Í³¤Ê²èÁü¤òÅÐÏ¿¤·¤Æ¤¯¤À¤µ¤¤¡£
º£²ó¤Ï¥¤¡¼¥¹¥¿¡¼¤ò¥â¥Á¡¼¥Õ¤Ë¤·¡¢Íñ¤òË«¾Þ¤È¤·¤ÆÌ㤦¤è¤¦¤ËÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£
¡¡¤â¤·¤â£±Ëç¤Î²èÁü¤ËÊ£¿ô¤Î²èÁü¥Ç¡¼¥¿¤¬¤Þ¤È¤Þ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢
»öÁ°¤Ë Sprite Editor ¤Îµ¡Ç½¤òÍøÍѤ·¤Æʬ³ä¤·¤Æ¤ª¤¯¤³¤È¤Ç£±¤Ä¤Î²èÁüñ°Ì¤ÇÍøÍѽÐÍè¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
²èÁü¥Ç¡¼¥¿
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡³Æ¿ôÃͤä²èÁü¤ÏǤ°Õ¤Ç¤¹¤¬¡¢No ¤ÎÃͤÀ¤±¤Ï¡¢³Æ¥¤¥Ù¥ó¥È¤Î¼ïÎऴ¤È¤Ë°Û¤Ê¤ëÈÖ¹æ¤ÇÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£¤Ç¤¤ì¤Ð 0 ¤«¤éÏ¢ÈÖ¤¬ÍýÁۤǤ¹¡£
¤³¤ÎÈÖ¹æ¤Ï¥¤¥Ù¥ó¥ÈÍѤθÄÂÎÈÖ¹æ¤È¤·¤ÆÍøÍѤ¹¤ë²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢Æ±¤¸ÈÖ¹æ¤ò½ÅÊ£¤·¤ÆÀßÄꤷ¤Æ¤·¤Þ¤¦¤È¡¢Æ±¤¸ÈÖ¹æ¤Î¸ÄÂΤ¬Ê£¿ô¸ºß¤¹¤ë¤³¤È¤Ë¤Ê¤ê¡¢
Ä̤·ÈÖ¹æ¤Ë¤è¤Ã¤ÆË«¾Þ¤òÆÃÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£
¡¡¼¡¤Ï¡¡¼ê½ç£±£¹¡¡¡¼¤ª»È¤¤¤ÎÆñ°×Å٤˱þ¤¸¤¿Ë«¾Þ¤Î¥Ç¡¼¥¿¤ò¥é¥ó¥À¥à¤ÇÃê½Ð¤¹¤ëµ¡Ç½¤Î¼ÂÁõ¡¼¡¡¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯