Unityãã¤ã³ã¹ãã¼ã«ãã¦ã¿ãããã©ããã©ããã£ã¦ã²ã¼ã ãä½ã£ã¦ããã°ãããåãããªãï¼ãã¨ããæ¹ã¯å¤ãã¨æãã¾ãã
ããããç§ãUnityã触ãå§ããã¨ãã¯ãä½ãã©ããã¦ããã®ããã£ã±ãåããã¾ããã§ããã
ããã§ãç°¡åãªã·ã¥ã¼ãã£ã³ã°ã²ã¼ã ãä½ããªããUnityã®ä½¿ãæ¹ãç´¹ä»ã§ããã°ã¨æãã¾ããã
è¨äºã¯ç¬¬ï¼åã第ï¼åã¾ã§ããã次ã®ãããªæµãã«ãªã£ã¦ãã¾ãã
第ï¼åããã±ãããåããã
第ï¼åãå¼¾ãçºå°ããã
第ï¼åãéç³ãè½ä¸ãããã
第ï¼åãå½ããå¤å®ãããã
第ï¼åãã²ã¼ã ãªã¼ããå¤å®ããã
第ï¼åããå粧ãããã
ï¼è¨äºãã¯ï¼ï¼åç¨åº¦ã§åºæ¥ãããã«ãã¦ããã®ã§ãå
¨é¨ã§60åï¼ã¡ãã£ã¨ãã¤ãï¼ã®äºå®ã§ãã
ã¾ããæéã¯æ°ã«ããã®ãã³ãã¨ãã£ã¦ã¿ã¦ä¸ãããç¬
ã¹ã¯ãªããã®æ¸ãæ¹ãã¯ã©ã¹ã®ä½ãæ¹ã¯ç§ã®æ¸ããæ¬ãUnityã®æç§æ¸ãã«ãããã£ã¦ä½ã£ã¦ããã®ã§ããã¡ããåèã«ãã¦ä¸ãããã
ä»åä½ãã²ã¼ã ã®æ¦è¦
ä»åUnityã§ä½ãã²ã¼ã ã¯æ¬¡ã®ãããªè¦ãç®ã®ã·ã¥ã¼ãã£ã³ã°ã²ã¼ã ã«ãªãã¾ãã
èªæ©ã¯å·¦å³ãã¼ã§ç§»åãããã¹ãã¼ã¹ãã¼ã§å¼¾ãæã¡ã¾ãã
ç»é¢ã®ä¸ç«¯ããã¯éç³ãè½ä¸ãã¦æ¥ãã®ã§ç ´å£ãã¦ä¸ããããããç ´å£ã§ããã«ç»é¢ã®ä¸ç«¯ãéç³ãè¶
ããã¨ã²ã¼ã ãªã¼ãã«ãªãã¾ãã
ããã¸ã§ã¯ããä½æããã
ã¾ãã¯ãUnityã®ããã¸ã§ã¯ããä½æããã¨ããããã¯ããã¾ãããã
Unityã®ã¹ã¿ã¼ãã¢ããç»é¢ã§ãããã¸ã§ã¯ãåããSampleShootingããã²ã¼ã ã¿ã¤ãã«ã2Dããé¸æãã¾ãã
次ã«ãç»é¢ã®è¨å®ãè¡ãã¾ããããä»åã¯ç¸¦é·ã®ç»é¢ã¬ã¤ã¢ã¦ãã«ããã®ã§Gameã¿ããã¯ãªãã¯ããã¢ã¹ãã¯ãæ¯ãé¸æãã¾ãã
Unityã«ã¯ç¸¦é·ã®ã¢ã¹ãã¯ãæ¯ãç¨æããã¦ããªããããä¸çªä¸ã®ãï¼ãã¿ã³ããã¯ãªãã¯ãã¦Typeã«ãAspect RatioããWidth&Heightã«ã9:16ãã¨å
¥åãã¦ä¸ããã
Unityã§ã²ã¼ã ãä½ãã®ã«å¿ è¦ãªç´ æãUnityã®ããã¸ã§ã¯ããã¥ã¼ã«ãã©ãã°ï¼ãããããã¾ããã²ã¼ã ã«å¿ è¦ãªç´ æã¯âã³ã³ã«ããã¦ããã®ã§ãã¦ã³ãã¼ããã¦ä½¿ã£ã¦ä¸ããã
ãã±ãããé ç½®ããã
æºåãåºæ¥ãã¨ããã§ãã¾ãã¯Unityã§ã®ã²ã¼ã ä½ãã®ç¬¬ä¸æ©ã¨ãã¦ç»åãç»é¢ã«åºãã¾ãããã
Unity2Dã§ã¯ç»é¢ä¸ã«è¡¨ç¤ºããç»åã®ãã¨ããã¹ãã©ã¤ããã¨å¼ã³ã¾ãã
ä»å¾ã¯ã¹ãã©ã¤ãã¨ããå¼ã³åã使ãã®ã§è¦ãã¦ããã¦ä¸ãããï¼
ã§ã¯å ã»ã©ããã¸ã§ã¯ããã¥ã¼ã«ç»é²ãããã±ããã®ã¹ãã©ã¤ãï¼rocketï¼ãã·ã¼ã³ãã¥ã¼ã«ãã©ãã°ï¼ãããããã¦ä¸ããã
ããã ãã®æä½ã§ãã±ãããç»é¢ä¸ã«è¡¨ç¤ºãããããã«ãªãã¾ããUnityã£ã¦æ¬å½ã«ç°¡åã§ãããã
ã·ã¼ã³ãã¥ã¼ã«é ç½®ãããã¹ãã©ã¤ãããã¨ã©ã«ãã¼ãã¥ã¼ã«ãä¸è¦§ã¨ãã¦è¡¨ç¤ºããã¦ãã¾ãããã®ããã«ã·ã¼ã³ãã¥ã¼ä¸ã®ã¹ãã©ã¤ãã¨ãã¨ã©ã«ãã¼ãã¥ã¼ã®ãªã¹ãã¯å¯¾å¿ãã¦ãããã¨ãè¦ãã¦ããã¦ä¸ããã
ãã±ããã®ã¹ãã©ã¤ãã表示ããå ´æã¯ã¤ã³ã¹ãã¯ã¿ããå¤æ´ã§ãã¾ãã
ãã¨ã©ã«ãã¼ãã¥ã¼ã§ãrocketããé¸æããã¨ãUnityã¨ãã£ã¿å³å´ã®ã¤ã³ã¹ãã¯ã¿ã«ãã±ããã®è©³ç´°æ
å ±ã表示ããã¾ãã
ããã§ã¯ããTransformãé ç®ã®Positionãã0,-4,0ãã«è¨å®ãã¾ãã
ãã±ãããåããã
å·¦å³ãã¼ã®å
¥åã«å¿ãã¦ãã±ãããåããããã«ãC#ã¹ã¯ãªãããä½æãã¾ãã
Unityã§ã¯C#ãJavascriptãBooãªã©ã®è¨èªãé¸ã¹ã¾ãããããã§ã¯æ±ç¨çãªC#ã使ãã¾ãã
ã
ããã¸ã§ã¯ããã¥ã¼ã§å³ã¯ãªãã¯ãããCreateãâãC# Scriptããé¸æãã¦ä¸ããã
ä½æãããã¡ã¤ã«åãRocketControllerã«å¤æ´ãã¦ããã¾ãããã
RocketControllerãããã«ã¯ãªãã¯ãã¦ã¨ãã£ã¿ãéãã次ã®ã¹ã¯ãªãããå ¥åãã¦ä¸ããã
using UnityEngine; using System.Collections; public class RocketController : MonoBehaviour { void Update () { if (Input.GetKey (KeyCode.LeftArrow)) { transform.Translate (-0.1f, 0, 0); } if (Input.GetKey (KeyCode.RightArrow)) { transform.Translate ( 0.1f, 0, 0); } } }
Input.GetKeyé¢æ°ã使ã£ã¦å¼æ°ã«æå®ãããã¼ãæ¼ããã¦ãããã調ã¹ã¦ãã¾ãã
ãã¼ãæ¼ããã¦ããå ´åã«ã¯Translateé¢æ°ã使ã£ã¦ãã±ããã®ä½ç½®ã移åããã¦ãã¾ãã
Translateé¢æ°ã¯ç¾å¨ã®ä½ç½®ããå¼æ°ã«ä¸ããã¶ãã ã移åãããé¢æ°ã§ããå¼æ°ã«ä¸ãã座æ¨ã«åããã®ã§ã¯ãªããã¨ã«æ³¨æãã¦ä¸ããã
ã¹ã¯ãªãããå®æããããä½æããã¹ã¯ãªããããã±ããã«ã¢ã¿ãããã¾ãããã
Unityã§ã¯ãã¹ã¯ãªããããªãã¸ã§ã¯ãã«ã¢ã¿ãããããã¨ã§ãªãã¸ã§ã¯ããã¹ã¯ãªããã©ããã«åãããã«ãªãã¾ãã
ã
ããã¸ã§ã¯ããã¥ã¼ãããRocketControllerããé¸æãããã¨ã©ã«ãã¼ãã¥ã¼ã®ãrocketãã«ãã©ãã°ï¼ãããããã¦ä¸ããã
ã¹ã¯ãªãããã¢ã¿ããã§ãããå®è¡ãã¦ã¿ã¾ããããå·¦å³ãã¼ã®å ¥åã«å¿ãã¦ãã±ããã移åãã¾ãã
ä»åã¯ããã¾ã§ã§ããä»åä½æããããã¸ã§ã¯ããã¡ã¤ã«ãç½®ãã¦ããã¾ãã
次åã¯ãã±ããããå¼¾ãçºå°ã§ããããã«ãã¾ãã
第ï¼åã®è¨äºã¸ã¯ãã¡ãããã©ããï¼