本文整理汇总了C#中tk2dSpriteAnimator.GetClipByName方法的典型用法代码示例。如果您正苦于以下问题:C# tk2dSpriteAnimator.GetClipByName方法的具体用法?C# tk2dSpriteAnimator.GetClipByName怎么用?C# tk2dSpriteAnimator.GetClipByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tk2dSpriteAnimator
的用法示例。
在下文中一共展示了tk2dSpriteAnimator.GetClipByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(tk2dSpriteAnimator anim) {
idleClip = anim.GetClipByName(idle);
fireClip = anim.GetClipByName(fire);
}
示例2: Awake
void Awake()
{
MainCamera = GameObject.FindWithTag("MainCamera");
if (this.tag == "Creature") //All objects are of type GameObject. Use tags instead of the usual typeOf() check.
{
if (GetComponent<Movement>() != null)
{movement = GetComponent<Movement>();} //Determine if attached script is Movement or PlayerMovement
if (GetComponent<PlayerMovement>() != null)
{movement = GetComponent<PlayerMovement>();}
}
animLib = GetComponent<tk2dSpriteAnimator>();
setAction("stand");
absoluteFacing = relativeFacing = initialFacing; //Later on, facing will also be randomized if a player drops the item.
//The constructor will take an int argument for the direction to give it.
//That way you can place objects in the editor with set directions, but it will
//also randomize if the player moves it around.
MAP = new Dictionary<string, tk2dSpriteAnimationClip>();
MAP["stand0"] = animLib.GetClipByName("standU");
MAP["stand45"] = animLib.GetClipByName("standUR"); //Map clips to strings, so I can assemble
MAP["stand90"] = animLib.GetClipByName("standR"); //them piece by piece rather than use a ton of ifs.
MAP["stand135"] = animLib.GetClipByName("standDR");
MAP["stand180"] = animLib.GetClipByName("standD");
MAP["stand225"] = animLib.GetClipByName("standDL");
MAP["stand270"] = animLib.GetClipByName("standL");
MAP["stand315"] = animLib.GetClipByName("standUL");
MAP["walk0"] = animLib.GetClipByName("walkU");
MAP["walk45"] = animLib.GetClipByName("walkUR");
MAP["walk90"] = animLib.GetClipByName("walkR");
MAP["walk135"] = animLib.GetClipByName("walkDR");
MAP["walk180"] = animLib.GetClipByName("walkD");
MAP["walk225"] = animLib.GetClipByName("walkDL");
MAP["walk270"] = animLib.GetClipByName("walkL");
MAP["walk315"] = animLib.GetClipByName("walkUL");
MAP["swing0"] = animLib.GetClipByName("swingU");
MAP["swing45"] = animLib.GetClipByName("swingUR");
MAP["swing90"] = animLib.GetClipByName("swingR");
MAP["swing135"] = animLib.GetClipByName("swingDR");
MAP["swing180"] = animLib.GetClipByName("swingD");
MAP["swing225"] = animLib.GetClipByName("swingDL");
MAP["swing270"] = animLib.GetClipByName("swingL");
MAP["swing315"] = animLib.GetClipByName("swingUL");
}
示例3: AnimAfterDash
public void AnimAfterDash(tk2dSpriteAnimator anim, tk2dSpriteAnimationClip clip)
{
anim.AnimationCompleted = null;
if (clip != anim.GetClipByName(a_endDash) || !grounded) return;
if (controller.getL || controller.getR){
anim.Play(a_walk);
}
else{
anim.Play(a_idle);
}
//reset the completed delegate so it doesn't pull this every time an animation ends
}