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

¡¼¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹½èÍý¤Î¼ÂÁõ¡¼


¡¡¤³¤Î¼ê½ç¤Ç¤Ï¡¢¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹½èÍý¤È¡¢ÀÚ¤êÎ¥¤µ¤ì¤¿¥Ð¥ë¡¼¥ó¤¬¾å¶õ¤Ø¤È¤Õ¤ï¤Õ¤ï¤·¤Ê¤¬¤é°ÜÆ°¤·¤Æ¤¤¤¯À©¸æ¤ò¼ÂÁõ¤·¤Þ¤¹¡£

¡ã¼ÂÁõÆ°²è¡ä
https://gyazo.com/7f6555b1f075e7aec3b5d88572f83d36


¡¡¡¦¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹½èÍý
¡¡¡¦ÀÚ¤êÎ¥¤µ¤ì¤¿¥Ð¥ë¡¼¥ó¤ò¤Õ¤ï¤Õ¤ï¤µ¤»¤Ê¤¬¤é¾å¶õ¤Ø¤È°ÜÆ°¤µ¤»¤ë½èÍý



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

¡¡¡¦GameObject.AddComponent ¥á¥½¥Ã¥É
¡¡¡¦Rigidbody2D ¥¯¥é¥¹¤Î»ý¤ÄÊÑ¿ô¤ò¥¹¥¯¥ê¥×¥È¤«¤éÁàºî¤¹¤ë
¡¡¡¦Rigidbody2D.MovePosition ¥á¥½¥Ã¥É
¡¡¡¦Mathf.PingPong ¥á¥½¥Ã¥É
¡¡¡¦List¤Î»È¤¤Êý­¢¡¡(List.Clear ¥á¥½¥Ã¥É)


£±¡¥Àß·×


¡¡¥Ð¥ë¡¼¥ó¤Î´ÉÍý¤ò PlayerController ¥¹¥¯¥ê¥×¥È¤¬¹Ô¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤³¤Á¤é¤Î¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢¥æ¡¼¥¶¡¼¤¬¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤»¤ë½èÍý¤òÄɲä·¤Þ¤¹¡£
¤³¤ÎÀ©¸æ¤Ï¡¢²èÌ̾å¤Î¥Ü¥¿¥ó¤È¥­¡¼¥Ü¡¼¥É¤Î¥­¡¼¤ÎξÊý¤ÇÁàºî¤ò¹Ô¤¨¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡
¡¡¥í¥¸¥Ã¥¯¤È¤·¤Æ¤Ï¡¢¥Ð¥ë¡¼¥ó¤¬£±¤Ä°Ê¾å¤¢¤ê¡¢¤«¤Ä¥­¥ã¥é¤¬¶õÃæ¤Ë¤¤¤ë´Ö¤Ë¤·¤«ÀÚ¤êÎ¥¤»¤Ê¤¤¡¢¤È¤¤¤¦¾ò·ï¤Ë¤·¤Þ¤¹¡£
¤³¤ì¤Ï£±¤Ä¤Î¥Ü¥¿¥ó¤ò£²¤Ä¤ÎÁàºî¤ËÍøÍѤ¹¤ë¤¿¤á¤Ç¤â¤¢¤ê¤Þ¤¹¡£

¡¡Detach/Generate ¥Ü¥¿¥ó¤òÁàºî¤¹¤ë¤È¡¢¾ò·ï¤Ë¤è¤Ã¤Æ¡¢°Ê²¼¤Î¤è¤¦¤Ë¿¶¤ëÉñ¤¤¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡£±¡¥¥Ð¥ë¡¼¥ó¤¬£±¤Ä°Ê¾å¤¢¤ê¡¢¤«¤Ä¡¢¥­¥ã¥é¤¬¶õÃæ¤Ë¤¤¤ë´Ö¤Ë¥Ü¥¿¥ó¤ò²¡¤¹¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡=>¡¡¥Ð¥ë¡¼¥ó¤ò¤¹¤Ù¤ÆÀÚ¤êÎ¥¤¹
¡¡£²¡¥¥Ð¥ë¡¼¥ó¤¬ºÇÂçÃͤè¤ê¤â¾¯¤Ê¤¤¿ô¤Ç¤¢¤ê¡¢¤«¤Ä¡¢¥­¥ã¥é¤¬¾²¤Î¾å¤Ë¤¤¤ë´Ö¤Ë¥Ü¥¿¥ó¤ò²¡¤¹¡¡=>¡¡¥Ð¥ë¡¼¥ó¤ò£±¤ÄÀ¸À®¤¹¤ë
¡¡£³¡¥¾åµ­°Ê³°¤Ï¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤â½èÍý¤Ï¤Ê¤¤

