|
|
@@ -5,23 +5,30 @@ using cfg;
|
|
|
using System.Threading.Tasks;
|
|
|
using Base.Common;
|
|
|
using System.Linq;
|
|
|
+using System;
|
|
|
+
|
|
|
+[Serializable]
|
|
|
+public struct CreaterControl
|
|
|
+{
|
|
|
+ public bool isCreated;
|
|
|
+ public GameMapTile tile;
|
|
|
+ public int spawnTimeId;
|
|
|
+ public Vector3 pos;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
public class EnemyCreater : MonoBehaviour
|
|
|
{
|
|
|
public static EnemyCreater instance;
|
|
|
- [SerializeField]public List<SingleCreateEnemyConfig> cfgCreateEnemy;
|
|
|
- public List<SingleCreateBuildingConfig> cfgCreateBuilding;
|
|
|
- public List<bool> createdEnemy;
|
|
|
- public List<float> createEnemyTime;
|
|
|
- public List<bool> createdBuilding;
|
|
|
- public List<float> createBuildingTime;
|
|
|
+ public List<CreaterControl> createCharacter = new();
|
|
|
public Dictionary<int, List<Enemy>> enemyDic;
|
|
|
- public Dictionary<int, GameObject> buildingDic;
|
|
|
+ public Dictionary<int, List<GameObject>> buildingDic;
|
|
|
private LevelSelect.Level curLevel;
|
|
|
+ public GameMapsAsset mapsAsset;
|
|
|
+
|
|
|
+ //import
|
|
|
+ public LevelSelect levelSelect;
|
|
|
|
|
|
- [Header("传送门")]
|
|
|
- public float portalsCreateTime = 10; //传送门提前出现时间
|
|
|
- public Transform portalUIParent; //传送门出现提示UI的父物体
|
|
|
|
|
|
private void Awake()
|
|
|
{
|
|
|
@@ -35,145 +42,70 @@ public class EnemyCreater : MonoBehaviour
|
|
|
return;
|
|
|
}
|
|
|
enemyDic = new Dictionary<int, List<Enemy>>();
|
|
|
- buildingDic = new Dictionary<int, GameObject>();
|
|
|
+ buildingDic = new Dictionary<int, List<GameObject>>();
|
|
|
}
|
|
|
|
|
|
private void Start()
|
|
|
{
|
|
|
- curLevel = GetComponent<LevelSelect>().levelConfig[GetComponent<LevelSelect>().curLevelID - 1];
|
|
|
- cfgCreateEnemy = GameManager.instance.allCfgData.CfgCreateEnemy.DataList;
|
|
|
- cfgCreateBuilding = GameManager.instance.allCfgData.CfgCreateBuilding.DataList;
|
|
|
- createdEnemy = new List<bool>();
|
|
|
- createdBuilding = new List<bool>();
|
|
|
- for (int i = 0; i < cfgCreateEnemy.Count; i++)
|
|
|
- {
|
|
|
- createdEnemy.Add(false);
|
|
|
- createEnemyTime.Add(cfgCreateEnemy[i].Time);
|
|
|
- }
|
|
|
- for (int i = 0; i < cfgCreateBuilding.Count; i++)
|
|
|
- {
|
|
|
- createdBuilding.Add(false);
|
|
|
- createBuildingTime.Add(cfgCreateBuilding[i].Time);
|
|
|
- }
|
|
|
+ levelSelect = GetComponent<LevelSelect>();
|
|
|
+ curLevel = GetComponent<LevelSelect>().levelConfig[levelSelect.curLevelID - 1];
|
|
|
+ LoadMapAsset(0);
|
|
|
|
|
|
//把所有怪物prefab生成一遍防止后面初次生成卡顿
|
|
|
- foreach (var item in GameManager.instance.allCfgData.CfgEnemy.DataMap)
|
|
|
- {
|
|
|
- SingleEnemyConfig cfgEnemy = item.Value;
|
|
|
- GameObject enemyObj = CreateEnemy(cfgEnemy.ID, Vector3.zero, 1, 1);
|
|
|
- enemyObj.SetActive(false);
|
|
|
- }
|
|
|
+ //foreach (var item in createCharacter)
|
|
|
+ //{
|
|
|
+ // for(int i = 0; i < item.tile.spawnTime[item.spawnTimeId].num; i++)
|
|
|
+ // {
|
|
|
+ // CreateEnemy(item.tile, Vector3.zero, 1, 1,false);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
- public void OnGameTimeChange(float gameTime)
|
|
|
+
|
|
|
+ public void refreshHasOut(GameMap map)
|
|
|
{
|
|
|
- for (int i = 0; i < cfgCreateEnemy.Count; i++)
|
|
|
+ for (int i = 0; i < map.LayerCount; i++)
|
|
|
{
|
|
|
- if (cfgCreateEnemy[i].LevelID == curLevel.enemyExcelID)
|
|
|
+ int[] grid = map.GetlayerData(i);
|
|
|
+ int idx = 0;
|
|
|
+ for (int y = 0; y < map.height; y++)
|
|
|
{
|
|
|
- if (createEnemyTime[i] != 0)
|
|
|
- {
|
|
|
- if (createEnemyTime[i] + cfgCreateEnemy[i].DelayTime <= gameTime && !createdEnemy[i])
|
|
|
- {
|
|
|
- createdEnemy[i] = true;
|
|
|
- StartCreateEnemy(i);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ for (int x = 0; x < map.width; x++)
|
|
|
{
|
|
|
- GameObject result = null;
|
|
|
- buildingDic.TryGetValue(cfgCreateEnemy[i].BuildingID, out result);
|
|
|
- if (result != null)
|
|
|
- {
|
|
|
- //根据防御塔血量出怪
|
|
|
- EnemyTower enemyTower = result.GetComponent<EnemyTower>();
|
|
|
- if (enemyTower != null && !createdEnemy[i] && enemyTower.hp * 100 <= enemyTower.totalHp * cfgCreateEnemy[i].BuildingHP)
|
|
|
- {
|
|
|
- if (cfgCreateEnemy[i].DelayTime == 0)
|
|
|
- {
|
|
|
- createdEnemy[i] = true;
|
|
|
- StartCreateEnemy(i);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- createEnemyTime[i] = gameTime;
|
|
|
- }
|
|
|
- }
|
|
|
- //根据传送门血量出怪
|
|
|
- CoreCharacter coreCharacter = result.GetComponentInChildren<CoreCharacter>();
|
|
|
- PortalsCreater portalsCreater = result.GetComponent<PortalsCreater>();
|
|
|
- if (coreCharacter != null && !createdEnemy[i] && portalsCreater.createTimeCountDown < 0 && coreCharacter.hp * 100 <= coreCharacter.totalHp * cfgCreateEnemy[i].BuildingHP)
|
|
|
- {
|
|
|
- if (cfgCreateEnemy[i].DelayTime == 0)
|
|
|
- {
|
|
|
- createdEnemy[i] = true;
|
|
|
- StartCreateEnemy(i);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- createEnemyTime[i] = gameTime;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
|
|
|
+ if (t == null) continue;
|
|
|
+ t.hasOut = false;
|
|
|
+ t.index = -1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- for (int i = 0; i < cfgCreateBuilding.Count; i++)
|
|
|
+ }
|
|
|
+
|
|
|
+ public void LoadMapAsset(int mapIdx)
|
|
|
+ {
|
|
|
+ GameMap map = mapsAsset.maps[mapIdx];
|
|
|
+ refreshHasOut(map);
|
|
|
+ for (int i = 0; i < map.LayerCount; i++)
|
|
|
{
|
|
|
- if (cfgCreateBuilding[i].LevelID == curLevel.buildingExcelID)
|
|
|
+ int[] grid = map.GetlayerData(i);
|
|
|
+ int idx = 0;
|
|
|
+ for (int y = 0; y < map.height; y++)
|
|
|
{
|
|
|
- if (createBuildingTime[i] != 0)
|
|
|
+ for (int x = 0; x < map.width; x++)
|
|
|
{
|
|
|
- if (!createdBuilding[i]
|
|
|
- && (cfgCreateBuilding[i].Type == 0 && createBuildingTime[i] + cfgCreateBuilding[i].DelayTime - portalsCreateTime <= gameTime
|
|
|
- || cfgCreateBuilding[i].Type == 1 && createBuildingTime[i] + cfgCreateBuilding[i].DelayTime <= gameTime))
|
|
|
+ GameMapTile t = mapsAsset.tileAsset.GetTile(grid[idx++]);
|
|
|
+ if (t == null) continue;
|
|
|
+ if (!t.hasOut)
|
|
|
{
|
|
|
- createdBuilding[i] = true;
|
|
|
- if (gameTime < portalsCreateTime)
|
|
|
- {
|
|
|
- StartCreateBuilding(i, createBuildingTime[i] - gameTime);
|
|
|
- }
|
|
|
- else
|
|
|
+ t.hasOut = true;
|
|
|
+ for (int j = 0; j < t.spawnTime.Length; j++)
|
|
|
{
|
|
|
- StartCreateBuilding(i, portalsCreateTime);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- GameObject result = null;
|
|
|
- buildingDic.TryGetValue(cfgCreateBuilding[i].RefreshBuildingID, out result);
|
|
|
- if (result != null)
|
|
|
- {
|
|
|
- //根据防御塔血量出怪
|
|
|
- EnemyTower enemyTower = result.GetComponent<EnemyTower>();
|
|
|
- if (enemyTower != null && !createdBuilding[i] && enemyTower.hp * 100 <= enemyTower.totalHp * cfgCreateBuilding[i].RefreshBuildingHP)
|
|
|
- {
|
|
|
- if (cfgCreateBuilding[i].DelayTime == 0)
|
|
|
- {
|
|
|
- createdBuilding[i] = true;
|
|
|
- StartCreateBuilding(i, portalsCreateTime);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- createBuildingTime[i] = gameTime;
|
|
|
- }
|
|
|
- }
|
|
|
- //根据传送门血量出怪
|
|
|
- CoreCharacter coreCharacter = result.GetComponentInChildren<CoreCharacter>();
|
|
|
- PortalsCreater portalsCreater = result.GetComponent<PortalsCreater>();
|
|
|
- if (coreCharacter != null && !createdBuilding[i] && portalsCreater.createTimeCountDown < 0 && coreCharacter.hp * 100 <= coreCharacter.totalHp * cfgCreateBuilding[i].RefreshBuildingHP)
|
|
|
- {
|
|
|
- if (cfgCreateBuilding[i].DelayTime == 0)
|
|
|
- {
|
|
|
- createdBuilding[i] = true;
|
|
|
- StartCreateBuilding(i, portalsCreateTime);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- createBuildingTime[i] = gameTime;
|
|
|
- }
|
|
|
+ CreaterControl createrControl = new();
|
|
|
+ createrControl.isCreated = false;
|
|
|
+ createrControl.tile = t;
|
|
|
+ createrControl.spawnTimeId = j;
|
|
|
+ createrControl.pos = new Vector3(x, y, 0);
|
|
|
+ createCharacter.Add(createrControl);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -181,148 +113,109 @@ public class EnemyCreater : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void StartCreateBuilding(int id,float createTime)
|
|
|
+ public void OnGameTimeChange(float gameTime)
|
|
|
{
|
|
|
- SingleCreateBuildingConfig singleCreateBuilding = cfgCreateBuilding[id];
|
|
|
- if (!instance)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- switch (singleCreateBuilding.Type)
|
|
|
+ for (int i = 0; i < createCharacter.Count; i++)
|
|
|
{
|
|
|
- case 0:
|
|
|
- List<float> pos = singleCreateBuilding.Position.Concat(singleCreateBuilding.Position1).ToList();
|
|
|
- CreatePortal(singleCreateBuilding.ID, singleCreateBuilding.BuildingID, pos, singleCreateBuilding.Scale, singleCreateBuilding.HPRatio, createTime, singleCreateBuilding.DisappearTime);
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- Vector3 positon = new Vector3(singleCreateBuilding.Position[0], singleCreateBuilding.Position[1], singleCreateBuilding.Position[2]);
|
|
|
- CreateEnemyTower(singleCreateBuilding.ID, singleCreateBuilding.BuildingID, singleCreateBuilding.HPRatio, singleCreateBuilding.AttackRatio, positon, singleCreateBuilding.DisappearTime);
|
|
|
- break;
|
|
|
+ GameMapTile gameMapTile = createCharacter[i].tile;
|
|
|
+ if (gameMapTile.spawnTime[createCharacter[i].spawnTimeId].startTime <= gameTime && !createCharacter[i].isCreated)
|
|
|
+ {
|
|
|
+ CreaterControl createrControl = createCharacter[i];
|
|
|
+ createrControl.isCreated = true;
|
|
|
+ createCharacter[i] = createrControl;
|
|
|
+ StartCreateEnemy(createCharacter[i]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public async void StartCreateEnemy(int id)
|
|
|
+ public async void StartCreateEnemy(CreaterControl createrControl)
|
|
|
{
|
|
|
- SingleCreateEnemyConfig singleCreateEnemy = cfgCreateEnemy[id];
|
|
|
- for (int i = 0; i < singleCreateEnemy.Count; i++)
|
|
|
+ SpawnTime spawnTime = createrControl.tile.spawnTime[createrControl.spawnTimeId];
|
|
|
+ for (int i = 0; i < spawnTime.num; i++)
|
|
|
{
|
|
|
if (!instance)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- Vector3 pos = Vector3.zero;
|
|
|
- switch (singleCreateEnemy.Type)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- pos = new Vector3(
|
|
|
- singleCreateEnemy.Position[0],
|
|
|
- singleCreateEnemy.Position[1]
|
|
|
- + Random.Range(-singleCreateEnemy.YRandomRange / 2, singleCreateEnemy.YRandomRange / 2),
|
|
|
- singleCreateEnemy.Position[2]
|
|
|
- + Random.Range(-singleCreateEnemy.ZRandomRange / 2, singleCreateEnemy.ZRandomRange / 2));
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- GameObject building = buildingDic[singleCreateEnemy.BuildingID];
|
|
|
- pos = building.transform.position;
|
|
|
- pos.y += Random.Range(0, singleCreateEnemy.YRandomRange);
|
|
|
- pos.z += Random.Range(0, singleCreateEnemy.ZRandomRange);
|
|
|
- PortalsCreater portalsCreater = building.GetComponent<PortalsCreater>();
|
|
|
- if (portalsCreater != null)
|
|
|
- {
|
|
|
- portalsCreater.enemyNumber -= 1;
|
|
|
- portalsCreater.enemyNumberText.text = portalsCreater.enemyNumber.ToString();
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- CreateEnemy(singleCreateEnemy.EnemyID, pos, singleCreateEnemy.HPRatio, singleCreateEnemy.AttackRatio);
|
|
|
- await Task.Delay((int)(singleCreateEnemy.TimeInterval * 1000));
|
|
|
+ CreateEnemy(createrControl.tile, createrControl.pos, 1, 1);
|
|
|
+ float TimeInterval = (float)(spawnTime.endTime - spawnTime.startTime) / (spawnTime.num - 1);
|
|
|
+ await Task.Delay((int)(TimeInterval * 1000));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void CreateEnemyTower(int ID, int buildingID, float hpRatio, float attackRatio, Vector3 pos, float disappearTime)
|
|
|
- {
|
|
|
- SingleBuildingConfig cfgBuilding = GameManager.instance.allCfgData.CfgBuilding.Get(buildingID);
|
|
|
- GameObject towerObj = Util.Instantiate(cfgBuilding.BuildingPrefab);
|
|
|
- towerObj.transform.position = pos;
|
|
|
- EnemyTower enemyTower = towerObj.GetComponent<EnemyTower>();
|
|
|
- buildingDic.Add(ID, towerObj);
|
|
|
- enemyTower.totalHp = (int)(cfgBuilding.HP * hpRatio);
|
|
|
- enemyTower.hp = enemyTower.totalHp;
|
|
|
- AttackInfo attackInfo = enemyTower.attack1Infos[0];
|
|
|
- attackInfo.damage = (int)(cfgBuilding.Attack * attackRatio);
|
|
|
- enemyTower.attack1Infos[0] = attackInfo;
|
|
|
- if(disappearTime > 0)
|
|
|
- {
|
|
|
- enemyTower.haveDisappearTime = true;
|
|
|
- enemyTower.disappearTime = disappearTime;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- public void CreatePortal(int ID, int buildingID, List<float> pos, List<float> scale, float hpRatio, float createTime, float disappearTime)
|
|
|
+ public GameObject CreateEnemy(GameMapTile gameMapTile, Vector3 pos, float hpRatio, float attackRatio, bool active = true)
|
|
|
{
|
|
|
- SingleBuildingConfig cfgBuilding = GameManager.instance.allCfgData.CfgBuilding.Get(buildingID);
|
|
|
- GameObject portalObj = Util.Instantiate(cfgBuilding.BuildingPrefab);
|
|
|
- PortalsCreater portalsCreater = portalObj.GetComponent<PortalsCreater>();
|
|
|
- portalsCreater.id = ID;
|
|
|
- buildingDic.Add(ID, portalObj);
|
|
|
- portalsCreater.totalHp = (int)(cfgBuilding.HP * hpRatio);
|
|
|
- portalsCreater.enemyCreater = this;
|
|
|
- portalsCreater.portalUIParent = portalUIParent;
|
|
|
- portalsCreater.Init(pos,scale,createTime);
|
|
|
- if (portalsCreater.enemyNumber == 0)
|
|
|
- {
|
|
|
- portalsCreater.enemyNumberText.transform.parent.gameObject.SetActive(false);
|
|
|
- if (portalsCreater.onlyEnemy)
|
|
|
- {
|
|
|
- portalsCreater.coreCharacter.CoreBreak();
|
|
|
- }
|
|
|
- }
|
|
|
- if(disappearTime > 0)
|
|
|
- {
|
|
|
- portalsCreater.haveDisappearTime = true;
|
|
|
- portalsCreater.disappearTime = disappearTime + createTime;
|
|
|
- }
|
|
|
- }
|
|
|
+ string enemyStr = $"Prefab/{Enum.GetName(typeof(GameMapTile.Type), gameMapTile.type)}/{gameMapTile.ch}";
|
|
|
+ GameObject enemyObj = Util.Instantiate(enemyStr, pos, active: active);
|
|
|
+ Parameter parameter = gameMapTile.parameter;
|
|
|
+ AttackInfo attackInfo;
|
|
|
+ switch (gameMapTile.type)
|
|
|
+ {
|
|
|
+ case GameMapTile.Type.Tower:
|
|
|
+ EnemyTower enemyTower = enemyObj.GetComponent<EnemyTower>();
|
|
|
+ Tower tower = enemyObj.GetComponent<Tower>();
|
|
|
+ if (enemyTower != null)
|
|
|
+ {
|
|
|
+ enemyTower.id = gameMapTile.id;
|
|
|
|
|
|
- public GameObject CreateEnemy(int enemyId, Vector3 pos, float hpRatio, float attackRatio)
|
|
|
- {
|
|
|
- SingleEnemyConfig cfgEnemy = GameManager.instance.allCfgData.CfgEnemy.Get(enemyId);
|
|
|
- GameObject enemyObj = Util.Instantiate(cfgEnemy.EnemyPrefab, pos);
|
|
|
- if (enemyId > 30000)
|
|
|
- {
|
|
|
- Boss boss = enemyObj.GetComponentInChildren<Boss>();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Enemy enemy = enemyObj.GetComponent<Enemy>();
|
|
|
- enemy.id = enemyId;
|
|
|
- if (!enemyDic.ContainsKey(enemyId))
|
|
|
- {
|
|
|
- enemyDic.Add(enemyId, new List<Enemy>());
|
|
|
- }
|
|
|
- enemyDic[enemyId].Add(enemy);
|
|
|
- enemy.totalHp = (int)(cfgEnemy.HP * hpRatio);
|
|
|
- enemy.minMoveSpeed = cfgEnemy.MinMoveSpeed;
|
|
|
- enemy.maxMoveSpeed = cfgEnemy.MaxMoveSpeed;
|
|
|
- for (int i = 0; i < cfgEnemy.Attack1.Count; i++)
|
|
|
- {
|
|
|
- AttackInfo attackInfo = enemy.attack1Infos[i];
|
|
|
- attackInfo.damage = (int)(cfgEnemy.Attack1[i] * attackRatio);
|
|
|
- enemy.attack1Infos[i] = attackInfo;
|
|
|
- }
|
|
|
- for (int i = 0; i < cfgEnemy.Attack1.Count; i++)
|
|
|
- {
|
|
|
- AttackInfo attackInfo = enemy.attack2Infos[i];
|
|
|
- attackInfo.damage = (int)(cfgEnemy.Attack2[i] * attackRatio);
|
|
|
- enemy.attack2Infos[i] = attackInfo;
|
|
|
- }
|
|
|
- if (enemy.canFly)
|
|
|
- {
|
|
|
- enemy.flyHeight = enemy.transform.position.y;
|
|
|
- }
|
|
|
- enemy.Init();
|
|
|
- enemy.SetSortingOrder(enemy.baseSortingOrder + enemyDic[enemyId].Count);
|
|
|
+ enemyTower.totalHp = (int)(parameter.HP * hpRatio);
|
|
|
+ enemyTower.hp = enemyTower.totalHp;
|
|
|
+
|
|
|
+ attackInfo = enemyTower.attack1Infos[0];
|
|
|
+ attackInfo.damage = (int)(parameter.attack_summon * attackRatio);
|
|
|
+ enemyTower.attack1Infos[0] = attackInfo;
|
|
|
+ enemyTower.Init();
|
|
|
+ }
|
|
|
+ if (tower != null)
|
|
|
+ {
|
|
|
+ tower.id = gameMapTile.id;
|
|
|
+
|
|
|
+ tower.totalHp = (int)(parameter.HP * hpRatio);
|
|
|
+ tower.hp = tower.totalHp;
|
|
|
+
|
|
|
+ attackInfo = enemyTower.attack1Infos[0];
|
|
|
+ attackInfo.damage = (int)(parameter.attack_summon * attackRatio);
|
|
|
+ tower.attack1Infos[0] = attackInfo;
|
|
|
+ tower.Init();
|
|
|
+ }
|
|
|
+ if (!buildingDic.ContainsKey(gameMapTile.id))
|
|
|
+ {
|
|
|
+ buildingDic.Add(gameMapTile.id, new List<GameObject>());
|
|
|
+ }
|
|
|
+ buildingDic[gameMapTile.id].Add(enemyObj);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case GameMapTile.Type.Enemy:
|
|
|
+ Enemy enemy = enemyObj.GetComponent<Enemy>();
|
|
|
+ enemy.id = gameMapTile.id;
|
|
|
+ if (!enemyDic.ContainsKey(gameMapTile.id))
|
|
|
+ {
|
|
|
+ enemyDic.Add(gameMapTile.id, new List<Enemy>());
|
|
|
+ }
|
|
|
+ enemyDic[gameMapTile.id].Add(enemy);
|
|
|
+
|
|
|
+ enemy.totalHp = (int)(parameter.HP * hpRatio);
|
|
|
+ enemy.hp = enemy.totalHp;
|
|
|
+ enemy.minMoveSpeed = parameter.MinMoveSpeed;
|
|
|
+ enemy.maxMoveSpeed = parameter.MaxMoveSpeed;
|
|
|
+ attackInfo = enemy.attack1Infos[0];
|
|
|
+ attackInfo.damage = (int)(parameter.attack_summon * attackRatio);
|
|
|
+ enemy.attack1Infos[0] = attackInfo;
|
|
|
+
|
|
|
+ attackInfo = enemy.attack2Infos[0];
|
|
|
+ attackInfo.damage = (int)(parameter.attack_march * attackRatio);
|
|
|
+ enemy.attack2Infos[0] = attackInfo;
|
|
|
+
|
|
|
+ if (enemy.canFly)
|
|
|
+ {
|
|
|
+ enemy.flyHeight = enemy.transform.position.y;
|
|
|
+ }
|
|
|
+ enemy.Init();
|
|
|
+ enemy.SetSortingOrder(enemy.baseSortingOrder + enemyDic[gameMapTile.id].Count);
|
|
|
+ break;
|
|
|
}
|
|
|
+ enemyObj.transform.position = pos;
|
|
|
return enemyObj;
|
|
|
}
|
|
|
|
|
|
@@ -348,7 +241,7 @@ public class EnemyCreater : MonoBehaviour
|
|
|
{
|
|
|
if (item.Value[i] != self && !item.Value[i].isDie && item.Value[i].gameObject.activeInHierarchy)
|
|
|
{
|
|
|
- if (!minDisEnemy || (minDisEnemy.transform.position - self.transform.position).magnitude
|
|
|
+ if (!minDisEnemy || (minDisEnemy.transform.position - self.transform.position).magnitude
|
|
|
> (item.Value[i].transform.position - self.transform.position).magnitude)
|
|
|
{
|
|
|
minDisEnemy = item.Value[i];
|