/// <summary> /// 获取最后的飞行方向 /// </summary> public float GetFlyDirAngel() { float angle = Vector3.Angle(m_FlyDir, Vector3.left); angle = Vector3.Dot(m_FlyDir, Vector3.up) < 0 ? angle : -angle; angle = NdUtil.ClampAngle(angle, 0, 360f); return(angle); }
public override void Update() { base.Update(); if (m_TimeCount < m_fDelay) { m_LifePrent.m_thisT.transform.position = start; return; } if (m_TimeCount < (m_fDelay + 3.02f)) { if ((m_TimeCount - m_Delatime) <= m_fDelay) { SoundPlay.Play("back_ship", false, false); //SkillEffects._instance.LoadEffect("effect/prefab/", "2000201", start, 1.5f, dolphineDir); GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", m_effectName, start, null); if (gae != null) { GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit(); //effectinit.SetEffectMirror(dolphineDir); gae.AddAction(effectinit); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.5f); gae.AddAction(ndEffect); } } Vector3 pos = bezier.GetPointAtTime((m_TimeCount - m_fDelay) / 3.0f); float Angles = NdUtil.V2toAngle(pos, bezier.GetPointAtTime((m_TimeCount - m_fDelay) / 3.0f + 0.01f), Vector3.right) + 180; m_curangle = NdUtil.ClampAngle(Angles + 180, 0, 360f); //Debug.Log(m_curangle); if (m_bRotate) { if (dolphineDir == WalkDir.WALKRIGHT) { m.SetAngle(-Angles); } else { m.SetAngle(Angles); } } PlayAction(AnimatorState.Fly00000, pos, true); //NGUIUtil.DebugLog(m_TimeCount.ToString()); //if (m_TimeCount >= 0.4f && m_TimeCount < 0.4f +Time.deltaTime) //{ // m_Skin.ProPerty.EnableTrail(true); //} } else { //PlayAction(AnimatorState.Fly00000, bezier.GetPointAtTime(1), true); //MoveAction(AnimatorState.Fly00000, Vector3.down * m_LifePrent.m_Attr.Flyspeed * Time.deltaTime, ActionMode.Delta); MoveAction(AnimatorState.Fly00000, Vector3.down * 10 * Time.deltaTime, ActionMode.Delta); } }
public void SetAngle(float angle) { angle += 180f; if (m_fCurrentAngle != angle) { //m_fRotatetime += Time.deltaTime; float temp = 0; if (m_bFirstPathing) { m_bFirstPathing = false; temp = m_fCurrentAngle = angle; } else { float fa = angle - m_fCurrentAngle; if (fa > 180) { fa = fa - 360; } else if (fa < -180) { fa = 360 + fa; } temp = fa; //Mathf.Lerp(0,fa,0.1f ); m_fCurrentAngle += temp; m_fCurrentAngle = NdUtil.ClampAngle(m_fCurrentAngle, 0, 360f); } { transform.Rotate(new Vector3(0, 0, -temp), Space.Self); } if (m_bParticleRotate) { if (ps != null) { foreach (ParticleSystem p in ps) { p.startRotation = angle * Mathf.PI / 180f; //Debug.Log ("p.startRotation:" + p.startRotation + "," + p.gameObject); //p.startRotation = 0.25f; } } } } }