Преглед изворни кода

肉鸽刷怪新逻辑尝试

WGL пре 3 месеци
родитељ
комит
380bc506ae

+ 16 - 1
ActionTowerDefense/Assets/Resources/Prefab/Player.prefab

@@ -5688,10 +5688,12 @@ MonoBehaviour:
   targetCharacter: {fileID: 0}
   attackTarget: {fileID: 0}
   state: 1
-  totalHp: 10000
+  totalHp: 500
   hp: 0
   canFly: 0
+  canControlFly: 0
   nowCanFly: 0
+  canNotShotDown: 1
   canNotAddForce: 0
   canNotChangeHurt: 0
   isDie: 0
@@ -5971,6 +5973,7 @@ MonoBehaviour:
     blowUp:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0
@@ -5979,6 +5982,7 @@ MonoBehaviour:
     shotDown:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0
@@ -6030,6 +6034,7 @@ MonoBehaviour:
       blowUp:
         directionType: 0
         dir: {x: 0, y: 0, z: 0}
+        dirRandom: {x: 0, y: 0, z: 0}
         force: 0
         time: 0
         haveLandingDamage: 0
@@ -6038,6 +6043,7 @@ MonoBehaviour:
       shotDown:
         directionType: 0
         dir: {x: 0, y: 0, z: 0}
+        dirRandom: {x: 0, y: 0, z: 0}
         force: 0
         time: 0
         haveLandingDamage: 0
@@ -6094,6 +6100,7 @@ MonoBehaviour:
       blowUp:
         directionType: 0
         dir: {x: 0, y: 0, z: 0}
+        dirRandom: {x: 0, y: 0, z: 0}
         force: 0
         time: 0
         haveLandingDamage: 0
@@ -6102,6 +6109,7 @@ MonoBehaviour:
       shotDown:
         directionType: 0
         dir: {x: 0, y: 0, z: 0}
+        dirRandom: {x: 0, y: 0, z: 0}
         force: 0
         time: 0
         haveLandingDamage: 0
@@ -6570,6 +6578,7 @@ MonoBehaviour:
     blowUp:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0
@@ -6578,6 +6587,7 @@ MonoBehaviour:
     shotDown:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0
@@ -6609,6 +6619,7 @@ MonoBehaviour:
   flyingRotateSpeedRange: {x: 15, y: 45}
   compressionDegree: 0.8
   compressionSpeed: {x: 0.2, y: 1}
+  jumpVel: 5
   haveVulnerable: 0
   vulnerableTime: 0
   stackingWoudsTime: 0
@@ -6651,6 +6662,7 @@ MonoBehaviour:
     blowUp:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0
@@ -6659,6 +6671,7 @@ MonoBehaviour:
     shotDown:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0
@@ -7040,6 +7053,7 @@ MonoBehaviour:
     blowUp:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0
@@ -7048,6 +7062,7 @@ MonoBehaviour:
     shotDown:
       directionType: 0
       dir: {x: 0, y: 0, z: 0}
+      dirRandom: {x: 0, y: 0, z: 0}
       force: 0
       time: 0
       haveLandingDamage: 0

+ 11 - 3
ActionTowerDefense/Assets/Scenes/Game.unity

@@ -20828,11 +20828,14 @@ MonoBehaviour:
   - {fileID: 1464883273}
   - {fileID: 1934719935}
   text: {fileID: 1634269188}
-  chapterBG: {fileID: 0}
+  chapterBG: {fileID: 7247696832750846}
   leveType: 0
   nextLevelButton: {fileID: 2041973834}
   isGaming: 0
-  ratioIncrease: 0.4
+  ratioIncrease:
+  - 0.4
+  - 1.6
+  - -0.8
   levelRatio: 1
 --- !u!4 &1714821086
 Transform:
@@ -20890,7 +20893,7 @@ MonoBehaviour:
   levelIdA_debug: 8
   levelIdB_debug: 2
   curLevel: {fileID: 741372831}
-  curLevelID: 4
+  curLevelID: 0
   levels:
   - "0:9\u54081\u5173\u5361\u5C1D\u8BD5"
   - "1:\u6C34\u9762\u5173\u53612"
@@ -22667,6 +22670,11 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 956ff4379e83d3c49a9c10310dbf7cc7, type: 3}
+--- !u!1 &7247696832750846 stripped
+GameObject:
+  m_CorrespondingSourceObject: {fileID: 7247696002149724, guid: 956ff4379e83d3c49a9c10310dbf7cc7, type: 3}
+  m_PrefabInstance: {fileID: 7247696832750845}
+  m_PrefabAsset: {fileID: 0}
 --- !u!114 &7709371648474228
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 91 - 30
ActionTowerDefense/Assets/Scripts/EnemyCreater.cs

@@ -232,23 +232,106 @@ public class EnemyCreater : MonoBehaviour
     }
 
     //计算是九个出怪表中的哪个出怪表
