ãUnity7ãã¢ãã¡ã¼ã·ã§ã³ãä½ãããï¼ã2Dãã¼ã°ã©ã¤ã¯2ã
Unity5.0.0f4 Personal(2015å¹´5æ)
ååã®ç¶ãã§ãã
ä»åã¯ãã¬ã¤ã¤ã¼ã¨æµãã£ã©ã®ã¢ãã¡ã¼ã·ã§ã³ãä½ãããã¬ãã¡ãåããã¨ããã¾ã§ããã¾ãã
 ãç®æ¨ãã¢ãã¡ã¼ã·ã§ã³ãå®æããã
Â
2D Roguelike 2 of 14 : Animations - YouTube
Â
 ã課é¡ï¼ããã¬ã¤ã¤ã¼ã®ã¢ãã¡ã¼ã·ã§ã³ãå®æããã
ã¾ãã¯ãã¬ã¤ã¤ã¼ã¢ãã¡ã¼ã·ã§ã³ããä½ã£ã¦ããã¾ããHierarchyãã¥ã¼ããCreate>Create Emptyãé¸æããååãPlayerã«ãã¦ä¸ããã
Â
空ãªãã¸ã§ã¯ãä½æ
Â
ååã¯Player
Â
ç¶ãã¦Projectãã¥ã¼ã®Spritesãã©ã«ãã«å ¥ã£ã¦ããScavenger_SpriteSheetãè¦ã¦ä¸ãããããããã®ç»åã1æã®ã·ã¼ãã«ãªã£ã¦ãã¾ãããæ¢ã«ã¹ã©ã¤ã¹ããã¦ãããããã®ã¾ã¾å©ç¨ãã¾ããã·ã¼ãã®0ã5ãé¸æããPlayerãªãã¸ã§ã¯ãã¸ãã©ãã°ï¼ãããããã¦ä¸ããã
Â
ãã©ãã°ï¼ããããï¼
Â
ããã¨ã¢ãã¡ã¼ã·ã§ã³ãä¿åããã¦ã£ã³ãã¦ãéãã®ã§ãååãPlayerIdleãä¿åå ´æãAnimations>Animationsã§ä¿åãã¾ãããã
Â
PlayerIdleã¢ãã¡ã¼ã·ã§ã³ä¿å
Â
â»â»â»Unity5.1.0ã¾ã§ã®ãã¼ã¸ã§ã³ã§ã¯Spriteç»åããã©ãã°ï¼ããããããæã«ååãä»ãã¦ä¿åãããã¨ãã§ãã¾ããããUnity5.1.1ããã¯èªåçã«Spriteç»åã®ååãä»ãã¦ä¿åãããããã«ãªãã¾ããâ»â»â»
Â
ä¿åããAnimations>Animationãã©ã«ããè¦ã¦ä¸ãããPlayerIdleã¢ãã¡ã¼ã·ã§ã³ãä¿åããã¦ãã¾ãããããã²ã¨ã¤Playerã¨ããååã®ãã¡ã¤ã«ãããã¾ããããã¯AnimatorControllerã¨ãã£ã¦ãã¢ãã¡ã¼ã·ã§ã³ã®åæ¿ãè¡ãããã®ãã¡ã¤ã«ã§ãããã¡ãã¯AnimatorControllersãã©ã«ãã¸ç§»åãã¦ããã¾ãããï¼
Â
AnimatorControllerã移å
Â
åãè¦é ã§ãPlayerChopã¨PlayerHitã®ã¢ãã¡ã¼ã·ã§ã³ãä½ãã¾ãã
Â
PlayerChopã¯ã·ã¼ãã®40,41PlayerHitã¯ã·ã¼ãã®46,47ã使ãã¾ãã
Â
Animationsãã©ã«ãã«PlayerChopãPlayerHitã追å ã§ä½ã
Â
ãã®ç¶æ ã§åçãã¦ã¿ã¾ããããã¨ãã¢ãã¡ã¼ã·ã§ã³ãã¡ãã£ã¨æ©ãæããªã®ãåããã¾ãã
Â
ã¢ãã¡ã¼ã·ã§ã³æ©ã
Â
å ã»ã©ä½æããAnimator Controllerã®Playerãããã«ã¯ãªãã¯ããAnimatorãã¥ã¼ãéãã¦ä¸ãããããã¨ãã¢ãã¡ã¼ã·ã§ã³åæ¿ç¨ã®ç»é¢ã表示ããã¾ãã
Â
Animatorãã¥ã¼ãéã
Â
PlayerIdleã¨æ¸ããããªã¬ã³ã¸è²ã®åè§ãã¯ãªãã¯ãInspectorãã¥ã¼ãè¦ã¦ãããã¨ãã¢ãã¡ã¼ã·ã§ã³ã®è¨å®é ç®ãããã¤ãåºã¦ãã¾ãã®ã§ãSpeedã1ãã0.5ã«å¤æ´ãã¦ä¸ããã
Â
Speedã0.5ã«å¤æ´
Â
ããã§ã¡ããã©ããã¢ãã¡ã¼ã·ã§ã³é度ã«ãªãã¾ããã
Â
ã¡ããã©ãã
Â
次ã«Playerã®TagãLayerãè¨å®ãã¾ããPlayerãªãã¸ã§ã¯ãã®Inspectorãã¥ã¼ãè¦ã¦ããã£ã¦ãTagãPlayerã«å¤æ´ãã¾ãã
Â
Playerã«å¤æ´
Â
ç¶ãã¦LayerãBlockingLayerã«å¤æ´ãã¾ããããã¯ãè¡çªãæå¹ã«ãããªãã¸ã§ã¯ãã«ã¯å ¨ã¦ã¤ããããã§ãã
Â
BlockingLayerã«å¤æ´
Â
æå¾ã«Sorting LayerãUnitsã«å¤æ´ãã¾ããåºâã¢ã¤ãã âãã£ã©ã¯ã¿ã¼ã®é çªã«æç»ããæãã§ãã
Â
Unitsã«å¤æ´
Â
ç¶ãã¦Componentãï¼ã¤ä»ãã¾ããRigidbody2Dã¨BoxCollider2Dã§ããRigidbody2Dã¯IsKinematicãtrueã«ãBoxCollider2Dã¯Colliderã®SizeãXãYå ±ã«0.9ã«å¤æ´ãã¦ä¸ããã
Â
Playerã®è¨å®
Â
æå¾ã«Playerãªãã¸ã§ã¯ããPrefabsãã©ã«ãã¸å ¥ããå ã®Playerãªãã¸ã§ã¯ãã¯åé¤ãã¦ä¸ããã
Â
ãã©ãã°ï¼ããããï¼ãå ã®ãªãã¸ã§ã¯ãã¯åé¤
Â
ã課é¡ï¼ãæµãã£ã©ï¼ã®ã¢ãã¡ã¼ã·ã§ã³ãå®æããã
åããããªæãã§æµãã£ã©ãä½ã£ã¦ããã¾ããEnemy1ã¨ããååã®ç©ºãªãã¸ã§ã¯ããä½ãã
Â
Spriteã·ã¼ãã®6ã11ãEnemy1ãªãã¸ã§ã¯ãã«ãã©ãã°ï¼ãããããã
Â
Â
Enemy1Idleã¨ããååãã¤ããAnimations>Animationsãã©ã«ãã¸ã¢ãã¡ã¼ã·ã§ã³ãä¿åããä¿åå¾Enemy1ã®AnimatorControllerã¯AnimatorControllerãã©ã«ãã¸ç§»åãã
Â
Â
åãè¦é ã§ã·ã¼ã42,43ãEnemy1Attackã¨ããã¢ãã¡ã¼ã·ã§ã³åã§ä½æããä¿åãã¾ãã
Â
ç¶ãã¦TagãEnemyãLayerãBlockingLayerãSortingLayerãUnitsã«å¤æ´ããRigidBody2Dã¨BoxCollider2Dãã¤ãã¦ä¸ãããå¤æ´ç®æã¯Rigidbody2Dã®IsKinematicãtrueã«ããã ãã§å¤§ä¸å¤«ã§ãã
Â
Â
ãã¾ãã¢ãã¡ã¼ã·ã§ã³ããããã²ã¼ã ãéå§ãã¦ç¢ºèªãã¦ã¿ã¾ãã
Â
Â
ã²ã¼ã ãåçãã¢ãã¡ã¼ã·ã§ã³ç¢ºèª
Â
ããã¾ã§é²ãã ããEnemy1ãªãã¸ã§ã¯ããPrefabsãã©ã«ãã¸ãã©ãã°ï¼ããããããPrefabåãã¾ããä»åã¯Prefabåå¾ã«åé¤ã¯ãã¾ããã
Â
Â
ã課é¡ï¼ãæµãã£ã©ï¼ã®ã¢ãã¡ã¼ã·ã§ã³ãå®æããã
æå¾ã«ããï¼å¹æµãã£ã©ãä½ãããã¨æãã¾ããHierarchyãã¥ã¼ã®Enemy1ã¯åé¤ãããååã ãEnemy2ã«å¤æ´ãã¾ãã
Â
ååãEnemy1ããEnemy2ã¸å¤æ´
Â
ç¶ãã¦Spriteã·ã¼ãã®12ã17ãé¸æããEnemy2ãªãã¸ã§ã¯ãã¸ãã©ãã°ï¼ããããããEnemy2Idleã¨ããååã§Animations>Animationsãã©ã«ãã¸ä¿åãã¦ä¸ããã
Â
ãã©ãã°ï¼ããããï¼
Â
åããSpriteã·ã¼ãã®44,45ãEnemy2ãªãã¸ã§ã¯ãã¸ãã©ãã°ï¼ããããããEnemy2Attackã¨ããååã§Animations>Animationsãã©ã«ãã¸ä¿åãã¾ãã
Â
ãã¦ãAnimatorControllersãã©ã«ãã«å ¥ã£ã¦ããEnemy1ãã¯ãªãã¯ããAnimatorãã¥ã¼ã表示ãã¦ã¿ã¦ä¸ããã
Â
Enemy1ã®Animatorãã¥ã¼
Â
Enemy2Idleã¨Enemy2Attackã¯å¿ è¦ãªãã®ã§åé¤ãã¦ä¸ãããåé¤æ¹æ³ã¯å³ã¯ãªãã¯ã§Deleteããcommand+deleteãã¼ã§ã§ãã¾ãã
Â
åé¤
Â
ç¶ãã¦Enemy2ç¨ã®Animator Controllerãä½ã£ã¦ããã¾ããAnimatorControllersãã©ã«ããé¸æããç¶æ ã§ãProjectãã¥ã¼ã®Create>Animator Override Controllerãé¸æããååãEnemy2ã«ãã¦ä¸ããã
Animator Override Controllerã使ãã¨ãå¥ã®Animatorã®ä¸é¨ã¢ãã¡ã¼ã·ã§ã³ãä¸æ¸ãæ´æ°ãã¦ä½¿ããã¨ãã§ãã¾ãã
Â
Animator Override Controllerãä½æ
Â
Enemy2ã®Animator Override Controllerãé¸æãInspectorãã¥ã¼ã«è¡¨ç¤ºãããControlleræ¬ã¸ãEnemy1ã®Animator Controllerããã©ãã°ï¼ãããããã¦ä¸ããã
Â
ãã©ãã°ï¼ããããï¼
Â
ããã¨Overrideãè¨å®ããæ¬ã表示ããã¾ãã®ã§ãEnemy1IdleãEnemy2Idleã«ãEnemy1AttackãEnemy2Attackã«å¤æ´ãã¦ä¸ããã
Â
Enemy1ã®ã¢ãã¡ã¼ã·ã§ã³ãEnemy2ã®ã¢ãã¡ã¼ã·ã§ã³ã¸Override
Â
次ã«Enemy2ãªãã¸ã§ã¯ããé¸æããInspectorãã¥ã¼ã®Animatorã³ã³ãã¼ãã³ããè¦ã¾ããControllerã®é¨åãEnemy1ã®ã¾ã¾ãªã®ã§ãå ã»ã©ä½æããEnemy2 Animator Override Controllerãæå®ãã¦ããã¾ãã
Â
ãã©ãã°ï¼ããããï¼
Â
ãã¾ãã¢ãã¡ã¼ã·ã§ã³ãããã確èªãã¾ãã
Â
Enemy2ãåçãããã確èª
Â
ããã¾ã§ãããEnemy2ãªãã¸ã§ã¯ããPrefabsãã©ã«ãã¸ãã©ãã°ï¼ãããããPrefabåãã¾ããå ã®Enemy2ãªãã¸ã§ã¯ãã¯åé¤ãã¦ããã¦ä¸ããã
Â
ãã©ãã°ï¼ããããï¼ãPrefabåå¾ã¯å ãªãã¸ã§ã¯ããåé¤
Â
ä»åã¯ããã¾ã§ã§ãã
ãããã¨ããããã¾ããã
Â
ã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)ã
Â