Explorar el Código

起跳距离调整,还有被击中后的触发的攻击玩家行为不需要伏击动作

lvjincheng hace 4 años
padre
commit
799db2f5b6
Se han modificado 1 ficheros con 11 adiciones y 6 borrados
  1. 11 6
      Assets/BowArrow/Scenes/GameChallengeScene/Wolf.cs

+ 11 - 6
Assets/BowArrow/Scenes/GameChallengeScene/Wolf.cs

@@ -112,6 +112,7 @@ public class Wolf : TargetAnimal
                 CancelLockTarget();
                 state.ResetActionState();
                 state.lockingTarget = true;
+                needAmbush = false;
             } else {
                 CancelLockTarget(1);
                 RunAwayFromHunter();
@@ -227,6 +228,7 @@ public class Wolf : TargetAnimal
         this.transform.LookAt(hunterPosition);
     }
 
+    bool needAmbush = true;
     //攻击
     void Attack() {
         state.ResetActionState();
@@ -252,16 +254,19 @@ public class Wolf : TargetAnimal
             }, 1f, Quaternion.Angle(ambushQuaStart, ambushQuaEnd) / 180f * 0.5f));
             seq.AppendCallback(delegate() {
                 state.ambushRotating = false;
-                state.ambushing = true;
+                if (needAmbush) state.ambushing = true;
             });
-            seq.Append(DOTween.To(() => 0f, value => {
-                LookAtHunter();
-            }, 1f, 2f));
+            if (needAmbush) {
+                seq.Append(DOTween.To(() => 0f, value => {
+                    LookAtHunter();
+                }, 1f, 2f));
+            }
             seq.AppendCallback(delegate() {
                 if (state.dead) {
                     seq.Kill();
                     return;
                 }
+                needAmbush = true;
                 state.ambushing = false;
                 state.attackA = true;
                 #region //起点和终点计算
@@ -327,8 +332,8 @@ public class Wolf : TargetAnimal
         //     needDistance = 2;
         //     canAttackID = "B";
         // } else {
-            displace = Quaternion.AngleAxis(Random.Range(-18f, 18f), Vector3.up) * displace;
-            needDistance = 10;
+            displace = Quaternion.AngleAxis(Random.Range(-33f, 33f), Vector3.up) * displace;
+            needDistance = 8.8f;
             canAttackID = "A";
         // }
         Vector3 newPos = animalsBaseT.position + displace * needDistance;