Unity¤Ë´ØÏ¢¤¹¤ëµ­»ö¤Ç¤¹

¡¡°Ê²¼¤ÎÆâÍƤǽçÈ֤˼ÂÁõ¤ò¿Ê¤á¤Æ¤¤¤­¤Þ¤¹¡£

£±£²¡¥GameManager¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤¹¤ë­£¡¡Æ±¤¸´³»ÙƱ»Î¤ò¥¹¥ï¥¤¥×¤·¤Æ·Ò¤²¤é¤ì¤ë¤è¤¦¤Ë¤¹¤ë



¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£

¡¦Vector2.Distance()¥á¥½¥Ã¥É



£±£²¡¥GameManager¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤¹¤ë­£¡¡Æ±¤¸´³»ÙƱ»Î¤ò¥¹¥ï¥¤¥×¤·¤Æ·Ò¤²¤é¤ì¤ë¤è¤¦¤Ë¤¹¤ë


¡¡GameManager¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢²èÌÌÆâ¤Î´³»ÙƱ»Î¤ò¥É¥é¥Ã¥°¡Ê¥¹¥ï¥¤¥×¡Ë¤·¤Æ¤Ä¤Ê¤²¤Æ¤¤¤¯½èÍý¤ò¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡£
¹ç¤ï¤»¤Æ¡¢°Û¤Ê¤ë´³»ÙƱ»Î¤¬¤Ä¤Ê¤¬¤é¤Ê¤¤¤è¤¦¤Ë¤âÀ©¸æ¤·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤½¤ÎÉôʬ¤â¥Ç¥Ð¥Ã¥°»þ¤Ë¤Ï³Îǧ¤ò¹Ô¤¤¤Þ¤¹¡£

¡¡£²¤Ä°Ê¾å¤ÎƱ¤¸´³»Ù¤ò¤Ä¤Ê¤²¤Æ¡¢Á°¤Î´³»Ù¤Ë¥É¥é¥Ã¥°¤òÌᤷ¤¿¾ì¹ç¡¢¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤¿´³»ÙƱ»Î¤Î¤Ä¤Ê¤¬¤ê¤¬²ò½ü¤µ¤ì¤ë½èÍý¤â¼ÂÁõ¤·¤Þ¤¹¤Î¤Ç
¤³¤Á¤é¤â¥Ç¥Ð¥Ã¥°»þ¤Ë¤Ï˺¤ì¤º¤Ë³Îǧ¤ò¹Ô¤¤¤Þ¤¹¡£Î㤨¤Ð¡¢£³¤Ä¤Î´³»Ù¤¬¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë£²¤ÄÌܤδ³»Ù¤Ë¥É¥é¥Ã¥°¤òÌᤷ¤¿¾ì¹ç¡¢
£³¤ÄÌܤδ³»Ù¤¬ºï½ü¤ÎÂоݤ«¤é³°¤ì¤Æ¡Êºï½ü¥ê¥¹¥È¤«¤é½ü³°¤µ¤ì¤Æ¡Ë¡¢´³»Ù¤ÎÆ©ÌÀÅÙ¤¬¸µ¤ÎÆ©ÌÀÅÙ¤ËÌá¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£


GameManager.cs

¡¡<=¡¡¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹¡£



¡ãVector2.Distance()¥á¥½¥Ã¥É¡ä


¡¡Â裱°ú¿ô¤ÈÂ裲°ú¿ô¤Ë»ØÄꤷ¤¿Vector2·¿¤Î£²ÅÀ´Ö¤Îµ÷Î¥¤ò¡¢float·¿¤ËÊÑ´¹¤·¤Æµ÷Î¥¤È¤·¤ÆÌᤷ¤Æ¤¯¤ì¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
Ìá¤êÃͤ˹ç¤ï¤»¤ÆÊդˤÏfloat·¿¤ÎÊÑ¿ô¤òÍÑ°Õ¤·¤ÆÂåÆþ¤µ¤»¤Þ¤¹¡£

// ¸½ºß¥¿¥Ã¥×¤·¤Æ¤¤¤ë´³»Ù¤Î°ÌÃÖ¾ðÊó¤ÈºÇ¸å¤Ë¥¿¥Ã¥×¤·¤¿´³»Ù¤Î°ÌÃÖ¾ðÊó¤ÈÈæ¤Ù¤Æ¡¢º¹Ê¬¤ÎÃÍ¡Ê´³»ÙÄ̤·¤Îµ÷Î¥¡Ë¤ò¼è¤ë
float distance = Vector2.Distance(dragEto.transform.position, lastSelectEto.transform.position);
¡¡
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
Vector2.Distance
https://docs.unity3d.com/ja/current/ScriptReferenc...


¥²¡¼¥à¤ò¼Â¹Ô¤·¤ÆÆ°ºî¤ò³Îǧ¤¹¤ë


¡¡¥¹¥ï¥¤¥×½èÍý¤òÄɲä·¤Þ¤·¤¿¤Î¤Ç¡¢²èÌ̤δ³»Ù¤ò¥¿¥Ã¥×¤·¤¿¤Þ¤ÞƱ¤¸¼ïÎà¤Î´³»Ù¤Ø¤È¤½¤Î¤Þ¤Þ°ÜÆ°¤ò¤µ¤»¤Æ¤ß¤Þ¤·¤ç¤¦¡£
Editor¤Ç³Îǧ¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢º¸¥¯¥ê¥Ã¥¯¤ò¤·¤¿¤Þ¤ÞƱ¤¸´³»Ù¤Ø¤È¥«¡¼¥½¥ë¤ò°ÜÆ°¤µ¤»¤Þ¤¹¡£

