本文整理汇总了C#中Spine类的典型用法代码示例。如果您正苦于以下问题:C# Spine类的具体用法?C# Spine怎么用?C# Spine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Spine类属于命名空间,在下文中一共展示了Spine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaitForSpineAnimationComplete
public WaitForSpineAnimationComplete (Spine.TrackEntry trackEntry) {
#if PREUNITY_5_3
Debug.LogWarning("Unity 5.3 or later is required for Spine Unity custom yield instructions to function correctly.");
#endif
SafeSubscribe(trackEntry);
}
示例2: HandleEvent
void HandleEvent (Spine.AnimationState state, int trackIndex, Spine.Event e) {
//play some sound if footstep event fired
if (e.Data.Name == footstepEventName) {
footstepAudioSource.Stop();
footstepAudioSource.Play();
}
}
示例3: Event
// DEFINE EVENT FUNCTIONS ---------------------------------------------------------------
public void Event(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
//Debug.Log(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e + ", " + e.Int);
// EVENT LISTENER
switch (e.ToString()) {
case "footstep" :
fxFootstep.Play();
break;
case "charge" :
if (charging) {
// CHARGE END
fxCharge.Stop();
charging = false;
cancelable = false;
} else {
// START CHARGING
fxCharge.Play();
charging = true;
}
break;
case "recovery" :
cancelable = true;
break;
}
}
示例4: HandleEvent
void HandleEvent(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
if (e.Data.Name == footstepEvent) {
footstepAudioSource.pitch = 0.5f + Random.Range(-0.2f, 0.2f);
footstepAudioSource.Play();
}
}
示例5: CreateAniResOrOther
public static GameObject CreateAniResOrOther(string prefabPath, Subject2 owner, UserTriggerDelegate handleFunc, Spine.AnimationState.EventDelegate spineEvent)
{
GameObject gameObject = null;
if (!string.IsNullOrEmpty(prefabPath))
{
gameObject = RecycleManager.Instance.Instantiate(prefabPath);
if (gameObject != null)
{
AniResource aniRes = gameObject.GetComponent<AniResource>();
if (aniRes != null)
{
aniRes.owner = owner as Automaton;
aniRes.RegisterUserTriggerDelegate(handleFunc, spineEvent);
}
}
if (gameObject == null)
{
Debug.LogWarning("prefabPath null: [" + prefabPath + "]");
CubeTile.E_Pivot pivot = CubeTile.E_Pivot.BC;
if (owner is Projectile)
{
pivot = CubeTile.E_Pivot.MC;
}
gameObject = CubeTile.Create(pivot).gameObject;
gameObject.transform.localScale = new Vector3(owner.Rect.width, owner.Rect.height, 0);
}
}
return gameObject;
}
示例6: Event
public void Event(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
// DEBUG event display
debug_Event.text = e.ToString();
debug_Event.fontSize = debug_Event.fontSize != 20 ? 20 : 15;
//Debug.Log(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e + ", " + e.Int);
// EVENT LISTENER
switch (e.ToString()) {
case "footstep" :
fxFootstep.Play();
break;
case "charge" :
if (charging) {
// charge end
fxCharge.Stop();
charging = false;
cancelable = false;
} else {
// start charging
fxCharge.Play();
charging = true;
}
break;
case "recovery" :
cancelable = true;
break;
}
}
示例7: HandleEvent
void HandleEvent(Spine.AnimationState state, int trackIndex, Spine.Event e)
{
if (e.Data.Name == groundcollide) {
stepsound.Stop();
stepsound.Play();
}
}
示例8: EndEvent
void EndEvent(Spine.AnimationState state, int trackIndex )
{
// ZuDebug.Log ("EndEvent name = " + state );
// if( PLAYER_ATK_ANIN == state.ToString() )
// {
// //SetIdle ();
// }
}
示例9: GetAttachment
public static Spine.Attachment GetAttachment(string attachmentPath, Spine.SkeletonData skeletonData)
{
var hierarchy = SpineAttachment.GetHierarchy(attachmentPath);
if (hierarchy.name == "")
return null;
return skeletonData.FindSkin(hierarchy.skin).GetAttachment(skeletonData.FindSlotIndex(hierarchy.slot), hierarchy.name);
}
示例10: state_End
//void state_Event(Spine.AnimationState state, int trackIndex, Spine.Event e)
//{
// if (e + "" == "zhongjian")
// {
// Debug.Log("zhongjian!");
// Instantiate(m_arrowArea, new Vector2(0, 0), Quaternion.Euler(0, 0, 0));
// return;
// }
// if (e + "" == "tankai" )
// {
// isCheckBlock = true;
// checkTime = 0.05f;
// //try
// //{
// // m_hit = Physics2D.Linecast(this.transform.position, playerObj.transform.position, 1 << LayerMask.NameToLayer("Block"));
// // if (m_hit)
// // {
// // Debug.Log("block my arrow");
// // beenBlock();
// // }
// //}
// //catch {
// // // exception
// //}
// }
//}
void state_End(Spine.AnimationState state, int trackIndex)
{
if (state.GetCurrent(trackIndex) + "" == "animation") {
Instantiate(m_arrowStand, new Vector2(4.2f , 4.7f), Quaternion.Euler(0, 0, 0));
m_audioManager.archerkill();
Destroy(this.gameObject);
}
}
示例11: SafeSubscribe
void SafeSubscribe (Spine.TrackEntry trackEntry) {
if (trackEntry == null) {
// Break immediately if trackEntry is null.
m_WasFired = true;
} else {
// Function normally.
trackEntry.Complete += HandleComplete;
}
}
示例12: state_End
void state_End(Spine.AnimationState state, int trackIndex)
{
if (state.GetCurrent(trackIndex) + "" == "animation") {
changeAniamtion = true;
}
if (state.GetCurrent(trackIndex) + "" == "animation3") {
Destroy(this.gameObject);
}
}
示例13: SafeSubscribe
void SafeSubscribe (Spine.TrackEntry trackEntry) {
if (trackEntry == null) {
// Break immediately if trackEntry is null.
Debug.LogWarning("TrackEntry was null. Coroutine will continue immediately.");
m_WasFired = true;
} else {
trackEntry.End += HandleEnd;
}
}
示例14: state_End
void state_End(Spine.AnimationState state, int trackIndex)
{
if (state.GetCurrent(trackIndex) + "" == "zoom_out2")
{
bgAnimationScript.state.SetAnimation(5, "stay", false);
GameObject.Find("EnemyCreator").GetComponent<EnemyManager>().isPause = false;
m_TouchController.setTouchState("fight");
}
}
示例15: OnEvent
//SkeletonAnimation
/*
* Int Value: 0 sets ghostingEnabled to false, 1 sets ghostingEnabled to true
* Float Value: Values greater than 0 set the spawnRate equal the float value
* String Value: Pass RGBA hex color values in to set the color property. IE: "A0FF8BFF"
*/
void OnEvent (Spine.AnimationState state, int trackIndex, Spine.Event e) {
if (e.Data.Name == "Ghosting") {
ghostingEnabled = e.Int > 0;
if (e.Float > 0)
spawnRate = e.Float;
if (e.String != null) {
this.color = HexToColor(e.String);
}
}
}