¡¡¾åµ­¤ÎÆüËܸì¤ò¥í¥¸¥Ã¥¯²½¤·¤Æ¡¢PlayerController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¥Ü¥¿¥ó¤ÎÁàºî¤ËÂбþ¤¹¤ë¥á¥½¥Ã¥É¤Ï¤¹¤Ç¤Ë OnClickDetachOrGenerate ¥á¥½¥Ã¥É¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢¤³¤ÎÃæ¤Çʬ´ô¤òºî¤ê¡¢¾åµ­¤Î£²¤Ä¤Î¾ò·ï¤Ë¹ç¤ï¤»¤Æ½èÍý¤òÀ©¸æ¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£

¡¡¥Ð¥ë¡¼¥ó¤òÀ¸À®¤¹¤ë½èÍý¤Ë¤Ï¥á¥½¥Ã¥É¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹½èÍý¤â¿·¤·¤¯ DetachBallons ¥á¥½¥Ã¥É¤òÍÑ°Õ¤·¤Æ¡¢¤³¤ÎÃæ¤ÇÀÚ¤êÎ¥¤¹½èÍý¤ò¹Ô¤¦¤è¤¦¤Ë¹Í¤¨¤Þ¤¹¡£

¡¡¤Þ¤¿ÀÚ¤êÎ¥¤µ¤ì¤¿¥Ð¥ë¡¼¥ó¤Ï¡¢¸½¼Â¤ÎÀ¤³¦¤ÈƱ¤¸¤è¤¦¤Ë¾å¶õ¤Ø¸þ¤«¤Ã¤Æ¾å¾º¤·¤Æ¤¤¤¯¤è¤¦¤Ë¤·¤¿¤¤¤Ç¤¹¤Í¡£
¤½¤ÎÀ©¸æ¤Ë¤Ä¤¤¤Æ¤Ï¡¢Ballon ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢¿·¤·¤¤ FloatingBallon ¥á¥½¥Ã¥É¤òºîÀ®¤·¤Æ¡¢½èÍý¤òÄɲä·¤Þ¤¹¡£
¤³¤Á¤é¤Ç¡¢º¸±¦¤Ë¤Õ¤ï¤Õ¤ï¤·¤Ê¤¬¤é¾å¾º¤µ¤»¤ëÀ©¸æ¤ò¹Ô¤¤¤Þ¤·¤ç¤¦¡£

¡¡¥Ð¥ë¡¼¥ó¤ÎÀ©¸æ½èÍý¤Ë¤Ä¤¤¤Æ¤Ï PlayerController ¥¹¥¯¥ê¥×¥È¤¬ Ballon ·¿¤Î List ¤Ç¤¹¤Ù¤Æ¤Î¥Ð¥ë¡¼¥ó¤ò´ÉÍý¤·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢
¤³¤ì¤òÍøÍѤ·¤Æ FloatingBallon ¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹À߷פˤ¹¤ì¤ÐÌ¿Îá¤ò½Ð¤·¤ä¤¹¤¤¤Ç¤¹¡£¤³¤Î´ÉÍý¤ò¹Ô¤¤¤ä¤¹¤¯¤¹¤ë¤¿¤á¤ËÁ°²ó List ¤Ø¤ÎÊѹ¹½èÍý¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£

¡¡½çÈ֤Ȥ·¤Æ¤Ï¡¢Ballon ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ½èÍý¤òÄɲä·¡¢¤½¤Î¸å¡¢PlayerController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ½èÍý¤òÄɲä·¤Þ¤¹¡£


£²¡¥Ballon ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤¹¤ë


¡¡¤³¤Î¼ÂÁõ¤Ï°ìÎã¤Ç¤¹¤Î¤Ç¡¢¼«Í³¤Ë¼ÂÁõ¤ò¤ª¤³¤Ê¤Ã¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£

¡¡¥Ð¥ë¡¼¥ó¤òÁàºî¤¹¤ë¤Ë¤¢¤¿¤ê¡¢¿·¤·¤¯ FloatingBallon ¥á¥½¥Ã¥É¤È FixedUpdate ¥á¥½¥Ã¥É¤òºîÀ®¤·¤Æ¡¢¤½¤ÎÃæ¤ÇÀ©¸æ¤ò¹Ô¤¤¤Þ¤¹¡£

