|
@@ -110,14 +110,14 @@ public class EnemyCreater : MonoBehaviour
|
|
|
if (!createdEnemy[id] && createEnemyTime[id][0] <= gameTime)
|
|
if (!createdEnemy[id] && createEnemyTime[id][0] <= gameTime)
|
|
|
{
|
|
{
|
|
|
createdEnemy[id] = true;
|
|
createdEnemy[id] = true;
|
|
|
- StartCreateEnemy(cfgCreateEnemy[i], cfgCreateEnemy[waveIndex]);
|
|
|
|
|
|
|
+ StartCreateEnemy(cfgCreateEnemy[i]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//ÿһÐйÖ
|
|
//ÿһÐйÖ
|
|
|
- public async void StartCreateEnemy(SingleCreateEnemyConfig cfgCreateEnemy, SingleCreateEnemyConfig cfgCreateWave)
|
|
|
|
|
|
|
+ public async void StartCreateEnemy(SingleCreateEnemyConfig cfgCreateEnemy)
|
|
|
{
|
|
{
|
|
|
if (!instance)
|
|
if (!instance)
|
|
|
{
|
|
{
|
|
@@ -127,7 +127,7 @@ public class EnemyCreater : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
int randId = Random.Range(0, cfgCreateEnemy.Position.Count / 2 - 1);
|
|
int randId = Random.Range(0, cfgCreateEnemy.Position.Count / 2 - 1);
|
|
|
Vector3 pos = new Vector3(cfgCreateEnemy.Position[randId * 2], cfgCreateEnemy.Position[randId * 2 + 1], 0);
|
|
Vector3 pos = new Vector3(cfgCreateEnemy.Position[randId * 2], cfgCreateEnemy.Position[randId * 2 + 1], 0);
|
|
|
- CreateEnemy(cfgCreateEnemy, cfgCreateWave, pos, true);
|
|
|
|
|
|
|
+ CreateEnemy(cfgCreateEnemy, pos, true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
int num1 = cfgCreateEnemy.Count / (cfgCreateEnemy.Position.Count / 2);
|
|
int num1 = cfgCreateEnemy.Count / (cfgCreateEnemy.Position.Count / 2);
|
|
@@ -140,7 +140,7 @@ public class EnemyCreater : MonoBehaviour
|
|
|
for (int j = 0; j < cfgCreateEnemy.Position.Count; j += 2)
|
|
for (int j = 0; j < cfgCreateEnemy.Position.Count; j += 2)
|
|
|
{
|
|
{
|
|
|
Vector3 pos = new Vector3(cfgCreateEnemy.Position[j], cfgCreateEnemy.Position[j + 1], 0);
|
|
Vector3 pos = new Vector3(cfgCreateEnemy.Position[j], cfgCreateEnemy.Position[j + 1], 0);
|
|
|
- CreateEnemy(cfgCreateEnemy, cfgCreateWave, pos, true);
|
|
|
|
|
|
|
+ CreateEnemy(cfgCreateEnemy, pos, true);
|
|
|
}
|
|
}
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
@@ -159,12 +159,12 @@ public class EnemyCreater : MonoBehaviour
|
|
|
Vector3 pos = new Vector3(randomPos[randId * 2], randomPos[randId * 2 + 1], 0);
|
|
Vector3 pos = new Vector3(randomPos[randId * 2], randomPos[randId * 2 + 1], 0);
|
|
|
randomPos.Remove(randId * 2 + 1);
|
|
randomPos.Remove(randId * 2 + 1);
|
|
|
randomPos.Remove(randId * 2);
|
|
randomPos.Remove(randId * 2);
|
|
|
- CreateEnemy(cfgCreateEnemy, cfgCreateWave, pos, true);
|
|
|
|
|
|
|
+ CreateEnemy(cfgCreateEnemy,pos, true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- public GameObject CreateEnemy(SingleCreateEnemyConfig cfgCreateEnemy, SingleCreateEnemyConfig cfgCreateWave, Vector3 pos, bool active = false)
|
|
|
|
|
|
|
+ public GameObject CreateEnemy(SingleCreateEnemyConfig cfgCreateEnemy, Vector3 pos, bool active = false)
|
|
|
{
|
|
{
|
|
|
SingleEnemyConfig cfgEnemy = GameManager.instance.allCfgData.CfgEnemy.Get(cfgCreateEnemy.EnemyName);
|
|
SingleEnemyConfig cfgEnemy = GameManager.instance.allCfgData.CfgEnemy.Get(cfgCreateEnemy.EnemyName);
|
|
|
string enemyStr = $"Prefab/{cfgEnemy.Type}/{cfgEnemy.EnemyPrefab}";
|
|
string enemyStr = $"Prefab/{cfgEnemy.Type}/{cfgEnemy.EnemyPrefab}";
|
|
@@ -181,11 +181,11 @@ public class EnemyCreater : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
enemyTower.name = cfgEnemy.Name;
|
|
enemyTower.name = cfgEnemy.Name;
|
|
|
|
|
|
|
|
- enemyTower.totalHp = (int)(cfgEnemy.HP * cfgCreateWave.HPRatio);
|
|
|
|
|
|
|
+ enemyTower.totalHp = (int)(cfgEnemy.HP * cfgCreateEnemy.HPRatio);
|
|
|
enemyTower.hp = enemyTower.totalHp;
|
|
enemyTower.hp = enemyTower.totalHp;
|
|
|
|
|
|
|
|
attackInfo = enemyTower.attackController.attackInfo;
|
|
attackInfo = enemyTower.attackController.attackInfo;
|
|
|
- attackInfo.damage = (int)(cfgEnemy.AttackMarch * cfgCreateWave.AttackRatio);
|
|
|
|
|
|
|
+ attackInfo.damage = (int)(cfgEnemy.AttackMarch * cfgCreateEnemy.AttackRatio);
|
|
|
enemyTower.attackController.attackInfo = attackInfo;
|
|
enemyTower.attackController.attackInfo = attackInfo;
|
|
|
enemyTower.Init();
|
|
enemyTower.Init();
|
|
|
}
|
|
}
|
|
@@ -193,11 +193,11 @@ public class EnemyCreater : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
tower.name = cfgEnemy.Name;
|
|
tower.name = cfgEnemy.Name;
|
|
|
|
|
|
|
|
- tower.totalHp = (int)(cfgEnemy.HP * cfgCreateWave.HPRatio);
|
|
|
|
|
|
|
+ tower.totalHp = (int)(cfgEnemy.HP * cfgCreateEnemy.HPRatio);
|
|
|
tower.hp = tower.totalHp;
|
|
tower.hp = tower.totalHp;
|
|
|
|
|
|
|
|
attackInfo = tower.attackController.attackInfo;
|
|
attackInfo = tower.attackController.attackInfo;
|
|
|
- attackInfo.damage = (int)(cfgEnemy.AttackMarch * cfgCreateWave.AttackRatio);
|
|
|
|
|
|
|
+ attackInfo.damage = (int)(cfgEnemy.AttackMarch * cfgCreateEnemy.AttackRatio);
|
|
|
tower.attackController.attackInfo = attackInfo;
|
|
tower.attackController.attackInfo = attackInfo;
|
|
|
tower.Init();
|
|
tower.Init();
|
|
|
}
|
|
}
|
|
@@ -217,13 +217,13 @@ public class EnemyCreater : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
enemyDic[cfgEnemy.Name].Add(enemy);
|
|
enemyDic[cfgEnemy.Name].Add(enemy);
|
|
|
|
|
|
|
|
- enemy.totalHp = (int)(cfgEnemy.HP * cfgCreateWave.HPRatio);
|
|
|
|
|
|
|
+ enemy.totalHp = (int)(cfgEnemy.HP * cfgCreateEnemy.HPRatio);
|
|
|
enemy.hp = enemy.totalHp;
|
|
enemy.hp = enemy.totalHp;
|
|
|
- enemy.minMoveSpeed = cfgEnemy.MinMoveSpeed * cfgCreateWave.SpeedRatio;
|
|
|
|
|
- enemy.maxMoveSpeed = cfgEnemy.MaxMoveSpeed * cfgCreateWave.SpeedRatio;
|
|
|
|
|
|
|
+ enemy.minMoveSpeed = cfgEnemy.MinMoveSpeed * cfgCreateEnemy.SpeedRatio;
|
|
|
|
|
+ enemy.maxMoveSpeed = cfgEnemy.MaxMoveSpeed * cfgCreateEnemy.SpeedRatio;
|
|
|
|
|
|
|
|
attackInfo = enemy.attackController.attackMethod[0].attackInfo;
|
|
attackInfo = enemy.attackController.attackMethod[0].attackInfo;
|
|
|
- attackInfo.damage = (int)(cfgEnemy.AttackMarch * cfgCreateWave.AttackRatio);
|
|
|
|
|
|
|
+ attackInfo.damage = (int)(cfgEnemy.AttackMarch * cfgCreateEnemy.AttackRatio);
|
|
|
enemy.attackController.attackMethod[0].attackInfo = attackInfo;
|
|
enemy.attackController.attackMethod[0].attackInfo = attackInfo;
|
|
|
|
|
|
|
|
if (enemy.canFly)
|
|
if (enemy.canFly)
|