¡¡Æ±¤¸´³»ÙƱ»Î¤ò¤Ä¤Ê¤¬¤ë¤³¤È¤¬¤Ç¤­¤ì¤Ð¡¢¤½¤Î¿·¤·¤¤´³»Ù¤ÎÆ©ÌÀÅÙ¤¬È¾Æ©ÌÀ¤Ë¤Ê¤ê¡¢GameManager¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎEraseEtoList¤ËÄɲ䵤ì¤Þ¤¹¡£

¡¡¤³¤Î¤È¤­¡¢Ê̤βèÁü¤Î´³»ÙƱ»Î¤¬¤Ä¤Ê¤¬¤Ã¤Æ¤·¤Þ¤ï¤Ê¤¤¤«¤â¡¢¹ç¤ï¤»¤Æ³Îǧ¤ò¹Ô¤¤¤Þ¤¹¡£

¡¡¤Þ¤¿¡¢£²¤Ä°Ê¾å¤Î´³»Ù¤ò¤Ä¤Ê¤¤¤À¾õÂ֤ǣ±¤ÄÁ°¤Î´³»Ù¤Ë°ÜÆ°¤ò¤µ¤»¤¿¾ì¹ç¡¢¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤¿´³»Ù¤¬¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤Ê¤¤¾õÂÖ¤ËÌá¤ë¤«¤â³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£


¸¡¾ÚÆ°²è¡Ê¤Ä¤Ê¤¬¤Ã¤¿´³»ÙƱ»Î¤Î¿§¤¬È¾Æ©ÌÀ¤Ë¤Ê¤ë¡£Â¾¤Î²èÁü¤Î´³»Ù¤Ë¤Ï¤Ä¤Ê¤¬¤é¤Ê¤¤¡£Á°¤Î´³»Ù¤ËÌá¤ë¤È¤Ä¤Ê¤¬¤ê¤¬²ò½ü¤µ¤ì¤ë¡Ë
https://gyazo.com/9fdc1ac54f3a558ac17eb37fa6b34f19


GameManager¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¤¥ó¥¹¥Ú¥¯¥¿¡¼Æ°²è¡Ê´³»ÙƱ»Î¤¬¤Ä¤Ê¤¬¤Ã¤¿¤ê¡¢¤Ä¤Ê¤¬¤ê¤¬²ò½ü¤µ¤ì¤¿¤ê¤¹¤ë¤¿¤Ó¤Ë¡¢EraseEtoList¤ËÄɲᦺï½ü¤¬¹Ô¤ï¤ì¤ë¡Ë
https://gyazo.com/9fdc1ac54f3a558ac17eb37fa6b34f19



¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£

¡¡¼¡¤Ï ¼ê½ç£· ¤Ç¤¹¡£

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

Menu


´ðÁÃ

µ»½Ñ/Ãμ±(¼ÂÁõÎã)

3D¥¢¥¯¥·¥ç¥ó¥²¡¼¥à

2D¤ª¤Ï¤¸¤­¥²¡¼¥à(ȯŸÊÔ)

2D¶¯À©²£¥¹¥¯¥í¡¼¥ë¥¢¥¯¥·¥ç¥ó(ȯŸÊÔ)

2D¥¿¥Ã¥×¥·¥å¡¼¥Æ¥£¥ó¥°(³ÈÄ¥ÊÔ)

¥ì¡¼¥¹¥²¡¼¥à(È´¿è)

2DÊüÃÖ¥²¡¼¥à(ȯŸÊÔ)

3D¥ì¡¼¥ë¥¬¥ó¥·¥å¡¼¥Æ¥£¥ó¥°(±þÍÑÊÔ)

3Dæ½Ð¥²¡¼¥à(È´¿è)

2D¥ê¥¢¥ë¥¿¥¤¥à¥¹¥È¥é¥Æ¥¸¡¼

3D¥¿¥Ã¥×¥¢¥¯¥·¥ç¥ó(NavMeshAgent »ÈÍÑ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥«¥¨¥ë¤Î°Ù¤Ë¡Á¡¢¥Ü¥³¥¹¥«¥¦¥©¡¼¥ºÉ÷)

VideoPlayer ¥¤¥Ù¥ó¥ÈϢư¤Î¼ÂÁõÎã

VideoPlayer ¥ê¥¹¥ÈÆ⤫¤é¥à¡¼¥Ó¡¼ºÆÀ¸¤Î¼ÂÁõÎã(ȯŸ)

AR ²èÁüÉÕ¤­¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®¤Î¼ÂÁõÎã

AR ¥ê¥¹¥ÈÆ⤫¤éÀ¸À®¤Î¼ÂÁõÎã(ȯŸ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥µ¥Ð¥¤¥Ð¡¼É÷)

private



¤³¤Î¥µ¥¤¥ÈÆâ¤ÎºîÉʤϥæ¥Ë¥Æ¥£¤Á¤ã¤ó¥é¥¤¥»¥ó¥¹¾ò¹à¤Î¸µ¤ËÄ󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡£

´ÉÍý¿Í/Éû´ÉÍý¿Í¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