¡¡PlayerController ¥¹¥¯¥ê¥×¥È¤è¤ê¡¢FloatingBallon ¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢¥Ð¥ë¡¼¥ó¤ò¡ÖÀÚ¤êÎ¥¤µ¤ì¤¿¡×¾õÂÖ¤òºî¤ê½Ð¤·¤Þ¤¹¡£
¤½¤·¤Æ¡¢¡ÖÀÚ¤êÎ¥¤µ¤ì¤¿¡×¾õÂ֤ˤʤ俥Х롼¥ó¤ò FixedUpdate ¥á¥½¥Ã¥ÉÆâ¤Ç¾å¾º¤µ¤»¤ë½èÍý¤ò¼Â¹Ô¤·¤Þ¤¹¡£

¡¡¥Ð¥ë¡¼¥ó¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë Rigidbody2D ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÄɲ䷤ơ¢°ÜÆ°¤ÎÀ©¸æ¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¥Ð¥ë¡¼¥ó¤Ï¤³¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó¤Î¤Ç¡¢¥¹¥¯¥ê¥×¥È¤«¤éưŪ¤Ë¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÄɲ䷤ưÜÆ°½èÍý¤ò¼Â¹Ô¤·¤Þ¤¹¡£
Äɲ䵤줿¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ï½é´üÀßÄê¤Î¾õÂÖ¤ÇÄɲ䵤ì¤Þ¤¹¡£¤½¤Î¤¿¤á¡¢½ÅÎϤαƶÁ¤ò¼õ¤±¤ë¾õÂ֤ˤʤäƤ¤¤ë¤¿¤á¡¢¤½¤ì¤òÀ©¸æ¤·¤Æ½ÅÎϤαƶÁ¤ò¤Ê¤¯¤·¤Þ¤¹¡£

¡¡Rigidbody2D ¤òÍøÍѤ·¤¿°ÜÆ°½èÍý¤Ï FixedUpdate ¥á¥½¥Ã¥ÉÆâ¤Ë MovePosition ¥á¥½¥Ã¥É¤òµ­½Ò¤·¡¢¤Õ¤ï¤Õ¤ï¤ÈÉâÍ·¤¹¤ë½èÍý¤Ë¤Ä¤¤¤Æ¤Ï¡¢Mathf.PingPong ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Þ¤¹¡£

¡¡¤Õ¤ï¤Õ¤ï¤È¤µ¤»¤ë½èÍý¤Ë¤Ä¤¤¤Æ¤Ï¡¢Start ¥á¥½¥Ã¥É¤Ç¼Â¹Ô¤·¤Æ¤¤¤ë DOTween ¤Î¥ë¡¼¥×½èÍý¤È¶¥¹ç¤·¤Æ¤·¤Þ¤Ã¤Æ¾å¼ê¤¯µóÆ°¤¬À©¸æ¤Ç¤­¤Ê¤¯¤Ê¤ë¤¿¤á¡¢
ºÇ½é¤Ë¡¢DOTween ¤Î¥ë¡¼¥×½èÍý¤ò½ªÎ»¤µ¤»¤Æ¤«¤é¡¢¤Õ¤ï¤Õ¤ï¤È¤µ¤»¤ë½èÍý¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£


Ballon.cs

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



£³¡¥¡ãGameObject.AddComponent ¥á¥½¥Ã¥É¡ä


¡¡»ØÄꤷ¤¿¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë <¥¯¥é¥¹Ì¾> ¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò¥¹¥¯¥ê¥×¥È¤«¤éÄɲ乤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
¤³¤Î¥á¥½¥Ã¥É¤Ï¡¢Äɲä·¤¿¥¯¥é¥¹¤ÈƱ¤¸·¿¤òÌá¤êÃͤȤ·¤Æ»ý¤Á¤Þ¤¹¡£

  // Rigidbody2D¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò¥Ð¥ë¡¼¥ó¤ËÄɲä·¤ÆÂåÆþ
  rb = gameObject.AddComponent<Rigidbody2D>();

¡¡¾åµ­¤ÎÌ¿Îá¤Ï¡¢¥Ð¥ë¡¼¥ó¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë Rigidbody2D ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÄɲä·¡¢Ìá¤êÃͤˤâ Rigidbody2D ·¿¤ò»ý¤Ã¤Æ¤¤¤ë¤¿¤á¡¢¤½¤ì¤òº¸ÊÕ¤ØÂåÆþ½èÍý¤·¤Æ¤¤¤Þ¤¹¡£

