|
@@ -13,7 +13,7 @@ public struct CreaterControl
|
|
|
public bool isCreated;
|
|
public bool isCreated;
|
|
|
public GameMapTile tile;
|
|
public GameMapTile tile;
|
|
|
public GameMapLayer mapLayer;
|
|
public GameMapLayer mapLayer;
|
|
|
- public int spawnTimeId;
|
|
|
|
|
|
|
+ public SpawnTime spawnTime;
|
|
|
public int waveStartTime;
|
|
public int waveStartTime;
|
|
|
public Vector3 pos;
|
|
public Vector3 pos;
|
|
|
}
|
|
}
|
|
@@ -83,20 +83,24 @@ public class EnemyCreater : MonoBehaviour
|
|
|
|
|
|
|
|
GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
|
|
GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
|
|
|
if (t == null) continue;
|
|
if (t == null) continue;
|
|
|
- for (int j = 0; j < t.spawnTime.Length; j++)
|
|
|
|
|
|
|
+ foreach (SpawnTimeList spawnTimes in t.spawnTime)
|
|
|
{
|
|
{
|
|
|
- if(t.spawnTime[j].curLayer == i - 1)
|
|
|
|
|
|
|
+ if (spawnTimes.curLayer == map.layers[i - 1].id)
|
|
|
{
|
|
{
|
|
|
- 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);
|
|
|
|
|
|
|
+ for (int j = 0; j < spawnTimes.spawnTimes.Length; j++)
|
|
|
|
|
+ {
|
|
|
|
|
+ CreaterControl createrControl = new();
|
|
|
|
|
+ createrControl.isCreated = false;
|
|
|
|
|
+ createrControl.tile = t;
|
|
|
|
|
+ createrControl.spawnTime = spawnTimes.spawnTimes[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);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -108,8 +112,7 @@ public class EnemyCreater : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
for (int i = 0; i < createCharacter.Count; i++)
|
|
for (int i = 0; i < createCharacter.Count; i++)
|
|
|
{
|
|
{
|
|
|
- GameMapTile gameMapTile = createCharacter[i].tile;
|
|
|
|
|
- if (!createCharacter[i].isCreated && gameMapTile.spawnTime[createCharacter[i].spawnTimeId].startTime + createCharacter[i].waveStartTime <= gameTime)
|
|
|
|
|
|
|
+ if (!createCharacter[i].isCreated && createCharacter[i].spawnTime.startTime + createCharacter[i].waveStartTime <= gameTime)
|
|
|
{
|
|
{
|
|
|
CreaterControl createrControl = createCharacter[i];
|
|
CreaterControl createrControl = createCharacter[i];
|
|
|
createrControl.isCreated = true;
|
|
createrControl.isCreated = true;
|
|
@@ -121,7 +124,7 @@ public class EnemyCreater : MonoBehaviour
|
|
|
|
|
|
|
|
public async void StartCreateEnemy(CreaterControl createrControl)
|
|
public async void StartCreateEnemy(CreaterControl createrControl)
|
|
|
{
|
|
{
|
|
|
- SpawnTime spawnTime = createrControl.tile.spawnTime[createrControl.spawnTimeId];
|
|
|
|
|
|
|
+ SpawnTime spawnTime = createrControl.spawnTime;
|
|
|
for (int i = 0; i < spawnTime.num; i++)
|
|
for (int i = 0; i < spawnTime.num; i++)
|
|
|
{
|
|
{
|
|
|
if (!instance)
|
|
if (!instance)
|