public void heroIdle() { //清除拖尾 myTrail.ClearTrail(); }
void LateUpdate() { t = Mathf.Clamp(Time.deltaTime, 0, 0.066f); if (t > 0) { while (tempT < t) { tempT += animationIncrement; if (myTrail.time > 0) { myTrail.Itterate(Time.time - t + tempT); } else { myTrail.ClearTrail(); } } tempT -= t; if (myTrail.time > 0) { myTrail.UpdateTrail(Time.time, t); } } }
public void Update() { if (weaponTrail == null) { return; } t = Mathf.Clamp(Time.deltaTime, 0, 0.066f); if (t > 0) { while (tempT < t) { tempT += animationIncrement; if (weaponTrail.time > 0) { weaponTrail.Itterate(Time.time - t + tempT); } else { weaponTrail.ClearTrail(); } } tempT -= t; if (weaponTrail.time > 0) { weaponTrail.UpdateTrail(Time.time, t); } } }
void LateUpdate() { if (characterAnim.doBaseSkill1) { currentWeaponTrail = baseSkill_Trail1; } else if (characterAnim.doBaseSkill2) { currentWeaponTrail = baseSkill_Trail2; } else if (characterAnim.doSkill1) { currentWeaponTrail = Skill_Trail1; } else if (characterAnim.doSkill2) { currentWeaponTrail = Skill_Trail2; } else if (characterAnim.doSkill3) { currentWeaponTrail = Skill_Trail3; } t = Mathf.Clamp(Time.deltaTime, 0, 0.066f); if (t > 0) { while (tempT < t) { tempT += animationIncrement; if (currentWeaponTrail.time > 0) { currentWeaponTrail.Itterate(Time.time - t + tempT); } else { currentWeaponTrail.ClearTrail(); } } tempT -= t; if (currentWeaponTrail.time > 0) { currentWeaponTrail.UpdateTrail(Time.time, t); } } }
public virtual void _WeaponOff() { FrontBlade.active = false; BackBlade.active = false; frontTrail.ClearTrail(); backTrail.ClearTrail(); GlobalAudioSystem.PlayAudioData(unit.AudioDataDict[WeaponOffSoundEffectName]); }
void Update() { int curAnimaTag = animator.GetCurrentAnimatorStateInfo(0).tagHash; int curTransitionNameHash = animator.GetAnimatorTransitionInfo(0).userNameHash; bool isInTransition = animator.IsInTransition(0); if ((curAnimaTag == AnimaConstant.TagAtk && !isInTransition) || curTransitionNameHash == AnimaConstant.TransitionToAttack) { //设置拖尾时长 myTrail.SetTime(0.1f, 0.0f, 1.0f); //开始进行拖尾 myTrail.StartTrail(0.1f, 0.1f); } else { myTrail.ClearTrail(); } }
//小鸟碰到物体就取消拖尾 public void OnCollisionEnter2D(Collision2D collision) { trail.ClearTrail(); if (collision.transform.tag == "Enemy" || collision.transform.tag == "Ground" && launch) { isFly = false; switch (bt) { case BirdType.Red: sr.sprite = redHurt; break; case BirdType.Yellow: sr.sprite = yellowHurt; break; case BirdType.Green: sr.sprite = greenHurt; break; case BirdType.Black: sr.sprite = blackHurt; break; } Invoke("DestroyMyself", 3); } }
void LateUpdate() { if (playerstate.ani_stat == playerStateLinster.enum_ani_state.Trotting || playerstate.ani_stat == playerStateLinster.enum_ani_state.Walking) { myTrail.UpdateTrail(0, 0); // myTrail.ClearTrail(); // if(myTrail.time<0) myTrail.ClearTrail(); return; } t = Mathf.Clamp(Time.deltaTime, 0, 0.066f); if (t > 0) { while (tempT < t) { tempT += animationIncrement; if (myTrail.time > 0) { myTrail.Itterate(Time.time - t + tempT); } else { myTrail.ClearTrail(); } } tempT -= t; if (myTrail.time > 0) { myTrail.UpdateTrail(Time.time, t); } } }
// #endregion // ------------------------------------------------------------------------------------------------------------------- #region Update // protected void Update() { t = Mathf.Clamp(Time.deltaTime * timeScale, 0, 0.066f); // animationController.SetDeltaTime(t); // Sets the delta time that the animationController uses. // // // This is just some sample code to show you how you can use the animation controller component along with the trails // thinkTime -= t; if (thinkTime < 0) { switch (thinkState) { case 0: animationController.CrossfadeAnimation(animationIdle, 0.2f); thinkState++; thinkTime = 1.5f; break; case 1: // START ATTACK 1 animationController.CrossfadeAnimation(animationAttack1Anticipation, 0.1f); thinkState++; thinkTime = 0.3f; facingAngle = -180 + Random.value * 360; break; case 2: animationController.PlayAnimation(animationAttack1); thinkTime = 0.2f; thinkState++; rightSwipe.StartTrail(0.5f, 0.4f); // Fades the trail in facingAngle += -40 + Random.value * 80; break; case 3: thinkState++; thinkTime = 0.3f; rightSwipe.FadeOut(0.5f); // Fades the trail out break; case 4: // BACK TO IDLE animationController.CrossfadeAnimation(animationIdle, 0.2f); thinkState++; thinkTime = 0.3f; rightSwipe.ClearTrail(); // Forces the trail to clear break; case 5: // START ATTACK 2 animationController.CrossfadeAnimation(animationAttack2Anticipation, 0.1f); thinkState++; thinkTime = 0.3f; facingAngle = -180 + Random.value * 360; break; case 6: animationController.PlayAnimation(animationAttack2); thinkState++; thinkTime = 0.2f; leftSwipe.StartTrail(0.5f, 0.4f); // Fades the trail in facingAngle += -40 + Random.value * 80; break; case 7: thinkState++; thinkTime = 0.3f; leftSwipe.FadeOut(0.5f); // Fades the trail out break; case 8: // BACK TO IDLE animationController.CrossfadeAnimation(animationIdle, 0.2f); thinkState++; thinkTime = 0.3f; leftSwipe.ClearTrail(); // Forces the trail to clear break; case 9: // START THE SPIN ATTACK animationController.CrossfadeAnimation(animationAttack1Anticipation, 0.1f); thinkState++; thinkTime = 0.3f; facingAngle = -180 + Random.value * 360; break; case 10: animationController.CrossfadeAnimation(animationWhirlwind, 0.2f); thinkState++; thinkTime = 2.8f; leftSwipe.StartTrail(0.9f, 1.4f); // Fades both trais in rightSwipe.StartTrail(0.9f, 1.4f); break; case 11: // Checking for a specific place in the animation from which to start the next animation // if (Mathf.Repeat(animationWhirlwind.normalizedTime, 1) < 0.93f + t * 1f && Mathf.Repeat(animationWhirlwind.normalizedTime, 1) > 0.93f - t * 1.2f) { animationController.CrossfadeAnimation(animationAttack3, 0.05f * animationWhirlwind.length); thinkState++; thinkTime = 0.6f; } break; case 12: thinkState++; leftSwipe.FadeOut(0.4f); // Fades both trails out rightSwipe.FadeOut(0.4f); thinkTime = 0.6f; break; case 13: // BACK TO IDLE (for a second) animationController.CrossfadeAnimation(animationIdle, 0.2f); thinkState++; thinkTime = 1f; leftSwipe.ClearTrail(); // Forces both trails to clear rightSwipe.ClearTrail(); break; default: thinkState = 0; break; } } // // ** THIS IS A REALLY TERRIBLE EXAMPLE OF THE CHARACTER MOVING ... (It moves forward when executing a attack) if (thinkState == 3 || thinkState == 7) { transform.position += transform.TransformDirection(Vector3.forward) * t * 3; } else if (thinkState == 11 || thinkState == 10) { transform.position += transform.TransformDirection(Vector3.forward) * t * 0.5f; } // // This rotates the character a based on "facingAngle". It's an experiment to show that the animationController works transform.eulerAngles = new Vector3(transform.eulerAngles.x, Mathf.LerpAngle(transform.eulerAngles.y, facingAngle, 12 * t), transform.eulerAngles.z); }
//关闭残影函数(用于动画关键帧调用) public void TrailStop() { Debug.Log("TrailStop..."); //清除拖尾 TrailObj.ClearTrail(); }
/// <summary> /// 清除拖尾 /// </summary> public void TrailsClear() { myTrail.ClearTrail(); }
public void TrailEnd() { //清除拖尾 myTrail.ClearTrail(); }
// Use this for initialization void Start() { animator = gameObject.GetComponent <Animator> (); animationController.AddTrail(Katana); Katana.ClearTrail(); }
public void hideTrail() { //清除拖尾 myTrail.ClearTrail(); }
public void ClearTrails() { //delete trail myTrail.ClearTrail(); }
void Start() { wt = this.GetComponent <WeaponTrail>(); wt.ClearTrail(); wt.StartTrail(.2f, .2f); }
public void ClearTrail() { //清除拖尾 myTrail.ClearTrail(); }