»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
GameObject.AddComponent
https://docs.unity3d.com/ja/current/ScriptReferenc...


£´¡¥¡ãRigidbody2D ¥¯¥é¥¹¤Î»ý¤ÄÊÑ¿ô¤ò¥¹¥¯¥ê¥×¥È¤«¤éÁàºî¤¹¤ë¡ä


¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤ÇÀßÄê¤Ç¤­¤ëÊÑ¿ô¤Ï¡¢¥¹¥¯¥ê¥×¥È¤«¤é¤âưŪ¤ËÊѹ¹¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£º£²ó¤Ï Rigidbody2D ¤Ë¤Ä¤¤¤ÆÀßÄê¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£

¡¡AddComponent ¥á¥½¥Ã¥É¤Ë¤è¤Ã¤ÆÄɲ䵤줿 ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ï¡¢¤½¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î½é´üÃͤò»ý¤Ã¤¿¾õÂÖ¤ÇÄɲ䵤ì¤Þ¤¹¡£
º£²ó¥Ð¥ë¡¼¥ó¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ËÄɲä·¤¿ Rigidbody2D ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤â½é´ü¾õÂÖ¤ÇÄɲ䵤ì¤Æ¤·¤Þ¤¦¤¿¤á¡¢
½ÅÎϤÎÀßÄê¤Ï 1 (½ÅÎϤ¢¤ê¤Î¾õÂÖ)¡¢FreezeRotation ¤ÎÀßÄê¤Ï¥ª¥Õ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢¤½¤ì¤ò¥¹¥¯¥ê¥×¥È¤«¤éÊѹ¹¤·¤Æ¡¢À©¸æ¤¹¤ë¤¿¤á¤Ç¤¹¡£

  // ½ÅÎϤÏ0¤Ë¤¹¤ë
  rb.gravityScale = 0;

  // ²óž¤â¸ÇÄꤹ¤ë
  rb.freezeRotation = true;

¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ë¸«¤¨¤Æ¤¤¤ë¾ðÊó¤Ï public ¾ðÊó¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢¥¹¥¯¥ê¥×¥È¤«¤éÀ©¸æ¤Ç¤­¤ë¤³¤È¤ò³Ð¤¨¤Æ¤ª¤­¤Þ¤·¤ç¤¦¡£
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
Rigidbody2D
https://docs.unity3d.com/ja/current/ScriptReferenc...


£µ¡¥¡ãRigidbody2D.MovePosition ¥á¥½¥Ã¥É¡ä


¡¡ÊªÍý±é»»¤òÍѤ¤¤Æ¡¢Rigidbody2D ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃÖ¤ò°ÜÆ°¤µ¤»¤Þ¤¹¡£

  // ¥Ð¥ë¡¼¥ó¤òº¸±¦¤ËÍɤ餹
  rb.MovePosition(new Vector2(pos.x + Mathf.PingPong(Time.time, 1.5f), pos.y));

»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
Rigidbody2D.MovePosition
https://docs.unity3d.com/ja/current/ScriptReferenc...


£¶¡¥¡ãMathf.PingPong ¥á¥½¥Ã¥É¡ä


¡¡¿ô³Ø´Ø¿ô¤ò°·¤¦ Mathf ¥¯¥é¥¹¤Î»ý¤Ä¥á¥½¥Ã¥É¤Î£±¤Ä¤Ç¤¹¡£
Update ¥á¥½¥Ã¥É¤ä FixedUpdate ¥á¥½¥Ã¥ÉÆâ¤Ëµ­½Ò¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¥ª¥Ö¥¸¥§¥¯¥È¤ò¥¸¥°¥¶¥°¤ËÆ°¤«¤¹¤è¤¦¤ÊµóÆ°¤òÀ©¸æ¤Ç¤­¤Þ¤¹¡£
º£²ó¤Ï Rigidbody2D ¤òÍøÍѤ·¤Æ°ÜÆ°¤ò¤µ¤»¤Æ¤¤¤ë¤Î¤Ç¡¢FixedUpdate ¥á¥½¥Ã¥ÉÆâ¤Ë½èÍý¤òµ­½Ò¤·¤Æ¤¤¤Þ¤¹¡£

  // ¥Ð¥ë¡¼¥ó¤òº¸±¦¤ËÍɤ餹
  rb.MovePosition(new Vector2(pos.x + Mathf.PingPong(Time.time, 1.5f), pos.y));

