From 5923f1dbb3b8e6ea031565385084b1f86c609b28 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期二, 09 十月 2018 16:01:54 +0800
Subject: [PATCH] 4078 【前端】坐骑、灵宠穿插待机优化
---
Fight/GameActor/GActor.cs | 33 ++++++++++++++++++++++++---------
Fight/GameActor/GActorNpcFight.cs | 19 +++++++++++++------
2 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/Fight/GameActor/GActor.cs b/Fight/GameActor/GActor.cs
index 71ba9fa..423f06c 100644
--- a/Fight/GameActor/GActor.cs
+++ b/Fight/GameActor/GActor.cs
@@ -317,6 +317,7 @@
Vector3 _validPos = Pos;
if (TryGetValidPos(destPos, ref _validPos))
{
+ DestPos = _validPos;
m_SearchType = E_SearchType.Static;
MoveTo(_validPos, keepDist);
}
@@ -424,7 +425,7 @@
return;
}
- Vector3 _curCorner;
+ Vector3 _curCorner = Pos;
// 鑾峰緱褰撳墠鐐�, 涓�鑸殑瀵昏矾閮戒細浜х敓2涓偣
// 绗竴涓偣涓哄璺捣鐐�, 鎵�浠ヨ繖閲屽鏋滄槸绗竴娆″彇
@@ -433,7 +434,11 @@
{
m_CornerIndex = 1;
}
- _curCorner = m_Path.corners[m_CornerIndex];
+
+ if (m_Path.corners != null && m_CornerIndex < m_Path.corners.Length)
+ {
+ _curCorner = m_Path.corners[m_CornerIndex];
+ }
// 璁$畻鍧愭爣宸�
Vector3 _curPos = Pos;
@@ -483,16 +488,11 @@
}
// 鍒ゆ柇鍜岀粓鐐规槸鍚﹀凡缁忚揪鍒颁繚鎸佸�煎緱
- Vector3 _endPos = m_Path.corners[m_Path.corners.Length - 1];
- _chkDistSqrt = MathUtility.DistanceSqrtXZ(_endPos, Pos);
+ _chkDistSqrt = MathUtility.DistanceSqrtXZ(DestPos, Pos);
- if (_chkDistSqrt <= m_KeepDist * m_KeepDist)
+ if ((_chkDistSqrt - m_KeepDist * m_KeepDist) <= .05f)
{
StopPathFind();
- //if (ServerInstID == PlayerDatas.Instance.PlayerId)
- //{
- // Debug.LogFormat("宸插埌杈句繚鎸佽窛绂�: {0} <= {1}", _chkDistSqrt, m_KeepDist * m_KeepDist);
- //}
}
}
}
@@ -585,6 +585,21 @@
}
}
+ public static void ForceCrossFade(Animator animator, int name, float transitionDuration, int layer = 0, float normalizedTime = float.NegativeInfinity)
+ {
+ animator.Update(0);
+ if (animator.GetNextAnimatorStateInfo(layer).fullPathHash == 0)
+ {
+ animator.CrossFade(name, transitionDuration, layer, normalizedTime);
+ }
+ else
+ {
+ animator.Play(animator.GetNextAnimatorStateInfo(layer).fullPathHash, layer);
+ animator.Update(0);
+ animator.CrossFade(name, transitionDuration, layer, normalizedTime);
+ }
+ }
+
/// <summary>
/// 鐭鏈嶅姟绔潗鏍囪嚦瀹㈡埛绔潗鏍�
/// </summary>
diff --git a/Fight/GameActor/GActorNpcFight.cs b/Fight/GameActor/GActorNpcFight.cs
index 874295f..ad5780d 100644
--- a/Fight/GameActor/GActorNpcFight.cs
+++ b/Fight/GameActor/GActorNpcFight.cs
@@ -305,6 +305,11 @@
NextAction = GAStaticDefine.Act_Idle;
}
+ public override void Run()
+ {
+ NextAction = GAStaticDefine.Act_Run;
+ }
+
public override void IdleImmediate()
{
if (m_Animator)
@@ -314,13 +319,11 @@
{
m_Animator.Play(GAStaticDefine.State_IdleHash);
}
- //Debug.LogFormat("璋冪敤浜� {0} 鐨勭珛鍗崇珯绔�", ServerInstID);
+ if (this is GA_Pet)
+ {
+ Debug.LogFormat("璋冪敤浜� {0} 鐨勭珛鍗崇珯绔�", ServerInstID);
+ }
}
- }
-
- public override void Run()
- {
- NextAction = GAStaticDefine.Act_Run;
}
public override void RunImmediate()
@@ -329,6 +332,10 @@
{
Run();
m_Animator.Play(GAStaticDefine.State_RunHash);
+ if (this is GA_Pet)
+ {
+ Debug.LogFormat(" ---- 璋冪敤浜� {0} 鐨勭珛鍗宠窇鍔�", ServerInstID);
+ }
}
}
--
Gitblit v1.8.0