ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2020ǯ08·î10Æü(·î) 15:55:38ÍúÎò
¡¡AnyState¤äAnimator¼«ÂΤÎÀâÌÀ¤Ë¤Ä¤¤¤Æ¤Ï³ä°¦¤·¤Þ¤¹¡£¤³¤Á¤é¤Îµ»ö¤ò»²¹Í¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£Â¾¤Ë¤â¿§¡¹¤ÊÌò¤ËΩ¤Äµ»ö¤¬¤¢¤ê¤Þ¤¹¡£
YTTMWORKÍÍ¡¡
Animator
https://yttm-work.jp/unity/unity_0018.html
¡¡AnyState¤Ï¾ò·ï¤òËþ¤¿¤»¤Ð¼«Æ°Åª¤ËAnimationState¤òÁ«°Ü¤·¤Æ¤¯¤ì¤ëµ¡Ç½¤Ç¤¹¡£
¤½¤¦¤¹¤ë¤³¤È¤Ç¡¢³ÆStateƱ»Î¤òTransition¤Ç¤Ä¤Ê¤°¤³¤È¤Ê¤¯¡¢AnimationState¤ÎÁ«°Ü¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
¾å¼ê¤Ë³èÍѤ¹¤ë¤³¤È¤Ç¡¢¸«¤¿Ìܤˤâ¤ï¤«¤ê¤ä¤¹¤¯¤Ê¤ê¤Þ¤¹¡£
¡¡¤Þ¤º¤ÏÁ«°Ü¤¹¤ëºÝ¤Î½èÍý¤Ë»ÈÍѤ¹¤ëʸ»úÎó¤òEnum¤Ë¤·¤Æ¤ª¤¤Þ¤·¤ç¤¦¡£
¤³¤ì¤Çʸ»úÎó¤òľÀܵ½Ò¤»¤º¤Ë¡¢Á«°Ü²Äǽ¤ÊState¤À¤±¤òÁª¤Ö¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡¡¡private enum AnimatorState { // ÍÑÅӤ˱þ¤¸¤Æpublic¤ËÊѹ¹¤·¤Æ¤¯¤À¤µ¤¤ Attack, Jump, Speed, AttackSpeed, }
¡¡Àè¤Û¤É¤Î²èÁü¤Ë¤â¤¢¤ê¤Þ¤·¤¿¤è¤¦¤Ë¡¢º£²ó¤Ï°Ê²¼¤ÎParameter¤òÍÑ°Õ¤·¤Þ¤·¤¿¡£Layers¤ÏBaseLayer¤Î¤ß¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£
¡¦Speed¡¡¡¡¡¡¡¡¡¡¡¡Float·¿¡£°ÜÆ°ÍѤÎStateÁ«°ÜÍÑ ¡¦AttackSpped¡¡¡¡¡¡Float·¿¡£¹¶·â»þ¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó®ÅÙ¤ÎÀßÄêÍÑ
¤³¤ÎParameter¤ËÁªÂò¤Ç¤¤ë¤â¤Î¤ÏÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëParameter¤Î¤ß¤Ë¤Ê¤ê¤Þ¤¹¡£º£²ó¤Ï¤³¤ÎSpeed¤ÎÃͤÎÊѹ¹ÍѤËParameter¤ËAttackSpeed¤òÍÑ°Õ¤·¤Þ¤·¤¿¤Î¤Ç¡¢
¤½¤Á¤é¤ò»ØÄꤷ¤Þ¤¹¡£¡ÊFloat·¿¤ÎParameter¤Î¤ßÁªÂò¤Ç¤¤Þ¤¹¡Ë
¡¡º£²óÀßÄê¤ò¤·¤¿Transiton¤Î²èÁü¤Ç¤¹¡£
¡¡AnyState¤«¤éAttack¤ÈJump¤Ë¤ÏTransiton¤òÉÔÍפǤ¹¡£¤½¤ì¤ÏAnimator.Play()¥á¥½¥Ã¥É¤ò»È¤¦¤¿¤á¤Ç¤¹¡£
¡¡Animator.Play¥á¥½¥Ã¥É¤Ï¸½ºß¤ÎState¤¬¤É¤³¤Ë¤¢¤Ã¤Æ¤â(¾¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ÎÅÓÃæ¤Ç¤â)¡¢¥¹¥¯¥ê¥×¥È¤«¤é°ú¿ô¤Ç»ØÄꤷ¤¿State¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¤òºÆÀ¸¤Ç¤¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
Animator.Play¥á¥½¥Ã¥É¤Ë¤Ä¤¤¤Æ¤Ï¸ø¼°¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
Unity¸ø¼°
Animator.Play
https://docs.unity3d.com/ja/current/ScriptReferenc...
¤³¤Î¥á¥½¥Ã¥É¤Ë¤Ï¥ª¡¼¥Ð¡¼¥í¡¼¥É¤¬£²¤Ä¤¢¤ê¤Þ¤¹¤¬¡¢º£²ó¤ÏºÇ½é¤Î½èÍý¤òÍøÍѤ·¤Æ¤¤¤Þ¤¹¡£
public void Play (string stateName, int layer= -1, float normalizedTime= float.NegativeInfinity);
¾¤Ë¤â¤ï¤«¤ê¤ä¤¹¤¤µ»ö¤¬¤¢¤ê¤Þ¤¹¡£¤³¤Îµ»ö¤òÆɤó¤Çĺ¤¯¤È¡¢Animator.Play¤Ë¸þ¤¤¤Æ¤¤¤ë¥¢¥Ë¥á¤È¸þ¤¤¤Æ¤¤¤Ê¤¤¥¢¥Ë¥á¤ÎÍý²ò¤¬¿¼¤Þ¤ê¤Þ¤¹¡£
Animator.Play¥á¥½¥Ã¥É¤Ï°ÜÆ°·Ï¤Ï¸þ¤¤¤Æ¤¤¤Ê¤¯¤Æ¡¢¥È¥ê¥¬¡¼·Ï¤Î½èÍý¤Ë¤Ï¸þ¤¤¤Æ¤¤¤ë¤³¤È¤¬Ê¬¤«¤ê¤Þ¤¹¡£
UNITY¤ÇËâʪ»È¤¤¡ê¥²¡¼¥à¤òºî¤ë
Unity¤Ç3D¤ÎARPG¥Õ¥ê¡¼¥²¡¼¥à¤òÀ©ºîÃ桪¡ÚUnityC#¹ÖºÂ¡Û¥æ¥Ë¥Æ¥£¤Á¤ã¤ó¤Ç¤â¤Ã¤ÈAnimator Controller¤ò¾å¼ê¤¯»È¤¤¤¿¤¤
https://unity-shoshinsha.biz/archives/471
¡¡°ÜÆ°¤È¹¶·â¤È¥¸¥ã¥ó¥×¤Î¥¢¥Ë¥áºÆÀ¸½èÍý¤Î¤Ï¤¤¤Ã¤¿PlayerController¤Î¥µ¥ó¥×¥ë¥¹¥¯¥ê¥×¥È¤Ç¤¹¡£
¡¡¼Â¹Ô¤·¤Æ¡¢¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ÎÁ«°Ü¤ò³Îǧ¤·¤Þ¤¹¡£
°ÜÆ°Ãæ¤Ë¥¸¥ã¥ó¥×¤ä¹¶·â¤¬¹Ô¤ï¤ì¤¿¾ì¹ç¡¢°ÜÆ°¤Î¥¢¥Ë¥á¤òÃæÃǤ·¤Æ¡¢¥¸¥ã¥ó¥×¤Ê¤É¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¤¬ºÆÀ¸¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
https://gyazo.com/3182c7d8b87bf489b71823cd84cf0d61
¡¡Animator Æâ¤Î AnyState ¤«¤éÁ«°Ü¤¹¤ë¥¢¥Ë¥á¡¼¥·¥ç¥ó¤Î¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ë¡¢CanTransitionToSelf ¤È¤¤¤¦¹àÌܤ¬¤¢¤ê¤Þ¤¹¡£
¤³¤Á¤é¤Î¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ë¤È¡¢¼«Ê¬¼«¿È¤ÎState¤ËÂФ·¤ÆÁ«°Ü¤¹¤ë¥¢¥Ë¥á¡¼¥·¥ç¥ó¤Ë¤Ä¤¤¤Æ¤Ï̵»ë¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¡Ê°ìÅÙºÆÀ¸¤µ¤ì¤¿¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ËÂФ·¤Æ¡¢·«¤êÊÖ¤·¤Î½èÍý¤ò¹Ô¤ï¤Ê¤¯¤Ê¤ê¤Þ¤¹¡Ë
¡¡Æ±¤¸¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò²¿ÅÙ¤â¥ë¡¼¥×¤·¤Æ¤·¤Þ¤¦¤è¤¦¤Ê»þ¤Ë¤Ï¡¢¤³¤Î¹àÌܤò³Îǧ¤·¤Æ¥Á¥§¥Ã¥¯¤ò³°¤¹¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦¡£
¡¡¤³¤Á¤é¤Îµ»ö¤Ë¾Ü¤·¤¤ÀâÌÀ¤¬ºÜ¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç»²¹Í¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
¥Æ¥é¥·¥å¡¼¥ë¥Ö¥í¥°ÍÍ
¡ÚUnity¡ÛAnimationController¤ÎAnyState¤ò»ÈÍѤ·¤Æ¤ëºÝ¡¢¸½ºß¤ÎState¤Ø²¿ÅÙ¤â°ÜÆ°¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë
http://tsubakit1.hateblo.jp/entry/2017/01/13/23300...
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- Áí¹ç
¥³¥á¥ó¥È¤ò¤«¤¯