void Awake() { anim = GetComponentInChildren<SkeletonAnimation>(); move = GetComponent<EnemyMove>(); AI = GetComponent<EnemyAI>(); collision = GetComponent<EnemyCollisionState>(); }
static int Update(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(Spine.Unity.SkeletonAnimation))) { Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.ToObject(L, 1); obj.Update(); return(0); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(Spine.Unity.SkeletonAnimation), typeof(float))) { Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.ToObject(L, 1); float arg0 = (float)LuaDLL.lua_tonumber(L, 2); obj.Update(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: Spine.Unity.SkeletonAnimation.Update")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_UpdateComplete(IntPtr L) { try { Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonAnimation)); EventObject arg0 = null; if (LuaDLL.lua_isuserdata(L, 2) != 0) { arg0 = (EventObject)ToLua.ToObject(L, 2); } else { return(LuaDLL.luaL_throw(L, "The event 'Spine.Unity.SkeletonAnimation.UpdateComplete' can only appear on the left hand side of += or -= when used outside of the type 'Spine.Unity.SkeletonAnimation'")); } if (arg0.op == EventOp.Add) { Spine.Unity.UpdateBonesDelegate ev = (Spine.Unity.UpdateBonesDelegate)arg0.func; obj.UpdateComplete += ev; } else if (arg0.op == EventOp.Sub) { Spine.Unity.UpdateBonesDelegate ev = (Spine.Unity.UpdateBonesDelegate)arg0.func; obj.UpdateComplete -= ev; } return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_playComPleteCallBack(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; Spine.Unity.SkeletonAnimation.PlayCompleteCallBack arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (Spine.Unity.SkeletonAnimation.PlayCompleteCallBack)ToLua.CheckObject(L, 2, typeof(Spine.Unity.SkeletonAnimation.PlayCompleteCallBack)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(Spine.Unity.SkeletonAnimation.PlayCompleteCallBack), func) as Spine.Unity.SkeletonAnimation.PlayCompleteCallBack; } obj.playComPleteCallBack = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index playComPleteCallBack on a nil value" : e.Message)); } }
/// <summary> /// 根据原始附件的类型选择生成不同类型的附件 /// </summary> /// <returns>The attachment by type.</returns> /// <param name="type">Type.</param> /// <param name="attachmentName">Attachment name.</param> /// <param name="atlasRegion">Atlas region.</param> private Attachment GetAttachmentByType(Spine.Unity.SkeletonAnimation skeletonAnim, RoleAttachmentType type, string attachmentName, AtlasRegion atlasRegion) { switch (type) { //暂时只有MeshAttachment和RegionAttachment case RoleAttachmentType.Region: return(SpineCreateAttachment.Instance.CreateRegionAttachmentByAtlasRegion(skeletonAnim, attachmentName, atlasRegion)); case RoleAttachmentType.LinkedMesh: case RoleAttachmentType.Mesh: return(SpineCreateAttachment.Instance.CreateMeshAttachmentByAtlasRegion(skeletonAnim, attachmentName, atlasRegion)); case RoleAttachmentType.BoundingBox: return(SpineCreateAttachment.Instance.CreateBoundingBoxAttachmentByName(skeletonAnim, attachmentName)); case RoleAttachmentType.Clipping: return(SpineCreateAttachment.Instance.CreateClippingAttachmentByName(skeletonAnim, attachmentName)); case RoleAttachmentType.Path: return(SpineCreateAttachment.Instance.CreatePathAttachmentByName(skeletonAnim, attachmentName)); case RoleAttachmentType.Point: return(SpineCreateAttachment.Instance.CreatePointAttachmentByName(skeletonAnim, attachmentName)); default: return(null); } }
void SetSplash() { if (mSplash != null) { if (Framework.GameAppInstaller.Instance.showSplashAnimation) { Spine.Unity.SkeletonAnimation ske = mSplash.GetComponentInChildren <Spine.Unity.SkeletonAnimation>(); ske.playComPleteCallBack = (Spine.TrackEntry trackEntry) => { mSplash.gameObject.SetActive(false); if (mAssetUpdate != null) { mAssetUpdate.gameObject.SetActive(true); } }; } else { mSplash.gameObject.SetActive(false); if (mAssetUpdate != null) { mAssetUpdate.gameObject.SetActive(true); } } GameObject.Destroy(mSplash); } }
void Start () { // Make sure you get these AnimationState and Skeleton references in Start or Later. Getting and using them in Awake is not guaranteed by default execution order. skeletonAnimation = GetComponent<SkeletonAnimation>(); spineAnimationState = skeletonAnimation.state; skeleton = skeletonAnimation.skeleton; StartCoroutine(DoDemoRoutine()); }
public void Start () { skeletonAnimation = GetComponent<SkeletonAnimation>(); // Get the SkeletonAnimation component for the GameObject this script is attached to. skeletonAnimation.state.Event += HandleEvent;; // Call our method any time an animation fires an event. skeletonAnimation.state.End += (entry) => Debug.Log("start: " + entry.trackIndex); // A lambda can be used for the callback instead of a method. skeletonAnimation.state.AddAnimation(0, "jump", false, 2); // Queue jump to be played on track 0 two seconds after the starting animation. skeletonAnimation.state.AddAnimation(0, "run", true, 0); // Queue walk to be looped on track 0 after the jump animation. }
void Awake() { inputState = GetComponent<InputState>(); anim = GetComponentInChildren<SkeletonAnimation>(); collisionState = GetComponent<CollisionState>(); attackBehavior = GetComponent<Attack>(); rb2d = GetComponent<Rigidbody2D>(); crouchBehavior = GetComponent<CrouchBehavior>(); }
public void Clear() { if (Mine != null) { Destroy(Mine.gameObject); Mine = null; } MyLinker = null; CurrentPrefabName = basic_animation = string.Empty; }
public static Spine.Unity.SkeletonAnimation Reload(this Spine.Unity.SkeletonAnimation s) { try { s.Initialize(true); } catch (System.Exception e) { Util.LogError(e); } return(s); }
static int NewSpineAniSync(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 5) { CFramework.ScriptFunc obj = (CFramework.ScriptFunc)ToLua.CheckObject <CFramework.ScriptFunc>(L, 1); string arg0 = ToLua.CheckString(L, 2); UnityEngine.GameObject arg1 = (UnityEngine.GameObject)ToLua.CheckObject(L, 3, typeof(UnityEngine.GameObject)); string arg2 = ToLua.CheckString(L, 4); string arg3 = ToLua.CheckString(L, 5); Spine.Unity.SkeletonAnimation o = obj.NewSpineAniSync(arg0, arg1, arg2, arg3); ToLua.Push(L, o); return(1); } else if (count == 6) { CFramework.ScriptFunc obj = (CFramework.ScriptFunc)ToLua.CheckObject <CFramework.ScriptFunc>(L, 1); string arg0 = ToLua.CheckString(L, 2); UnityEngine.GameObject arg1 = (UnityEngine.GameObject)ToLua.CheckObject(L, 3, typeof(UnityEngine.GameObject)); string arg2 = ToLua.CheckString(L, 4); string arg3 = ToLua.CheckString(L, 5); string arg4 = ToLua.CheckString(L, 6); Spine.Unity.SkeletonAnimation o = obj.NewSpineAniSync(arg0, arg1, arg2, arg3, arg4); ToLua.Push(L, o); return(1); } else if (count == 7) { CFramework.ScriptFunc obj = (CFramework.ScriptFunc)ToLua.CheckObject <CFramework.ScriptFunc>(L, 1); string arg0 = ToLua.CheckString(L, 2); UnityEngine.GameObject arg1 = (UnityEngine.GameObject)ToLua.CheckObject(L, 3, typeof(UnityEngine.GameObject)); string arg2 = ToLua.CheckString(L, 4); string arg3 = ToLua.CheckString(L, 5); string arg4 = ToLua.CheckString(L, 6); bool arg5 = LuaDLL.luaL_checkboolean(L, 7); Spine.Unity.SkeletonAnimation o = obj.NewSpineAniSync(arg0, arg1, arg2, arg3, arg4, arg5); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: CFramework.ScriptFunc.NewSpineAniSync")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Awake(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonAnimation)); obj.Awake(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_UpdateComplete(IntPtr L) { try { Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonAnimation)); EventObject arg0 = null; if (LuaDLL.lua_isuserdata(L, 2) != 0) { arg0 = (EventObject)ToLua.ToObject(L, 2); } else { return(LuaDLL.luaL_throw(L, "The event 'Spine.Unity.SkeletonAnimation.UpdateComplete' can only appear on the left hand side of += or -= when used outside of the type 'Spine.Unity.SkeletonAnimation'")); } if (arg0.op == EventOp.Add) { Spine.Unity.UpdateBonesDelegate ev = (Spine.Unity.UpdateBonesDelegate)DelegateFactory.CreateDelegate(typeof(Spine.Unity.UpdateBonesDelegate), arg0.func); obj.UpdateComplete += ev; } else if (arg0.op == EventOp.Sub) { Spine.Unity.UpdateBonesDelegate ev = (Spine.Unity.UpdateBonesDelegate)LuaMisc.GetEventHandler(obj, typeof(Spine.Unity.SkeletonAnimation), "UpdateComplete"); Delegate[] ds = ev.GetInvocationList(); LuaState state = LuaState.Get(L); for (int i = 0; i < ds.Length; i++) { ev = (Spine.Unity.UpdateBonesDelegate)ds[i]; LuaDelegate ld = ev.Target as LuaDelegate; if (ld != null && ld.func == arg0.func) { obj.UpdateComplete -= ev; state.DelayDispose(ld.func); break; } } arg0.func.Dispose(); } return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ClearState(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject <Spine.Unity.SkeletonAnimation>(L, 1); obj.ClearState(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int PlayCompleteCallBackToLua(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonAnimation)); Spine.TrackEntry arg0 = (Spine.TrackEntry)ToLua.CheckObject(L, 2, typeof(Spine.TrackEntry)); obj.PlayCompleteCallBackToLua(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ChangeQueue(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonAnimation)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.ChangeQueue(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Update(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject <Spine.Unity.SkeletonAnimation>(L, 1); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.Update(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Initialize(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)ToLua.CheckObject(L, 1, typeof(Spine.Unity.SkeletonAnimation)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.Initialize(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int NewSkeletonAnimationGameObject(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Spine.Unity.SkeletonDataAsset arg0 = (Spine.Unity.SkeletonDataAsset)ToLua.CheckUnityObject(L, 1, typeof(Spine.Unity.SkeletonDataAsset)); Spine.Unity.SkeletonAnimation o = Spine.Unity.SkeletonAnimation.NewSkeletonAnimationGameObject(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int AddToGameObject(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject)); Spine.Unity.SkeletonDataAsset arg1 = (Spine.Unity.SkeletonDataAsset)ToLua.CheckUnityObject(L, 2, typeof(Spine.Unity.SkeletonDataAsset)); Spine.Unity.SkeletonAnimation o = Spine.Unity.SkeletonAnimation.AddToGameObject(arg0, arg1); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_playComPleteCallBack(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; Spine.Unity.SkeletonAnimation.PlayCompleteCallBack ret = obj.playComPleteCallBack; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index playComPleteCallBack on a nil value" : e.Message)); } }
static int get_loop(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; bool ret = obj.loop; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index loop on a nil value" : e.Message)); } }
static int get_timeScale(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; float ret = obj.timeScale; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index timeScale on a nil value" : e.Message)); } }
static int set_AnimationName(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; string arg0 = ToLua.CheckString(L, 2); obj.AnimationName = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index AnimationName on a nil value" : e.Message)); } }
static int get_state(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; Spine.AnimationState ret = obj.state; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index state on a nil value" : e.Message)); } }
static int set_loop(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.loop = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index loop on a nil value" : e.Message)); } }
static int set_state(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; Spine.AnimationState arg0 = (Spine.AnimationState)ToLua.CheckObject(L, 2, typeof(Spine.AnimationState)); obj.state = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index state on a nil value" : e.Message)); } }
static int get_AnimationName(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; string ret = obj.AnimationName; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index AnimationName on a nil value" : e.Message)); } }
static int set_timeScale(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Spine.Unity.SkeletonAnimation obj = (Spine.Unity.SkeletonAnimation)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.timeScale = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index timeScale on a nil value" : e.Message)); } }
public void Initialize(bool overwrite) { if (skeletonAnimations.Count != 0 && !overwrite) { return; } Clear(); var settings = this.meshGeneratorSettings; Transform thisTransform = this.transform; foreach (var sda in skeletonDataAssets) { var sa = SkeletonAnimation.NewSkeletonAnimationGameObject(sda); sa.transform.SetParent(thisTransform, false); sa.SetMeshSettings(settings); sa.initialFlipX = this.initialFlipX; sa.initialFlipY = this.initialFlipY; var skeleton = sa.skeleton; skeleton.flipX = this.initialFlipX; skeleton.flipY = this.initialFlipY; sa.Initialize(false); skeletonAnimations.Add(sa); } // Build cache var animationNameTable = this.animationNameTable; var animationSkeletonTable = this.animationSkeletonTable; foreach (var skeletonAnimation in skeletonAnimations) { foreach (var animationObject in skeletonAnimation.skeleton.data.animations) { animationNameTable[animationObject.name] = animationObject; animationSkeletonTable[animationObject] = skeletonAnimation; } } SetActiveSkeleton(skeletonAnimations[0]); SetAnimation(initialAnimation, initialLoop); }
public void Create(string prefabName, string prefabskin, string basic_animation_name, float size) { Clear(); CurrentPrefabName = prefabName; basic_animation = basic_animation_name; //가장 가까운 링커를 찾는다 MyLinker = this.GetNearestParent <scSpineRenderStageLinker>(); //생성 Mine = MyLinker.Stage.MakeSpineObject(gameObject, prefabName, size); if (Mine != null) { Mine.initialSkinName = prefabskin; SetAnimationBasic(basic_animation, true); Mine.Reload(); Mine.state.Complete += everyAnimationCompleted; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (!skillSetting) { skillSetting = property.serializedObject.targetObject as SkillSetting; } skeletonAnimation = skillSetting.skeletonAnimation; if (!skeletonAnimation) { skillSetting.skeletonAnimation = skillSetting.gameObject.GetComponentInChildren <Spine.Unity.SkeletonAnimation>(); skeletonAnimation = skillSetting.skeletonAnimation; } if (!skeletonAnimation) { skillSetting.skeletonAnimation = skillSetting.gameObject.GetComponentInParent <Spine.Unity.SkeletonAnimation>(); skeletonAnimation = skillSetting.skeletonAnimation; } SerializedProperty listProperty = property.FindPropertyRelative("skillEventList"); /*ReorderableList*/ list = GetList(listProperty); float height = 0f; for (int i = 0; i < listProperty.arraySize; i++) { height = Mathf.Max(height, EditorGUI.GetPropertyHeight(listProperty.GetArrayElementAtIndex(i))) + 1.5f; } //애니메이션 지정 안되있으면 이벤트 목록 그리지 않음 //if (skeletonAnimation) { list.elementHeight = EditorGUIUtility.singleLineHeight * 3 + 20f; //list.DoList(position); list.DoLayoutList(); } }
// Use this for initialization void Start() { body = GetComponent <Rigidbody2D>(); animation = GetComponent <Spine.Unity.SkeletonAnimation>(); /* * switch(gun) * { * case 0: * animation.state.SetAnimation(1, "meleeIdle", true); * break; * case 1: * animation.state.SetAnimation(1, "pistolNearIdle", true); * break; * case 2: * animation.state.SetAnimation(1, "gunIdle", true); * break; * case 3: * animation.state.SetAnimation(1, "machineGunIdle", true); * break; * } */ }
void Awake () { skeletonAnimation = GetComponent<SkeletonAnimation>(); skeletonAnimation.OnRebuild += Apply; }
void Start () { skeletonAnimation = GetComponent<SkeletonAnimation>(); skeletonAnimation.state.Event += HandleEvent; StartCoroutine(GunGrabRoutine()); }
public WaitForSpineEvent (SkeletonAnimation skeletonAnimation, string eventName, bool unsubscribeAfterFiring = true) { // If skeletonAnimation is invalid, its state will be null. Subscribe handles null states just fine. SubscribeByName(skeletonAnimation.state, eventName, unsubscribeAfterFiring); }
public void Start () { skeletonAnimation = GetComponent<SkeletonAnimation>(); headBone = skeletonAnimation.skeleton.FindBone("head"); skeletonAnimation.UpdateLocal += UpdateLocal; }