lvjincheng 4 years ago
parent
commit
f3b0391d3d

+ 13 - 0
Assets/ArtAsset/Hunter/Models/Wolf/Wolf.prefab

@@ -386,6 +386,19 @@ MonoBehaviour:
   materials:
   materials:
   - {fileID: 2100000, guid: 2bf5c8f02e98cc94eb6b43d7e20f0228, type: 2}
   - {fileID: 2100000, guid: 2bf5c8f02e98cc94eb6b43d7e20f0228, type: 2}
   - {fileID: 2100000, guid: 5070ee3c30b7f2f42a9f29ae31c97306, type: 2}
   - {fileID: 2100000, guid: 5070ee3c30b7f2f42a9f29ae31c97306, type: 2}
+  state:
+    hp: 1
+    staying: 1
+    moving: 0
+    moveSlowly: 0
+    moveQuickly: 0
+    attacking: 0
+    attackA: 0
+    attackB: 0
+    dead: 0
+    stayingTime: 0
+    movingTime: 0
+    lockingTarget: 0
 --- !u!1 &1105603400764975652
 --- !u!1 &1105603400764975652
 GameObject:
 GameObject:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0

+ 3 - 3
Assets/BowArrow/Scenes/GameChallengeScene/GameChallenge.unity

@@ -20400,7 +20400,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 28.636137, y: 0}
   m_SizeDelta: {x: 0, y: 33}
   m_SizeDelta: {x: 0, y: 33}
   m_Pivot: {x: 0.5, y: 0.5}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1047161075
 --- !u!114 &1047161075
@@ -23854,7 +23854,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 28.636137, y: 0}
   m_SizeDelta: {x: 0, y: 33}
   m_SizeDelta: {x: 0, y: 33}
   m_Pivot: {x: 0.5, y: 0.5}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1203594963
 --- !u!114 &1203594963
@@ -41934,7 +41934,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 47.272274, y: 0}
   m_SizeDelta: {x: 0, y: 33}
   m_SizeDelta: {x: 0, y: 33}
   m_Pivot: {x: 0.5, y: 0.5}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &2142579590
 --- !u!114 &2142579590

+ 7 - 4
Assets/BowArrow/Scenes/GameChallengeScene/Wolf.cs

@@ -104,6 +104,7 @@ public class Wolf : TargetAnimal
     float autoMovingTime;
     float autoMovingTime;
     bool willAttack = false;
     bool willAttack = false;
     bool hasRunAround = false;
     bool hasRunAround = false;