-    public void GetLevelOrientation()
+    public void GetLevelOrientation(int id)
     {
         List<int> soldierRank = new List<int>();
         for(int i = 0; i < 3; i++)
         {
             soldierRank.Add(SoldierEXP.expInstance.ssexp[i].level);
         }
-        int maxId = MaxSoldierLevel(soldierRank);
-        List<int> typeDir = new List<int> { 6, 4, 1 };
-        for(int i = 0; i < 2; i++)
+        List<List<int>> idSort = new List<List<int>>();
+        if (soldierRank[0] == soldierRank[1])
         {
-            levelTypes[i] = (typeDir[maxId] + 4 * i + Random.Range(-1, 2)+8)%8;
-            if(levelTypes[i] == 0)
+            idSort.Add(new List<int> { 0, 1 });
+            if (soldierRank[2] == idSort[0][0])
             {
-                levelTypes[i] = 8;
+                idSort[0].Add(2);
+            }
+            else if (soldierRank[2] > idSort[0][0])
+            {
+                idSort.Insert(0, new List<int> { 2 });
+            }
+            else
+            {
+                idSort.Add(new List<int> { 2 });
+            }
+        }
+        else
+        {
+            if (soldierRank[0] > soldierRank[1])
+            {
+                idSort.Add(new List<int> { 0 });
+                idSort.Add(new List<int> { 1 });
+            }
+            else
+            {
+                idSort.Add(new List<int> { 1 });
+                idSort.Add(new List<int> { 0 });
+            }
+            for(int i = 0; i < 2; i++)
+            {
+                if(soldierRank[2] > idSort[i][0])
+                {
+                    idSort.Insert(i, new List<int> { 2 });
+                    break;
+                }
+                if(soldierRank[2] == idSort[i][0])
+                {
+                    idSort[i].Add(2);
+                    break;
+                }
+                if(i == 1)
+                {
+                    idSort.Add(new List<int> { 2 });
+                }
             }
-            
+        }
+
+        List<int> idList = new List<int> { 6,4,1 };
+        int x0;
+        int x1;
+        switch (idSort.Count)
+        {
+            case 1:
+                levelTypes[id] = Random.Range(1, 9); 
+                break;
+            case 2:
+                switch (idSort[id].Count)
+                {
+                    case 1:
+                        levelTypes[id] = idList[idSort[id][0]];
+                        break;
+                    case 2:
+                        x0 = idSort[id][0];
+                        x1 = idSort[id][1];
+                        if(x0 == 0 && x1 == 2)
+                        {
+                            levelTypes[id] = Random.Range(7, 9);
+                        }
+                        else
+                        {
+                            levelTypes[id] = Random.Range(idList[x1] + 1, idList[x0]);
+                        }
+                        break;
+                }
+                break;
+            case 3:
+                x0 = Mathf.Min(idSort[0 + id * 2][0], idSort[1][0]);
+                x1 = Mathf.Max(idSort[0 + id * 2][0], idSort[1][0]);
+                if (x0 == 0 && x1 == 2)
+                {
+                    levelTypes[id] = Random.Range(7, 9);
+                }
+                else
+                {
+                    levelTypes[id] = Random.Range(idList[x1] + 1, idList[x0]);
+                }
+                break;
+        }
+
+        if (id == 1 && levelTypes[1] == levelTypes[0])
+        {
+            GetLevelOrientation(1);
         }
     }
 
@@ -364,28 +447,6 @@ public class EnemyCreater : MonoBehaviour
         }
     }
 
