|
@@ -64,54 +64,35 @@ public class EnemyCreater : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- public void refreshHasOut(GameMap map)
|
|
|
|
|
- {
|
|
|
|
|
- for (int i = 0; i < map.LayerCount; i++)
|
|
|
|
|
- {
|
|
|
|
|
- int[] grid = map.GetlayerData(i);
|
|
|
|
|
- int idx = 0;
|
|
|
|
|
- for (int y = 0; y < map.height; y++)
|
|
|
|
|
- {
|
|
|
|
|
- for (int x = 0; x < map.width; x++)
|
|
|
|
|
- {
|
|
|
|
|
- GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
|
|
|
|
|
- if (t == null) continue;
|
|
|
|
|
- t.hasOut = false;
|
|
|
|
|
- t.index = -1;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
public void LoadMapAsset(int mapIdx)
|
|
public void LoadMapAsset(int mapIdx)
|
|
|
{
|
|
{
|
|
|
GameMap map = mapsAsset.maps[mapIdx];
|
|
GameMap map = mapsAsset.maps[mapIdx];
|
|
|
- refreshHasOut(map);
|
|
|
|
|
|
|
+
|
|
|
int startTime = 0;
|
|
int startTime = 0;
|
|
|
|
|
+
|
|
|
for (int i = 1; i < map.LayerCount; i++)
|
|
for (int i = 1; i < map.LayerCount; i++)
|
|
|
{
|
|
{
|
|
|
int[] grid = map.GetlayerData(i);
|
|
int[] grid = map.GetlayerData(i);
|
|
|
int idx = 0;
|
|
int idx = 0;
|
|
|
|
|
+
|
|
|
for (int y = 0; y < map.height; y++)
|
|
for (int y = 0; y < map.height; y++)
|
|
|
{
|
|
{
|
|
|
for (int x = 0; x < map.width; x++)
|
|
for (int x = 0; x < map.width; x++)
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
|
|
GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
|
|
|
if (t == null) continue;
|
|
if (t == null) continue;
|
|
|
- if (!t.hasOut)
|
|
|
|
|
|
|
+ for (int j = 0; j < t.spawnTime.Length; j++)
|
|
|
{
|
|
{
|
|
|
- t.hasOut = true;
|
|
|
|
|
- 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, y, 0);
|
|
|
|
|
- createrControl.waveStartTime = startTime;
|
|
|
|
|
- createrControl.mapLayer = map.layers[i - 1];
|
|
|
|
|
- createCharacter.Add(createrControl);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CreaterControl createrControl = new();
|
|
|
|
|
+ createrControl.isCreated = false;
|
|
|
|
|
+ createrControl.tile = t;
|
|
|
|
|
+ createrControl.spawnTimeId = j;
|
|
|
|
|
+ createrControl.pos = new Vector3(x, y, 0);
|
|
|
|
|
+ createrControl.waveStartTime = startTime;
|
|
|
|
|
+ createrControl.mapLayer = map.layers[i - 1];
|
|
|
|
|
+ createCharacter.Add(createrControl);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|