ãUnity7ãç ´å£å¯è½ãªå£(Wall)ãä½æãããï¼ããã¼ã°ã©ã¤ã¯7ã
Unity5.0.0f4 Personal(2015å¹´6æ)
ååã®ç¶ãã§ãã
Â
ä»åã¯ãã¬ã¤ã¤ã¼ãå å£(Wall)ãä½åº¦ãæ»æããã¨Wallãå£ããå¦çãä½æãã¦ããã¾ãã
Â
ååã«æ¯ã¹ãã¨ããªãç°¡åãªå 容ã«ãªã£ã¦ã¾ãã®ã§ãæ°è»½ã«è¦ã¦ãã£ã¦ä¸ããã
Â
ãç®æ¨ãç ´å£å¯è½ãªWallãä½æããï¼
Â
2D Roguelike 7 of 14 : Walls - YouTube
Â
â å£ç ´å£ç¨ã®ã¹ã¯ãªãããä½æãã
Wallã¹ã¯ãªãããä½æãããã¬ã¤ã¤ã¼ãä½åº¦ãæ»æããã¨å£ããå¦çãæ¸ãã¦ããã¾ãããã以ä¸ã½ã¼ã¹ã§ãã
Â
Â
ã¾ãã¯Awakeã¡ã½ããã«ã¦SpriteRendererããã£ãã·ã¥ãã¦ããããã¤Wallãæ»æããã¦ãããã«ç»åãå¤æ´ã§ããããã«ãã¦ããã¾ãã
Â
ã¡ãªã¿ã«Awakeã¡ã½ããã¯Startã¡ã½ããã®ãããªãã®ã§ãããStartã¡ã½ãããããæ©ã段éãã²ã¼ã ãªãã¸ã§ã¯ããã²ã¼ã ç»é¢ã«é ç½®ãããç¬éã«å®è¡ããã¾ãã
Â
次ã«ãã¬ã¤ã¤ã¼ãWallãæ»æããæã«å®è¡ããããDamageWallã¡ã½ããã«ç§»ãã¾ããå¼æ°ã¯intåã®lossã§ãã
Â
ã¾ãã¯Spriteç»åãpublicå¤æ°ã§æå®ãã¦ãããdmgSpriteã«å¤æ´ããæ»æãåããæ¼åºã表ç¾ãã¾ãã
Â
次ã«ãhp(ããã©ã«ãã ã¨3)ããå¼æ°lossåã ããã¤ãã¹ãã0以ä¸ã«ãªã£ããSetActive=falseã«ããã²ã¼ã ç»é¢ããWallãæ¶ãã¦ãã¾ãã¾ãã
Â
â¡Wallã¹ã¯ãªãããWallã«ä»ãã
 ããã§ã¯Wallã¹ã¯ãªãããWallãã¬ãã¡ãã«ã¤ãã¦ããã¾ããProjectãã¥ã¼ã®Wall1ã8ãé¸æãã¦ä¸ããã
Â
Wall1ã8é¸æ
Â
ãã®ç¶æ ã§Inspectorãã¥ã¼ä¸çªä¸ã®Add ComponentããScript>Wallãé¸æããã¨ãå ¨ã¦ã®Wallãã¬ãã¡ãã«Wallã¹ã¯ãªãããåãä»ãããã¾ãã
Â
ç¶ãã¦publicå¤æ°ãè¨å®ãã¦ããã¾ããã¾ãã¯Wall1ãã¬ãã¡ãããã
Wallã¹ã¯ãªããã®Dmg Spriteä¸çªå³ã«ããâãæ¼ãã¦ã
Â
Â
åºã¦ããã¹ãã©ã¤ãä¸è¦§ãã48çªã®ã¹ãã©ã¤ãç»åãé¸æãã¾ãã
Â
Â
åãè¦é ã§ãWall2ã«ã¯49çªãWall3ã«ã¯50çªãWall4ã«ã¯51çªãWall5ã«ã¯52çªãWall6ã«ã52çªãWall7ã«ã¯53çªãWall8ã«ã¯54çªã®ã¹ãã©ã¤ãç»åãæå®ãã¦ä¸ããã
Â
ç°¡åã§ãããä»åã¯ããã¾ã§ã§ãã
ãããã¨ããããã¾ããã
Â
ãUnityéçº7ãã¢ãã¡ã¼ã·ã§ã³ãä½ãããï¼ã2Dãã¼ã°ã©ã¤ã¯2ã
ãUnityéçº7ãFloorãã¢ã¤ãã ãä½æãããï¼ã2Dãã¼ã°ã©ã¤ã¯3ã
ãUnityéçº7ãBoardManagerãå¼ã³åºãGameManagerãä½æããã2Dãã¼ã°ã©ã¤ã¯5ã
ãUnityéçº7ãç ´å£å¯è½ãªå£(Wall)ãä½æãããï¼ããã¼ã°ã©ã¤ã¯7ã
ãUnityéçº7ããã¬ã¤ã¤ã¼ã®ã¢ãã¡ã¼ã¿ã¼ãè¨å®ãããï¼ããã¼ã°ã©ã¤ã¯8ã
ãUnityéçº7ããã¬ã¤ã¤ã¼ç¨ã®ã¹ã¯ãªãããè¨å®ãããï¼ããã¼ã°ã©ã¤ã¯9ã
ãUnityéçº7ãBGMã¨å¹æé³ãä»ããã2Dãã¼ã°ã©ã¤ã¯13ã
ãUnityéçº7ãã¿ããããã«ã«å¯¾å¿ããããï¼ã2Dãã¼ã°ã©ã¤ã¯14(Fin)ã
Â