-    //比较三个值里的最大值为哪个,等级相同则随机一个
-    public int MaxSoldierLevel(List<int> soldierRank)
-    {
-        int a = soldierRank[0];
-        int b = soldierRank[1];
-        int c = soldierRank[2];
-        int max = Mathf.Max(a, Mathf.Max(b, c)); // 先找到最大值
-
-        // 收集所有等于最大值的变量名(可能有多个)
-        List<int> maxVariables = new List<int>();
-
-        if (a == max) maxVariables.Add(0);
-        if (b == max) maxVariables.Add(1);
-        if (c == max) maxVariables.Add(2);
-
-        // 随机选择一个(如果有多个最大值)
-        
-        int maxID = maxVariables[Random.Range(0, maxVariables.Count)];
-        Debug.Log($"等级:{a};{b};{c},取{maxID}");
-        return maxID;
-    }
-
     //出怪表每一行怪
     public void CreateEnemy(SingleCreateEnemyConfig cfg, Vector3 pos, bool active = false)
     {

+ 8 - 3
ActionTowerDefense/Assets/Scripts/GameManager.cs

@@ -30,7 +30,7 @@ public class GameManager : MonoBehaviour
     public LeveType leveType;
     public GameObject nextLevelButton;
     public bool isGaming;
-    [LabelText("下一关倍率增幅")] public float ratioIncrease = 0.4f;
+    [LabelText("下一关倍率增幅")] public List<float> ratioIncrease = new List<float> { 0.4f,1.6f,-0.8f};
     [DisplayOnly] public float levelRatio = 1;
 
     private JSONNode Loader(string fileName)
@@ -105,6 +105,7 @@ public class GameManager : MonoBehaviour
             {
                 if (objs[i].gameObject.activeSelf)
                 {
+                    objs[i].killer = null;
                     objs[i].ChangeState(CharacterState.Die);
                 }
             }
@@ -122,18 +123,22 @@ public class GameManager : MonoBehaviour
     {
         nextLevelButton.SetActive(false);
 
-        levelRatio += ratioIncrease;
+        
         switch (leveType)
         {
             case LeveType.Introduction:
-                EnemyCreater.instance.GetLevelOrientation();
+                EnemyCreater.instance.GetLevelOrientation(0);
                 leveType = LeveType.Development;
+                levelRatio += ratioIncrease[0];
                 break;
             case LeveType.Development:
+                EnemyCreater.instance.GetLevelOrientation(1);
                 leveType = LeveType.Transition;
+                levelRatio += ratioIncrease[1];
                 break;
             case LeveType.Transition:
                 leveType = LeveType.Conclusion;
+                levelRatio += ratioIncrease[2];
                 break;
         }
         PlayersInput.instance[0].PlayerRevive();

+ 23 - 23
ActionTowerDefense/GenerateDatas/json/cfgcreateenemy6.json

@@ -62,14 +62,14 @@
     "WaveTime": 0,
     "BuildingID": "塔1",
     "BuildingHP": 99,
-    "EnemyName": "猪",
+    "EnemyName": "猪",
     "Position": [
       51,
       1
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 2,
+    "Count": 5,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -89,7 +89,7 @@
     ],
     "StartTime": 0,
     "EndTime": 3,
-    "Count": 3,
+    "Count": 2,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -109,7 +109,7 @@
     ],
     "StartTime": 0,
     "EndTime": 3,
-    "Count": 4,
+    "Count": 3,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -129,7 +129,7 @@
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 2,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -142,14 +142,14 @@
     "WaveTime": 0,
     "BuildingID": "",
     "BuildingHP": 0,
-    "EnemyName": "猪",
+    "EnemyName": "猪",
     "Position": [
       56,
       1
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 4,
+    "Count": 10,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -169,7 +169,7 @@
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 4,
+    "Count": 2,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -182,14 +182,14 @@
     "WaveTime": 0,
     "BuildingID": "",
     "BuildingHP": 0,
-    "EnemyName": "飞胖",
+    "EnemyName": "小猪",
     "Position": [
       57,
       1
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 10,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -202,14 +202,14 @@
     "WaveTime": 15,
     "BuildingID": "",
     "BuildingHP": 0,
-    "EnemyName": "飞胖",
+    "EnemyName": "小猪",
     "Position": [
       56,
       1
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 2,
+    "Count": 5,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -229,7 +229,7 @@
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 2,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -249,7 +249,7 @@
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 2,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -262,14 +262,14 @@
     "WaveTime": 0,
     "BuildingID": "",
     "BuildingHP": 0,
-    "EnemyName": "猪",
+    "EnemyName": "猪",
     "Position": [
       57,
       1
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 2,
+    "Count": 10,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -289,7 +289,7 @@
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 5,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -329,7 +329,7 @@
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 2,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -342,14 +342,14 @@
     "WaveTime": 0,
     "BuildingID": "",
     "BuildingHP": 0,
-    "EnemyName": "猪",
+    "EnemyName": "猪",
     "Position": [
       57,
       1
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 2,
+    "Count": 10,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -362,14 +362,14 @@
     "WaveTime": 15,
     "BuildingID": "",
     "BuildingHP": 0,
-    "EnemyName": "飞胖",
+    "EnemyName": "小猪",
     "Position": [
       56,
       1
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 10,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,
@@ -389,7 +389,7 @@
     ],
     "StartTime": 0,
     "EndTime": 10,
-    "Count": 3,
+    "Count": 2,
     "AttackRatio": 1,
     "SpeedRatio": 1,
     "HPRatio": 1,

+ 1 - 1
ActionTowerDefense/GenerateDatas/json/cfgenemy.json

@@ -187,7 +187,7 @@
     ],
     "HP": 40,
     "AttackSummon": 0,
-    "AttackMarch": 6,
+    "AttackMarch": 1,
     "MinMoveSpeed": 8,
     "MaxMoveSpeed": 12
   }

BIN
ActionTowerDefense/Luban/Config/Datas/EnemyCreater/出怪表0.xlsx


BIN
ActionTowerDefense/Luban/Config/Datas/EnemyCreater/出怪表6.xlsx


BIN
ActionTowerDefense/Luban/Config/Datas/怪物表.xlsx