本文整理汇总了C#中tk2dSpriteAnimationClip类的典型用法代码示例。如果您正苦于以下问题:C# tk2dSpriteAnimationClip类的具体用法?C# tk2dSpriteAnimationClip怎么用?C# tk2dSpriteAnimationClip使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
tk2dSpriteAnimationClip类属于命名空间,在下文中一共展示了tk2dSpriteAnimationClip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle_YunMuAnimating
void Handle_YunMuAnimating(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip, int frameNum)
{
tk2dSprite mspr = sprite.GetComponent<tk2dSprite>( );
Color c = mspr.color;
c.a = mYunMuCurrentAlpha;
mspr.color = c;
}
示例2: AnimationEventDelegate
void AnimationEventDelegate(tk2dAnimatedSprite sprite, tk2dSpriteAnimationClip clip, tk2dSpriteAnimationFrame frame, int frameNum)
{
Fsm.EventData.IntData = frame.eventInt;
Fsm.EventData.StringData = frame.eventInfo;
Fsm.EventData.FloatData = frame.eventFloat;
Fsm.Event(animationTriggerEvent);
}
示例3: ClipDeleted
public void ClipDeleted(tk2dSpriteAnimationClip clip, int param)
{
clip.Clear();
selectedClip = null;
FilterClips();
Repaint();
}
示例4: FireCompleteDelegate
// done breathing fire, just walk again
void FireCompleteDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip)
{
if(clip.name.Equals("Fire"))
{
anim.Play("Walk");
}
}
示例5: OnFrameGroupInspectorGUI
// Check the AnimOperator class for the different supported operator types.
// This sample simply deletes the frames after the currently selected clip.
public override bool OnFrameGroupInspectorGUI(tk2dSpriteAnimationClip selectedClip,
List<ClipEditor.FrameGroup> frameGroups,
TimelineEditor.State state )
{
// WrapMode.Single is a special case - you are only allowed to have one frame in a "Single" clip.
// If you don't handle this, tk2d will truncate the list when it is Committed.
if (selectedClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Single)
return false;
// Keep track of changes.
// In a lot of cases, a simple bool will suffice. This is used later to
// tell the system that something has changed.
bool changed = false;
GUILayout.BeginHorizontal();
if (GUILayout.Button("Ins <-", EditorStyles.miniButton))
{
frameGroups.Insert(state.selectedFrame,
AnimOperatorUtil.NewFrameGroup(frameGroups, state.selectedFrame));
// Make sure state is valid after performing your operation.
// For instance, if the selected frame is deleted, ensure it isn't selected any more.
state.selectedFrame++;
changed = true;
}
if (GUILayout.Button("Ins ->", EditorStyles.miniButton))
{
frameGroups.Insert(state.selectedFrame + 1,
AnimOperatorUtil.NewFrameGroup(frameGroups, state.selectedFrame));
changed = true;
}
GUILayout.EndHorizontal();
// Tell the caller what has changed
operations = changed ? AnimEditOperations.ClipContentChanged : AnimEditOperations.None;
return changed;
}
示例6: Handle_FishAniStop
void Handle_FishAniStop(tk2dSpriteAnimator sprAni, tk2dSpriteAnimationClip aniClip)
{
if (mFish != null && mFish.Attackable)
{
mFish.AniSprite.PlayFrom(mOriginClip,0F);
}
}
示例7: FlameOnDelegate
void FlameOnDelegate(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNumber)
{
if(clip.GetFrame(frameNumber).eventInfo.Equals("FlameOn"))
{
string fireTag = fireHitObject.tag;
if (fireTag.Equals("Throwable"))
{
Vector3 position = fireHitObject.transform.position;
position.z = charcoalParticleEffect.transform.position.z;
// KILL THE PEASANTS
Destroy(fireHitObject);
// BURNINATE THE PEASANTS (particle effects)
ParticleSystem localCharcoal = GameObject.Instantiate(charcoalParticleEffect, position, charcoalParticleEffect.transform.rotation) as ParticleSystem;
localCharcoal.Play();
}
else if (fireTag.Equals("Player"))
{
// TODO: tell player to get bumped
}
}
if(clip.GetFrame(frameNumber).eventInfo.Equals("DragonFootStep"))
{
AudioSource.PlayClipAtPoint(footSteps[Random.Range( 0, footSteps.Count )], transform.position);
}
}
示例8: Play
public void Play(int id)
{
clipId = id;
if (id >= 0 && anim && id < anim.clips.Length)
{
currentClip = anim.clips[id];
// Simply swap, no animation is played
if (currentClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Single || currentClip.frames == null)
{
SwitchCollectionAndSprite(currentClip.frames[0].spriteCollection, currentClip.frames[0].spriteId);
if (currentClip.frames[0].triggerEvent)
{
if (animationEventDelegate != null)
animationEventDelegate( this, currentClip, currentClip.frames[0], 0 );
}
currentClip = null;
}
else
{
clipTime = 0.0f;
previousFrame = -1;
}
}
else
{
OnCompleteAnimation();
currentClip = null;
}
}
示例9: CopyFrom
public void CopyFrom(tk2dSpriteAnimationClip source)
{
this.name = source.name;
if (source.frames == null)
{
this.frames = null;
}
else
{
this.frames = new tk2dSpriteAnimationFrame[source.frames.Length];
for (int i = 0; i < this.frames.Length; i++)
{
if (source.frames[i] == null)
{
this.frames[i] = null;
}
else
{
this.frames[i] = new tk2dSpriteAnimationFrame();
this.frames[i].CopyFrom(source.frames[i]);
}
}
}
this.fps = source.fps;
this.loopStart = source.loopStart;
this.wrapMode = source.wrapMode;
if ((this.wrapMode == WrapMode.Single) && (this.frames.Length > 1))
{
this.frames = new tk2dSpriteAnimationFrame[] { this.frames[0] };
Debug.LogError(string.Format("Clip: '{0}' Fixed up frames for WrapMode.Single", this.name));
}
}
示例10: tk2dSpriteAnimationClip
public tk2dSpriteAnimationClip(tk2dSpriteAnimationClip source)
{
this.name = "Default";
this.frames = new tk2dSpriteAnimationFrame[0];
this.fps = 30f;
this.CopyFrom(source);
}
示例11: OnAnimationClipEnd
protected override void OnAnimationClipEnd(tk2dSpriteAnimator aAnim, tk2dSpriteAnimationClip aClip) {
if(anim == aAnim && aClip == mClips[(int)AnimState.attack]) {
mActActive = false;
mFireActive = false;
}
base.OnAnimationClipEnd(aAnim, aClip);
}
示例12: HitCompleteDelegate
// This is called once the hit animation has compelted playing
// It returns to playing whatever animation was active before hit
// was playing.
void HitCompleteDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip)
{
if (walking) {
anim.Play("walk");
}
else {
anim.Play("idle");
}
}
示例13: FrameDeploymentTrigger
void FrameDeploymentTrigger(tk2dAnimatedSprite sprite,
tk2dSpriteAnimationClip clip,
tk2dSpriteAnimationFrame frame,
int frameNum)
{
//Debug.Log("MinigunBoxController:FrameDeploymentTrigger()");
DeployGun();
}
示例14: Awake
void Awake()
{
mAnispr = GetComponent<tk2dSpriteAnimator>();
if (mAnispr == null)
return;
mOriClip = mAnispr.DefaultClip;
//mOriClipidx = mAnispr.DefaultClipId;
tk2dSpriteAnimationClip aniClip = mAnispr.Library.clips[mAnispr.Library.GetClipIdByName(AniName)];
mSpecAniLength = aniClip.frames.Length / aniClip.fps;
}
示例15: HandleAnimationEvent
void HandleAnimationEvent(tk2dAnimatedSprite sprite, tk2dSpriteAnimationClip clip, tk2dSpriteAnimationFrame frame, int frameNum)
{
// Call FrameActionHandlers
frame.eventInfo.Split(new []{","},System.StringSplitOptions.RemoveEmptyEntries).ToList()
.ForEach(
(x) => {
frameActions[x](x,frame.eventFloat,frame.eventInt);
}
);
}