¡¡¾åµ­¤ÎÎã¤Î¾ì¹ç¡¢Âè1°ú¿ô¤Î Time.time ¤Ï°ÜÆ°¥¹¥Ô¡¼¥É¤òɽ¤·¤Þ¤¹¡£¤Þ¤¿¡¢Âè2°ú¿ô¤Î 1.5f ¤Ï°ÜÆ°µ÷Î¥¤òɽ¤·¤Þ¤¹¡£

»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
Mathf.PingPong
https://docs.unity3d.com/ja/current/ScriptReferenc...
Íõ¤Èø¡¹ ÍÍ
¡ÚUnity¡ÛÃΤäÆÆÀ¤¹¤ëMathf¥¯¥é¥¹
http://megumisoft.hatenablog.com/entry/2015/08/29/...
Qiita @uroshinse ÍÍ
¥ª¥Ö¥¸¥§¥¯¥È¤ò¥¸¥°¥¶¥°¤ËÆ°¤«¤·¤Æ¤ß¤ë
https://qiita.com/uroshinse/items/f0a98b8e0b99c85c...


£·¡¥PlayerController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹½èÍý¤È¡¢¥Ð¥ë¡¼¥ó¦¤ÎÀ©¸æ½èÍý¤Î¸Æ¤Ó½Ð¤·¤òÄɲ乤ë


¡¡Àë¸À¥Õ¥£¡¼¥ë¥É¤Ë¿·¤·¤¤ÊÑ¿ô¤ÎÄɲäϤ¢¤ê¤Þ¤»¤ó¡£

¡¡Update ¥á¥½¥Ã¥É¤È OnClickDetachOrGenerate ¥á¥½¥Ã¥É¤ò½¤Àµ¤·¡¢¿·¤·¤¯ºîÀ®¤¹¤ë DetachBallons ¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·¤òÄɲä·¤Þ¤¹¡£
¡¡
¡¡DetachBallons ¥á¥½¥Ã¥É¤Ç¤Ï¡¢¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹½èÍý¤ò¹Ô¤¤¡¢¤Þ¤¿ÀÚ¤êÎ¥¤·¤¿¥Ð¥ë¡¼¥ó¤Î Ballon ¥¹¥¯¥ê¥×¥È¤Î FloatingBallon ¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹Ì¿Îá¤ò½Ð¤·¡¢
ÀÚ¤êÎ¥¤µ¤ì¤¿¥Ð¥ë¡¼¥ó¤¬¾å¶õ¤Ø¤Õ¤ï¤Õ¤ï¤È°ÜÆ°¤¹¤ë¤è¤¦¤ËÀ©¸æ¤µ¤»¤Þ¤¹¡£


PlayerController.cs

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



¡¡¥¹¥¯¥ê¥×¥È¤Î½¤Àµ¤¬½ªÎ»¤·¤¿¤é¡¢Yuko_Player ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤ò³Îǧ¤·¤Þ¤¹¡£
¿·¤·¤¤ÊÑ¿ô¤ÎÄɲäϤ¢¤ê¤Þ¤»¤ó¤Î¤Ç¡¢¥¢¥µ¥¤¥ó¤¬³°¤ì¤Æ¤¤¤Ê¤¤¤«³Îǧ¤ò¤·¤Æ¤¯¤À¤µ¤¤¡£


Yuko_Player ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü



£¸¡¥¡ãList¤Î»È¤¤Êý­¢¡¡(List.Clear ¥á¥½¥Ã¥É)¡ä


¡¡Clear ¥á¥½¥Ã¥É¤òÍøÍѤ¹¤ë¤È¡¢List ¤ÎÍ×ÁǤò¤¹¤Ù¤Æºï½ü¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£¼Â¹Ô¤¹¤ë¤È¡¢List ¤ÎÍ×ÁǤϤʤ¯¤Ê¤ê¡¢Ä¹¤µ(Count) ¤Ï 0 ¤Ë¤Ê¤ê¤Þ¤¹¡£

  // ¥Ð¥ë¡¼¥ó¤Î¥ê¥¹¥È¤ò¥¯¥ê¥¢¤·¡¢ºÆÅÙ¡¢¥Ð¥ë¡¼¥ó¤òÀ¸À®¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë
  ballonList.Clear();

