private IEnumerator ACCELERATE_enum() { if (is_Grounded && !is_Acceleration_pressed_one_time) { #region ACT forward_speed *= 2f; animator.animation.Play("accelerate"); // -----------------------------------------> animation_for_accelerationBtn.Play(animation_for_accelerationBtn.name); is_Acceleration_pressed_one_time = true; #endregion yield return(new WaitForSeconds(action_duration)); #region DEACT foreach (var item in acceleration_UI) { item.SetActive(false); } forward_speed /= 2f; animator.animation.Stop("accelerate"); // -----------------------------------------> animation_for_accelerationBtn.Stop(animation_for_accelerationBtn.name); is_Acceleration_pressed_one_time = false; #endregion } }
static int QPYX_Stop_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 1) { UnityEngine.Animation QPYX_obj_YXQP = (UnityEngine.Animation)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.Animation)); QPYX_obj_YXQP.Stop(); return(0); } else if (QPYX_count_YXQP == 2) { UnityEngine.Animation QPYX_obj_YXQP = (UnityEngine.Animation)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.Animation)); string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2); QPYX_obj_YXQP.Stop(QPYX_arg0_YXQP); return(0); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.Animation.Stop")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
void Start() { anim = GetComponentInChildren<Animation>(); //Loop all animations anim.wrapMode = WrapMode.Loop; //Dont loop the animations below anim["ramAttack"].wrapMode = WrapMode.Once; anim["getHit"].wrapMode = WrapMode.Once; anim["death"].wrapMode = WrapMode.Once; anim["angry1"].wrapMode = WrapMode.Once; anim["angry2"].wrapMode = WrapMode.Once; // Put idle and walk into lower layers (The default layer is always 0) // This will do two things // - Since the others and idle/walk are in different layers they will not affect // each other's playback when calling CrossFade. // - Since the other is in a higher layer, the animation will replace idle/walk // animations when faded in. anim["ramAttack"].layer = 1; anim["getHit"].layer = 1; anim["death"].layer = 1; anim["angry1"].layer = 1; anim["angry2"].layer = 1; // Stop animations that are already playing //(In case user forgot to disable play automatically) anim.Stop(); }
static public int Stop(IntPtr l) { try{ if (matchType(l, 2)) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Stop(); return(0); } else if (matchType(l, 2, typeof(string))) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.Stop(a1); return(0); } LuaDLL.luaL_error(l, "No matched override function to call"); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static int Stop(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.Animation.Register"); #endif try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); obj.Stop(); return(0); } else if (count == 2) { UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); string arg0 = ToLua.CheckString(L, 2); obj.Stop(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.Stop")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int Stop(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 3) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 3, out a1); self.Stop(a1); pushValue(l, true); return(1); } else if (argc == 2) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Stop(); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static int Stop(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); obj.Stop(); return(0); } else if (count == 2) { UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.CheckObject(L, 1, typeof(UnityEngine.Animation)); string arg0 = ToLua.CheckString(L, 2); obj.Stop(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Animation.Stop")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void OnCollisionAffected(Collision col) { //Debug.Log("Collision Happened"); isCollided = true; m_Running = GetComponent<Animation>(); m_Running.Stop(); m_Rigidbody = GetComponent<Rigidbody>(); m_Rigidbody.isKinematic = true; }
// Use this for initialization void Start() { platAnim = gameObject.GetComponent<Animation>(); m_lastRotY = gameObject.transform.rotation.eulerAngles.y; if (!m_enabled && platAnim != null) { platAnim.Stop(); } }
public void Awake() { _cachedTransform = transform; _animation = gameObject.GetComponent<Animation>(); _animation.Stop(); EventsAggregator.Fight.AddListener(EFightEvent.MapComplete, OnMapEnd); EventsAggregator.Fight.AddListener(EFightEvent.MapFail, OnMapEnd); }
/// <summary> /// Execute legacy animation. /// </summary> /// <param name="clip">Legacy Animation Clip.</param> /// <param name="fadeLength">Period of time over which animation clip will fade.</param> /// <param name="force">Legacy Animation Clip.</param> public void Animate(AnimationClip clip, float fadeLength = 0.3F, bool force = false) { if (_animation && clip != null) { if (force) { _animation.Stop(); } _animation.CrossFade(clip.name, fadeLength); } }
static public int Stop(IntPtr l) { try { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Stop(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private IEnumerator <IYieldInstruction> PlayAnimations() { mAvatarAnimationComponent.Stop(); while (true) { if (!mAvatarAnimationComponent.isPlaying) { AnimationClip clip = mAnimations[mRand.Next(0, mAnimations.Count - 1)]; mAvatarAnimationComponent.Play(clip.name); } yield return(new YieldUntilNextFrame()); } }
static public int Stop__String(IntPtr l) { try { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.Stop(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// Manually reset the active animation to the beginning. /// </summary> public static void Reset(Animation anim) { if (anim.isPlaying) { AnimationClip clip = anim.clip; if (clip != null) { anim.Stop(); ActiveAnimation aa = anim.gameObject.GetComponent<ActiveAnimation>(); if (aa != null) Play(anim, clip.name, aa.mLastDirection); } } }
public static int Stop_wrap(long L) { try { long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.Animation obj = get_obj(nThisPtr); obj.Stop(); } catch (Exception e) { Debug.LogException(e); } return(0); }
private void PlayAnimation(AnimationClip clip) { graphicRaycaster.enabled = false; if (animator.isPlaying) { animator.Stop(); } animator.RemoveClip(animator.clip); animator.clip = clip; animator.AddClip(clip, clip.name); animator.Play(); Debug.Log("Playing " + clip.name, clip); StopAnimationEndAwaiter(); _animationWaitCoroutine = StartCoroutine(WaitForAnimationEnd(clip)); }
public static int Stop1_wrap(long L) { try { long VM = FCLibHelper.fc_get_vm_ptr(L); long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.Animation obj = get_obj(nThisPtr); string arg0 = FCLibHelper.fc_get_string_a(L, 0); obj.Stop(arg0); } catch (Exception e) { Debug.LogException(e); } return(0); }
static public int Stop(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (argc == 1) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Stop(); pushValue(l, true); return(1); } else if (argc == 2) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.Stop(a1); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function Stop to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public AvatarAnimationStateMachine(AvatarEntity avatarEntity) { if (avatarEntity == null) { throw new ArgumentNullException("avatarEntity"); } Animation animationComponent = avatarEntity.UnityGameObject.GetComponent(typeof(Animation)) as Animation; if (animationComponent == null) { throw new ArgumentNullException("animationComponent"); } mAnimationComponent = animationComponent; mAnimationComponent.playAutomatically = false; mAnimationComponent.Stop(); }
public void PlayAnimation(AnimType animType) { var clip = GetClip(animType); var speed = GetSpeed(animType); if (!clip) { return; } if (anim.isPlaying) { anim.Stop(); } SetClipToStart(animType); SetAnimationSpeed(clip, speed); anim.Play(clip.name); }
void Awake () { // init objects anim = fighter.GetComponent<Animation>(); anim.wrapMode = WrapMode.Loop; anim.Stop(); // inits count = 0; fighting = 0; finishedTimer = 0f; attackMoveArray = new ArrayList(); idlename = "Idle1"; guardname = "Guard"; }
static int Stop(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 1 && ToLua.CheckTypes(L, 1, typeof(UnityEngine.Animation))) { UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.ToObject(L, 1); try { obj.Stop(); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } return(0); } else if (count == 2 && ToLua.CheckTypes(L, 1, typeof(UnityEngine.Animation), typeof(string))) { UnityEngine.Animation obj = (UnityEngine.Animation)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); try { obj.Stop(arg0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.Animation.Stop"); } return(0); }
static public int Stop(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 1) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); self.Stop(); return(0); } else if (argc == 2) { UnityEngine.Animation self = (UnityEngine.Animation)checkSelf(l); System.String a1; checkType(l, 2, out a1); self.Stop(a1); return(0); } return(error(l, "No matched override function to call")); } catch (Exception e) { return(error(l, e)); } }
public static void PlayAnimation(this GameObject go, string name = null, State state = State.Play) { UnityEngine.Animation animation = go.GetComponentInChildren <UnityEngine.Animation>(); if (animation != null) { if (string.IsNullOrEmpty(name)) { name = animation.clip.name; } switch (state) { case State.Play: { if (animation.isPlaying && animation.IsPlaying(name)) { } else { animation.Play(name); } } break; case State.Pause: case State.Stop: { if (animation.isPlaying && animation.IsPlaying(name)) { animation.Stop(); } } break; } } }
void OnCollisionEnter(Collision col) { //Debug.Log("Collision Happened"); isCollided = true; m_Running = GetComponent<Animation>(); m_Running.Stop(); m_Rigidbody = GetComponent<Rigidbody>(); m_Rigidbody.isKinematic = true; for (int u = 0; u < 4; u++) if(m_group[u]!=this) m_group[u].stop(); }
private void BakeSkinnedMesh(Animation animation, SkinnedMeshRenderer skinnedMeshRenderer) { int clipIndex = 0; foreach (AnimationState clipState in animation) { //Prep animation clip for sampling var curClip = this.AnimationClipsToBake[clipIndex] = animation.GetClip(clipState.name); animation.Play(clipState.name, PlayMode.StopAll); clipState.time = 0; clipState.wrapMode = WrapMode.Clamp; //Calculate number of meshes to bake in this clip sequence based on the clip's sampling framerate uint numberOfFrames = (uint)Mathf.RoundToInt(curClip.frameRate * curClip.length); var curBakedMeshSequence = this.BakedClips[clipIndex] = new MeshSequence(numberOfFrames); for (uint frameIndex = 0; frameIndex < numberOfFrames; frameIndex++) { //Bake sequence of meshes var curMeshFrame = curBakedMeshSequence[frameIndex] = new Mesh(); curMeshFrame.name = string.Format(@"{0}_Baked_{1}_{2}", this.name, clipIndex, frameIndex); animation.Sample(); skinnedMeshRenderer.BakeMesh(curMeshFrame); clipState.time += (1.0f / curClip.frameRate); } animation.Stop(); clipIndex++; } }
public static int metcrossfadetransitionanimation(Transform varpcharacter, string varpdestinationanimname, float varptransitiontime, Transform varpcontroller = null, string varpstateanimationname = "", bool varpgokinematic = true, string varpnewanimname = "transition", Animation varpanimationsystem = null, SkinnedMeshRenderer varprenderer = null, clsurganimationstatesmanager varpstatesmanager = null) { if (varpcharacter == null) { return -1; } if (varptransitiontime == 0f) { return -2; } if (varpanimationsystem == null) { varpanimationsystem = varpcharacter.root.GetComponentInChildren<Animation>(); if (varpanimationsystem == null) { return -3; } varpanimationsystem.Stop(); } if (varprenderer == null) { varprenderer = varpcharacter.root.GetComponentInChildren<SkinnedMeshRenderer>(); if (varprenderer == null) { return -4; } } if (varpgokinematic) { clsurgutils.metgodriven(varpcharacter, true); } Vector3 localPosition = default(Vector3); if (varpcontroller != null) { Vector3 position = varpcharacter.position; varpcontroller.position = position; varpcharacter.localPosition = localPosition; } AnimationClip animationClip = clsurgutils.metcreatetransitionanimation(varpcharacter, varpdestinationanimname, varptransitiontime, varpnewanimname, ref localPosition, varpstatesmanager, false); if (animationClip != null) { varpanimationsystem.Stop(); AnimationState animationState = varpanimationsystem[varpdestinationanimname]; if (animationState != null && animationState.name != varpdestinationanimname) { varpanimationsystem.RemoveClip(varpnewanimname); } varpanimationsystem.AddClip(animationClip, varpnewanimname); if (varpstateanimationname != string.Empty) { varpanimationsystem[varpnewanimname].wrapMode = WrapMode.Once; varpanimationsystem.CrossFade(varpnewanimname); varpanimationsystem.CrossFadeQueued(varpstateanimationname); } else { varpanimationsystem.CrossFade(varpnewanimname); } return 1; } Debug.LogError("Could not create transition"); return -5; }
public void StopPlayingAnimation() { mAnimationComponent.Stop(); }
// Use this for initialization protected override void Start() { base.AttackSpeed = 10.0f; ani = this.GetComponent<Animation>(); ani.Stop(); // animation.animation.Stop(); }
/// <summary> /// 停止 /// </summary> /// <param name="animation"></param> public void Stop(string animation) { m_Animation.Stop(animation); }
private void ExportMeshAnimation() { AnimationClip[] animationClips = exportParams.AnimationClips; string[] animationClipNames = exportParams.AnimationNames; GameObject instanceObj = Instantiate(fbx) as GameObject; UnityEngine.Animation animation = instanceObj.GetComponentInChildren <UnityEngine.Animation>(); SkinnedMeshRenderer[] skinnedMeshRenders = instanceObj.GetComponentsInChildren <SkinnedMeshRenderer>(); int subMeshLength = skinnedMeshRenders.Length; Mesh[] subMeshArr = new Mesh[subMeshLength]; for (int i = 0; i < subMeshLength; i++) { subMeshArr[i] = skinnedMeshRenders[i].sharedMesh; } float interval = 1.0f / exportParams.FrameRate; if (File.Exists(exportParams.OutputFilePath)) { File.Delete(exportParams.OutputFilePath); } ExportMeshAnimationData meshAnimationData = ScriptableObject.CreateInstance <ExportMeshAnimationData>(); meshAnimationData.GenerateNormal = exportParams.GenerateNormal; meshAnimationData.SubMeshLength = subMeshLength; meshAnimationData.Fps = exportParams.FrameRate; meshAnimationData.SubMeshData = new ExportMeshAnimationData.AnimationSubMeshData[subMeshLength]; for (int i = 0; i < subMeshLength; i++) { meshAnimationData.SubMeshData[i].ClipDatas = new ExportMeshAnimationData.AnimationClipData[animationClips.Length]; meshAnimationData.SubMeshData[i].FrameRate = exportParams.FrameRate; for (int j = 0; j < animationClips.Length; j++) { AnimationClip clip = animationClips[j]; if (clip == null) { return; } animation.AddClip(clip, animationClipNames[j]); animation.clip = clip; AnimationState state = animation[animationClipNames[j]]; state.enabled = true; state.weight = 1; List <float> frameTimes = GetFrameTimes(clip.length, interval); meshAnimationData.SubMeshData[i].ClipDatas[j].FrameDatas = new ExportMeshAnimationData.AnimationFrameData[frameTimes.Count]; meshAnimationData.SubMeshData[i].ClipDatas[j].ClipName = animationClipNames[j]; for (int k = 0; k < frameTimes.Count; k++) { state.time = frameTimes[k]; animation.Play(); animation.Sample(); Matrix4x4 matrix4X4 = skinnedMeshRenders[i].transform.localToWorldMatrix; Mesh backMesh = BakeFrameAfterMatrixTransform(skinnedMeshRenders[i], matrix4X4); meshAnimationData.SubMeshData[i].ClipDatas[j].FrameDatas[k].Vertexs = backMesh.vertices; backMesh.Clear(); DestroyImmediate(backMesh); animation.Stop(); } } meshAnimationData.SubMeshData[i].UVs = subMeshArr[i].uv; meshAnimationData.SubMeshData[i].Triangles = subMeshArr[i].triangles; } AssetDatabase.CreateAsset(meshAnimationData, GetAssetPath(exportParams.OutputFilePath) + fbx.name + ".asset"); AssetDatabase.Refresh(); }
void Start () { ani = GetComponent<Animation>(); //ani.Play("letsCreate0"); ani.Stop(); }
private void InitModel() { //foreach (var a in GetComponentsInChildren<CapsuleCollider>()) //{ // var caps = a as CapsuleCollider; // if (caps !=null) // { // var box = caps.gameObject.AddComponent<BoxCollider>(); // box.center = caps.center; // box.size = new Vector3(caps.radius, caps.height, caps.radius); // Destroy(caps); // } //} maxlife = life; _Game.zombies.Add(this); anim = GetComponentInChildren<Animation>(); anim.playAutomatically = false; anim.Stop(); model = anim.transform; deadMaterial = GetComponentInChildren<DeadMaterial>(); if (model.GetComponent<Forward>() == null) model.gameObject.AddComponent<Forward>().receiver = transform; foreach (var a in rigidBodies) a.angularDrag = 2; }
void Start() { animator = skater.gameObject.GetComponent<Animation>(); animator.wrapMode = WrapMode.Clamp; animator["idle"].wrapMode = WrapMode.Once; animator["idle"].layer = -1; animator["idle2push"].wrapMode = WrapMode.Clamp; animator["idle2push"].layer = -1; animator["idlePush"].wrapMode = WrapMode.Clamp; animator["idlePush"].layer = -1; animator["push2idle"].wrapMode = WrapMode.Clamp; animator["push2idle"].layer = -1; animator["fakie"].wrapMode = WrapMode.Once; animator["fakie"].layer = -1; animator["fakie2push"].wrapMode = WrapMode.Clamp; animator["fakie2push"].layer = -1; animator["fakiePush"].wrapMode = WrapMode.Clamp; animator["fakiePush"].layer = -1; animator["push2fakie"].wrapMode = WrapMode.Clamp; animator["push2fakie"].layer = -1; animator["idle_TrickPosition"].wrapMode = WrapMode.Clamp; animator["idle_TrickPosition"].layer = -1; animator["fakie_TrickPosition"].wrapMode = WrapMode.Clamp; animator["fakie_TrickPosition"].layer = -1; animator["idle_bremsenIn"].wrapMode = WrapMode.Once; animator["idle_bremsenIn"].layer = -1; animator["idle_bremsenOut"].wrapMode = WrapMode.Once; animator["idle_bremsenOut"].layer = -1; animator["idle_HeelFlip"].wrapMode = WrapMode.Clamp; animator["idle_KickFlip"].wrapMode = WrapMode.Clamp; animator["idle_Ollie"].wrapMode = WrapMode.Clamp; animator["idle_Varial_In"].wrapMode = WrapMode.Clamp; animator["idle_Varial_Out"].wrapMode = WrapMode.Clamp; animator["fakie_HeelFlip"].wrapMode = WrapMode.Clamp; animator["fakie_KickFlip"].wrapMode = WrapMode.Clamp; animator["fakie_Ollie"].wrapMode = WrapMode.Clamp; animator["fakie_Varial_In"].wrapMode = WrapMode.Clamp; animator["fakie_Varial_Out"].wrapMode = WrapMode.Clamp; //animator.SyncLayer(-1); animator.Stop( ); //PlayClip( 0 ); }