static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { UnityEngine.AnimationState gen_ret = new UnityEngine.AnimationState(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AnimationState constructor!")); }
/// <summary> /// Initialize and collect information from animationComponent /// </summary> /// <param name="animationComponent">UnityEngine.Animation</param> public override void Initialize(UnityEngine.Animation animationComponent) { _Animation = animationComponent; _State = _Animation[CurrentAnimation]; if (_State != null) { _Length = _State.length; _State.layer = Layer.LayerIndex; } else { if (!IgnoreMissAnimationWarning) { UnityEngine.Debug.LogWarning("Please set valid 'AnimationName' to AnimNodeSequence : " + (string.IsNullOrEmpty(Name) ? "" : CurrentAnimation)); } } }
public static UnityEngine.AnimationState PrepareAnimation(UnityEngine.GameObject obj, string animName) { UnityEngine.AnimationState state = null; UnityEngine.Animation animation = obj.GetComponent <UnityEngine.Animation>(); if (null != animation && !string.IsNullOrEmpty(animName)) { state = animation[animName]; if (null == state) { UnityEngine.AnimationClip clip = GetSharedResource("Animations/" + animName) as UnityEngine.AnimationClip; if (null != clip) { animation.AddClip(clip, animName); state = animation[animName]; } } } return(state); }
/// <summary> /// Apply changes to UnityEngine.Animation component /// </summary> /// <param name="animationComponent">UnityEngine.Animation to apply changes to</param> internal void Apply(UnityEngine.Animation animationComponent) { foreach (var anim in ActiveAnimNodes) // iterate throw all active AnimNodeSequences { UnityEngine.AnimationState state = animationComponent[anim.CurrentAnimation]; // access state if (state != null) { state.speed = anim.Speed; // set parameters state.blendMode = BlendMode; state.wrapMode = anim.WrapMode; state.layer = LayerIndex; state.weight = anim.BlendWeight.Weight; // disable or enable animation if (anim.BlendWeight.Weight == 0) { state.enabled = false; } else { state.enabled = true; } } // if profile changed in previous frame if (anim.UpdatePreviousAnimation) { if (anim.PreviousAnimation != null) { UnityEngine.AnimationState preState = animationComponent[anim.PreviousAnimation]; if (preState != null) { animationComponent.Blend(anim.PreviousAnimation, 0, 0.3f); } } anim.UpdatePreviousAnimation = false; } } }
static int _m_RemoveMixingTransform(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.AnimationState __cl_gen_to_be_invoked = (UnityEngine.AnimationState)translator.FastGetCSObj(L, 1); try { { UnityEngine.Transform mix = (UnityEngine.Transform)translator.GetObject(L, 2, typeof(UnityEngine.Transform)); __cl_gen_to_be_invoked.RemoveMixingTransform(mix); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
static int _m_AddMixingTransform(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.AnimationState gen_to_be_invoked = (UnityEngine.AnimationState)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && translator.Assignable <UnityEngine.Transform>(L, 2)) { UnityEngine.Transform _mix = (UnityEngine.Transform)translator.GetObject(L, 2, typeof(UnityEngine.Transform)); gen_to_be_invoked.AddMixingTransform(_mix); return(0); } if (gen_param_count == 3 && translator.Assignable <UnityEngine.Transform>(L, 2) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3)) { UnityEngine.Transform _mix = (UnityEngine.Transform)translator.GetObject(L, 2, typeof(UnityEngine.Transform)); bool _recursive = LuaAPI.lua_toboolean(L, 3); gen_to_be_invoked.AddMixingTransform(_mix, _recursive); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AnimationState.AddMixingTransform!")); }
public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime) { if (curSectionTime < m_StartTime) { return(true); } UnityEngine.GameObject obj = sender as UnityEngine.GameObject; if (obj == null) { return(false); } UnityEngine.Transform part_transform = TriggerUtil.GetChildNodeByName(obj, m_PartName); if (part_transform == null || part_transform.gameObject == null) { LogSystem.Debug("----play part anim: not find part {0}", m_PartName); return(false); } UnityEngine.GameObject part = part_transform.gameObject; UnityEngine.AnimationState anim_state = part.GetComponent <UnityEngine.Animation>()[m_AnimName]; if (anim_state == null) { LogSystem.Debug("----play part anim: not find anim {0}", m_AnimName); return(false); } anim_state.speed = m_AnimSpeed; anim_state.wrapMode = m_WrapMode; if (m_FadeLength <= 0) { part.GetComponent <UnityEngine.Animation>().Play(m_AnimName); } else { part.GetComponent <UnityEngine.Animation>().CrossFade(m_AnimName, m_FadeLength); } return(false); }
static int _m_CrossFadeQueued(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.Animation gen_to_be_invoked = (UnityEngine.Animation)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { string _animation = LuaAPI.lua_tostring(L, 2); UnityEngine.AnimationState gen_ret = gen_to_be_invoked.CrossFadeQueued(_animation); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { string _animation = LuaAPI.lua_tostring(L, 2); float _fadeLength = (float)LuaAPI.lua_tonumber(L, 3); UnityEngine.AnimationState gen_ret = gen_to_be_invoked.CrossFadeQueued(_animation, _fadeLength); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable <UnityEngine.QueueMode>(L, 4)) { string _animation = LuaAPI.lua_tostring(L, 2); float _fadeLength = (float)LuaAPI.lua_tonumber(L, 3); UnityEngine.QueueMode _queue; translator.Get(L, 4, out _queue); UnityEngine.AnimationState gen_ret = gen_to_be_invoked.CrossFadeQueued(_animation, _fadeLength, _queue); translator.Push(L, gen_ret); return(1); } if (gen_param_count == 5 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable <UnityEngine.QueueMode>(L, 4) && translator.Assignable <UnityEngine.PlayMode>(L, 5)) { string _animation = LuaAPI.lua_tostring(L, 2); float _fadeLength = (float)LuaAPI.lua_tonumber(L, 3); UnityEngine.QueueMode _queue; translator.Get(L, 4, out _queue); UnityEngine.PlayMode _mode; translator.Get(L, 5, out _mode); UnityEngine.AnimationState gen_ret = gen_to_be_invoked.CrossFadeQueued(_animation, _fadeLength, _queue, _mode); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Animation.CrossFadeQueued!")); }