+    int needRunAroundCount = 0;
     bool hasRunToHunter = false;
     bool hasRunToHunter = false;
     //帧更新逻辑-自动策略
     //帧更新逻辑-自动策略
     void UpdateAutoStrategy() {
     void UpdateAutoStrategy() {
@@ -122,9 +123,11 @@ public class Wolf : TargetAnimal
                 if (willAttack) {
                 if (willAttack) {
                     willAttack = false;
                     willAttack = false;
                     Attack();
                     Attack();
+                    needRunAroundCount = 3;
                     return;
                     return;
                 }
                 }
-                if (Random.value > 0.5f) {
+                if (needRunAroundCount > 0) {
+                    needRunAroundCount--;
                     RunAroundHunter();
                     RunAroundHunter();
                     hasRunAround = true;
                     hasRunAround = true;
                     return;
                     return;
@@ -196,11 +199,11 @@ public class Wolf : TargetAnimal
     }
     }
     //在敌人身边奔跑徘徊
     //在敌人身边奔跑徘徊
     void RunAroundHunter() {
     void RunAroundHunter() {
-        float baseDistance = 2;
-        float baseDistanceMoveRange = 5;
+        float baseDistance = 7;
+        float baseDistanceMoveRange = 7;
         Vector3 standardPointer = animalsBaseT.forward;
         Vector3 standardPointer = animalsBaseT.forward;
         Vector3 pointerWithLen = standardPointer.normalized * (baseDistance + Random.value * baseDistanceMoveRange);
         Vector3 pointerWithLen = standardPointer.normalized * (baseDistance + Random.value * baseDistanceMoveRange);
-        pointerWithLen = Quaternion.AngleAxis(-80f + Random.value * 160f, Vector3.up) * pointerWithLen;
+        pointerWithLen = Quaternion.AngleAxis(-60f + Random.value * 120f, Vector3.up) * pointerWithLen;
         Vector3 newPos = animalsBaseT.position + pointerWithLen;
         Vector3 newPos = animalsBaseT.position + pointerWithLen;
         SetDestination(newPos);
         SetDestination(newPos);
         state.moveQuickly = true;
         state.moveQuickly = true;

+ 11 - 4
Assets/BowArrow/Scenes/GameChallengeScene/WolfHuntGameMode.cs

@@ -51,9 +51,11 @@ public class WolfHuntGameMode : ChallengeGameMode
             animalCreateList = new int[]{1, 1, 1, 1, 2, 2, 2, 2};
             animalCreateList = new int[]{1, 1, 1, 1, 2, 2, 2, 2};
         }
         }
         if (animalCreateList != null) animalCountMax = animalCount = animalCreateList.Length;
         if (animalCreateList != null) animalCountMax = animalCount = animalCreateList.Length;
+        canStartCreateAniaml = true;
     }
     }
 
 
     float baseCreateDistance = 25;
     float baseCreateDistance = 25;
+    // float baseCreateDistance = 15;
     float plusCreateDistance = 0;
     float plusCreateDistance = 0;
 
 
     void CreateAnimal() {
     void CreateAnimal() {
@@ -85,14 +87,16 @@ public class WolfHuntGameMode : ChallengeGameMode
         animalSet.Add(wolf);
         animalSet.Add(wolf);
     }
     }
 
 
+    bool canStartCreateAniaml = false;
     float timeForCreateAnimal = 0;
     float timeForCreateAnimal = 0;
     public override void Update()
     public override void Update()
     {
     {
         base.Update();
         base.Update();
-        if (gameMgr.gameOver || pauseTimeCounting) return;
-        timeForCreateAnimal += Time.deltaTime;
-        if ((int)(timeForCreateAnimal / 6) >= animalCreateIndex) {
-            CreateAnimal();
+        if (!gameMgr.gameOver && canStartCreateAniaml) {
+            timeForCreateAnimal += Time.deltaTime;
+            if ((int)(timeForCreateAnimal / 6) >= animalCreateIndex) {
+                CreateAnimal();
+            }
         }
         }
     }
     }
 
 
@@ -101,11 +105,14 @@ public class WolfHuntGameMode : ChallengeGameMode
     public void OnAttacked(Wolf wolf, int hurtValue) {
     public void OnAttacked(Wolf wolf, int hurtValue) {
         if (hp <= 0) return;
         if (hp <= 0) return;
         AudioMgr.ins.PlayAnimalEffect("man_injured", AudioMgr.GetAudioSource(this.gameMgr.gameObject));
         AudioMgr.ins.PlayAnimalEffect("man_injured", AudioMgr.GetAudioSource(this.gameMgr.gameObject));
+
+        //看下是否满足受伤距离
         Vector3 p1 = wolf.transform.position;
         Vector3 p1 = wolf.transform.position;
         Vector3 p2 = hunterT.position;
         Vector3 p2 = hunterT.position;
         p1.y = p2.y = 0;
         p1.y = p2.y = 0;
         float distance = Vector3.Distance(p1, p2);
         float distance = Vector3.Distance(p1, p2);
         if (distance > 3) return;
         if (distance > 3) return;
+
         hp -= hurtValue;
         hp -= hurtValue;
         DoTweenHurt();
         DoTweenHurt();
         if (hp <= 0) {
         if (hp <= 0) {