»²¹Í¥µ¥¤¥È
SamuraiBlog ÍÍ
¡ÚC#ÆþÌç¡ÛAdd¡¢Remove¤ÇList¤ÎÍ×ÁǤòÄɲᢺï½ü¤¹¤ëÊýË¡
https://www.sejuku.net/blog/41093


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


¡¡¤¹¤Ù¤Æ¤Î¼ê½ç¤¬´°Î»¤·¤Þ¤·¤¿¤Î¤Ç¡¢¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¡¢¥Ð¥ë¡¼¥ó¤¬ÀÚ¤êÎ¥¤»¤ë¤«¤É¤¦¤«¡¢½çÈ֤˳Îǧ¤ò¹Ô¤¤¤Þ¤¹¡£

¡¡¥Ð¥ë¡¼¥ó¤¬£±¤Ä°Ê¾å¤¢¤ë¤È¤­¤Ë¶õÃæ¤Ç¡¢ÀÚ¤êÎ¥¤·¥Ü¥¿¥ó¡¢¤¢¤ë¤¤¤Ï R ¥­¡¼¤ò²¡¤¹¤È¡¢¥Ð¥ë¡¼¥ó¤¬ÀÚ¤êÎ¥¤µ¤ì¤Þ¤¹¡£


¡ã¼Â¹ÔÆ°²è¡¡¥Ð¥ë¡¼¥ó¤ò¶õÃæ¤ÇÀÚ¤êÎ¥¤¹¡ä
https://gyazo.com/7f6555b1f075e7aec3b5d88572f83d36



¡¡¾²¤Ë¤¤¤ë´Ö¤Ë¤Ï¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£¤Þ¤¿¡¢¥Ð¥ë¡¼¥ó¤¬£±¤Ä¤Î¤È¤­¤Ë¥Ü¥¿¥ó¤ò²¡¤¹¤È¡¢ÀÚ¤êÎ¥¤¹Âå¤ï¤ê¤Ë£²¤ÄÌܤΥХ롼¥ó¤òÀ¸À®¤·¤Þ¤¹¡£


¡ã¼Â¹ÔÆ°²è¡¡¾²¤Ë¤¤¤ë´Ö¤ÏÀÚ¤êÎ¥¤»¤Ê¤¤¡£¥Ð¥ë¡¼¥ó¤¬£±¤Ä¤Î¤È¤­¤Ï¡¢ÀÚ¤êÎ¥¤¹Âå¤ï¤ê¤Ë£²¤ÄÌܤΥХ롼¥ó¤òÀ¸À®¤¹¤ë¡ä
https://gyazo.com/4752c686941c8e1903df7f9ebe8b6c4e



¡¡ÀÚ¤êÎ¥¤¹¤Î¤Ï¡¢¤½¤Î»þ¤ËÇØÃæ¤Ë¤¢¤ë¤¹¤Ù¤Æ¤Î¥Ð¥ë¡¼¥ó¤Ë¤Ê¤ê¤Þ¤¹¡£


¡ã¼Â¹ÔÆ°²è¡¡¤¹¤Ù¤Æ¤Î¥Ð¥ë¡¼¥ó¤òÀÚ¤êÎ¥¤¹¡ä
https://gyazo.com/806ee668e0f7f97e3f78b20491461356



¡¡ÀÚ¤êÎ¥¤µ¤ì¤¿¥Ð¥ë¡¼¥ó¤Ï¤Õ¤ï¤Õ¤ï¤Èº¸±¦¤ËÍɤì¤Ê¤¬¤é¾å¾º¤·¤Æ¤¤¤­¡¢²èÌ̳°¤Î¤¢¤ëÄøÅ٤ΰÌÃ֤˹Ԥ¯¤ÈÇË´þ¤µ¤ì¤Þ¤¹¡£


¡ã¼Â¹ÔÆ°²è¡¡ÀÚ¤êÎ¥¤µ¤ì¤¿¥Ð¥ë¡¼¥ó¤Ï²èÌ̳°¤Ë¹Ô¤¯¤È¼«Æ°¤ÇÇË´þ¡ä
https://gyazo.com/ef9f9103c806e971ebf27ef99134c21c



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

¡¡¼¡¤Ï¡¡È¯Å¸£³¡¡¡Ý¥¿¥¤¥È¥ë±é½Ð¤ÎÄɲáÝ

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


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

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

Menu


´ðÁÃ

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

private



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

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