生成敌人修改

This commit is contained in:
wulongxiao 2025-01-06 15:16:39 +08:00
parent 30f8df6ca7
commit a8eee193e3
4 changed files with 186 additions and 5 deletions

View File

@ -96,5 +96,141 @@
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3} {"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3}
], ],
"totalReward": 250 "totalReward": 250
},
{
"wave": 6,
"spawnPoint": 1,
"enemies": [
{"id": "Enemy_007", "count": 1, "startTime": 0, "Reward": 8},
{"id": "Enemy_002", "count": 1, "startTime": 3000, "Reward": 3},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_007", "count": 1, "startTime": 3000, "Reward": 8},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_009", "count": 1, "startTime": 3000, "Reward": 8},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5}
],
"totalReward": 250
},
{
"wave": 7,
"spawnPoint": 1,
"enemies": [
{"id": "Enemy_012", "count": 1, "startTime": 0, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_011", "count": 1, "startTime": 500, "Reward": 10},
{"id": "Enemy_012", "count": 1, "startTime": 3000, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_011", "count": 1, "startTime": 500, "Reward": 10},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_011", "count": 1, "startTime": 500, "Reward": 10},
{"id": "Enemy_012", "count": 1, "startTime": 3000, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_011", "count": 1, "startTime": 500, "Reward": 10},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_012", "count": 1, "startTime": 500, "Reward": 5},
{"id": "Enemy_011", "count": 1, "startTime": 500, "Reward": 10}
],
"totalReward": 250
},
{
"wave": 8,
"spawnPoint": 1,
"enemies": [
{"id": "Enemy_010", "count": 1, "startTime": 0, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_008", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 3000, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_008", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 3000, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_008", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 3000, "Reward": 8},
{"id": "Enemy_010", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_005", "count": 1, "startTime": 500, "Reward": 8},
{"id": "Enemy_005", "count": 1, "startTime": 500, "Reward": 8}
],
"totalReward": 250
},
{
"wave": 9,
"spawnPoint": 1,
"enemies": [
{"id": "Enemy_002", "count": 2, "startTime": 0, "Reward": 3},
{"id": "Enemy_003", "count": 2, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 2, "startTime": 500, "Reward": 3},
{"id": "Enemy_003", "count": 2, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 2, "startTime": 500, "Reward": 3},
{"id": "Enemy_003", "count": 2, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 2, "startTime": 500, "Reward": 3},
{"id": "Enemy_003", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_002", "count": 1, "startTime": 500, "Reward": 3},
{"id": "Enemy_010", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_006", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_010", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_006", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_010", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_006", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_010", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_006", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_010", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_006", "count": 2, "startTime": 3000, "Reward": 8},
{"id": "Enemy_006", "count": 2, "startTime": 3000, "Reward": 8}
],
"totalReward": 250
},
{
"wave": 10,
"spawnPoint": 3,
"enemies": [
{"id": "Enemy_004", "count": 3, "startTime": 0, "Reward": 3},
{"id": "Enemy_004", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_004", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_009", "count": 3, "startTime": 500, "Reward": 8},
{"id": "Enemy_004", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_004", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_004", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_003", "count": 3, "startTime": 3000, "Reward": 3},
{"id": "Enemy_003", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_003", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_008", "count": 3, "startTime": 500, "Reward": 8},
{"id": "Enemy_003", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_003", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_003", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_001", "count": 3, "startTime": 3000, "Reward": 3},
{"id": "Enemy_001", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_001", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_006", "count": 3, "startTime": 500, "Reward": 8},
{"id": "Enemy_001", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_001", "count": 3, "startTime": 500, "Reward": 3},
{"id": "Enemy_001", "count": 3, "startTime": 500, "Reward": 3}
],
"totalReward": 250
} }
] ]

View File

@ -14,6 +14,19 @@ public class SpawnMonster : Base
[Header("临时索引")] [Header("临时索引")]
private int index=1; private int index=1;
public int Index
{
get => index;
set
{
index=value;
StartSpawning();
}
}
public List<GameObject> enemysList=new List<GameObject>(); public List<GameObject> enemysList=new List<GameObject>();
private void Awake() private void Awake()

View File

@ -28,7 +28,18 @@ public class UIContorl : Base
} }
} }
public Text KIllNumberText; public Text KIllNumberText;
public int maxEnemynumber; private int maxEnemynumber;
public int MaxEnemynumber
{
get => maxEnemynumber;
set
{
maxEnemynumber = value;
Debug.Log("maxEnemynumber:" + maxEnemynumber);
this.KIllNumberText.text = killnumber + "/" + maxEnemynumber;
}
}
private int killnumber; private int killnumber;
public int Killnumber public int Killnumber
{ {
@ -57,10 +68,15 @@ public class UIContorl : Base
private float timeElapsed = 0f; // 记录经过的时间 private float timeElapsed = 0f; // 记录经过的时间
private bool isTimerRunning = false; // 控制计时器是否运行 private bool isTimerRunning = false; // 控制计时器是否运行
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Awake()
{ {
if (instance != null) return; if (instance != null) return;
instance = this; instance = this;
}
void Start()
{
//FightBtn.onClick.AddListener(FightClick); //FightBtn.onClick.AddListener(FightClick);
Battle_Time.text = "00:00"; Battle_Time.text = "00:00";

View File

@ -8,10 +8,27 @@ public class MapLevelJsonRead : JsonReadBase
public List<Wave> waves; public List<Wave> waves;
public TextAsset MapLevelJson; public TextAsset MapLevelJson;
public int count = 0;
void Awake() void Awake()
{ {
instance=this; instance = this;
waves = base.LoadJson<Wave>(MapLevelJson); waves = base.LoadJson<Wave>(MapLevelJson);
}
void Start()
{
foreach (Wave value in waves)
{
count += value.enemies.Count;
Debug.Log("一个:" + value.enemies.Count);
}
Debug.Log("总:" + this.count);
UIContorl.instance.MaxEnemynumber = this.count;
} }
} }
@ -29,5 +46,4 @@ public struct Wave
public int spawnPoint; // 生成点 public int spawnPoint; // 生成点
public List<maplevel_enemy> enemies; // 敌人列表 public List<maplevel_enemy> enemies; // 敌人列表
public int totalReward; // 总奖励 public int totalReward; // 总奖励
} }