Browse Source

波次和出怪时间对应(简易版)

wgl 7 months ago
parent
commit
303cdb4a69

+ 1 - 0
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/GameMapTile.cs

@@ -5,6 +5,7 @@ using System;
 [Serializable]
 public struct SpawnTime
 {
+	public int curLayer;
 	public int startTime;
 	public int endTime;
 	public int num;

+ 12 - 8
ActionTowerDefense/Assets/Scripts/EnemyCreater.cs

@@ -85,14 +85,18 @@ public class EnemyCreater : MonoBehaviour
                     if (t == null) continue;
                     for (int j = 0; j < t.spawnTime.Length; j++)
                     {
-                        CreaterControl createrControl = new();
-                        createrControl.isCreated = false;
-                        createrControl.tile = t;
-                        createrControl.spawnTimeId = j;
-                        createrControl.pos = new Vector3(x + UnityEngine.Random.Range(-t.radius.x/2,t.radius.x/2) , y + UnityEngine.Random.Range(-t.radius.y/2,t.radius.y/2), 0);
-                        createrControl.waveStartTime = startTime;
-                        createrControl.mapLayer = map.layers[i - 1];
-                        createCharacter.Add(createrControl);
+                        if(t.spawnTime[j].curLayer == i - 1)
+                        {
+                            CreaterControl createrControl = new();
+                            createrControl.isCreated = false;
+                            createrControl.tile = t;
+                            createrControl.spawnTimeId = j;
+                            createrControl.pos = new Vector3(x + UnityEngine.Random.Range(-t.radius.x / 2, t.radius.x / 2), y + UnityEngine.Random.Range(-t.radius.y / 2, t.radius.y / 2), 0);
+                            createrControl.waveStartTime = startTime;
+                            createrControl.mapLayer = map.layers[i - 1];
+                            createCharacter.Add(createrControl);
+                        }
+
                     }
                 }
             }