|
|
|
@ -5,6 +5,7 @@ using UnityEngine; |
|
|
|
using UnityEngine.Rendering.VirtualTexturing; |
|
|
|
using UnityEngine.UI; |
|
|
|
using static GameManager; |
|
|
|
using static UnityEngine.Rendering.DebugUI; |
|
|
|
|
|
|
|
public class MapManager : Singleton<MapManager> |
|
|
|
{ |
|
|
|
@ -621,26 +622,34 @@ public class MapManager : Singleton<MapManager> |
|
|
|
HashSet<MapUnity> allNode = getNodeTools.getAllCanUseNode(); |
|
|
|
|
|
|
|
//获取物品上限
|
|
|
|
List<string> itemLimitList = PlayerStatsManager.Instance.itemLimitDic[int.Parse(currentLevelData.mapIndex)]; |
|
|
|
List<string> totalInfor = PlayerStatsManager.Instance.itemLimitDic[30001]; |
|
|
|
string limitInfor=null ; |
|
|
|
switch (currentLevelData.fightEenemyPool) |
|
|
|
{ |
|
|
|
case Name.EnemyPool.Weak: |
|
|
|
limitInfor =itemLimitList[0]; |
|
|
|
limitInfor = totalInfor[levelData_SO.mapLevel]; |
|
|
|
break; |
|
|
|
case Name.EnemyPool.Strong: |
|
|
|
limitInfor = itemLimitList[1]; |
|
|
|
limitInfor = totalInfor[levelData_SO.mapLevel + 3]; |
|
|
|
break; |
|
|
|
case Name.EnemyPool.Elite: |
|
|
|
limitInfor = itemLimitList[2]; |
|
|
|
limitInfor = totalInfor[levelData_SO.mapLevel + 6]; |
|
|
|
break; |
|
|
|
case Name.EnemyPool.Boss: |
|
|
|
limitInfor = itemLimitList[3]; |
|
|
|
limitInfor = totalInfor[levelData_SO.mapLevel + 9]; |
|
|
|
break; |
|
|
|
} |
|
|
|
string[] limitValue = limitInfor.Split(';'); |
|
|
|
int lowerLimit = int.Parse(limitValue[(levelData_SO.mapLevel - 1) * 2]); |
|
|
|
int maxLimit = int.Parse(limitValue[(levelData_SO.mapLevel - 1) * 2 + 1]); |
|
|
|
Debug.Log("随机数量限制" + limitInfor); |
|
|
|
//地形区间
|
|
|
|
int lowerLandformLimit = int.Parse(limitValue[0]); |
|
|
|
int maxLandformLimit = int.Parse(limitValue[1]); |
|
|
|
//地块区间
|
|
|
|
int lowerLandblockLimit = int.Parse(limitValue[2]); |
|
|
|
int maxLandblockLimit = int.Parse(limitValue[3]); |
|
|
|
//物品区间
|
|
|
|
int lowerObjectItemLimit = int.Parse(limitValue[4]); |
|
|
|
int maxObjectItemLimit = int.Parse(limitValue[5]); |
|
|
|
|
|
|
|
//切分物品数据
|
|
|
|
List <string[]> itemInforStringList = new List <string[]>(); |
|
|
|
@ -652,22 +661,34 @@ public class MapManager : Singleton<MapManager> |
|
|
|
//随机物品数量并限制上限
|
|
|
|
int count = 0; |
|
|
|
List <int> itemCountList = new List <int>(); |
|
|
|
|
|
|
|
while (count <100) |
|
|
|
{ |
|
|
|
count++; |
|
|
|
int totalCount = 0; |
|
|
|
int landformCount = 0; |
|
|
|
int blockCount = 0; |
|
|
|
int objectCount = 0; |
|
|
|
itemCountList.Clear(); |
|
|
|
|
|
|
|
for (int i = 0; i < itemInforStringList.Count; i++) |
|
|
|
{ |
|
|
|
int itemCount = Random.Range(int.Parse(itemInforStringList[i][1]), int.Parse(itemInforStringList[i][2])); |
|
|
|
Debug.Log("Ëæ»ú" + itemInforStringList[i][0] + itemCount); |
|
|
|
if(itemInforStringList[i][0] != "Vacancy") |
|
|
|
int itemCount = Random.Range(int.Parse(itemInforStringList[i][2]), int.Parse(itemInforStringList[i][3])+1); |
|
|
|
Debug.Log("随机" + itemInforStringList[i][1] + itemCount); |
|
|
|
switch (int.Parse ( itemInforStringList[i][0])) |
|
|
|
{ |
|
|
|
totalCount += itemCount; |
|
|
|
case 1: |
|
|
|
landformCount+=itemCount; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
blockCount+=itemCount; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
objectCount+=itemCount; |
|
|
|
break; |
|
|
|
} |
|
|
|
itemCountList.Add(itemCount); |
|
|
|
} |
|
|
|
if(totalCount >=lowerLimit &&totalCount <=maxLimit ) |
|
|
|
if(Scope0fJudgment(lowerLandformLimit , maxLandformLimit , landformCount )&& Scope0fJudgment(lowerLandblockLimit, maxLandblockLimit, blockCount) && Scope0fJudgment(lowerObjectItemLimit, maxObjectItemLimit,objectCount)) |
|
|
|
{ |
|
|
|
Debug.Log("成功"); |
|
|
|
break; |
|
|
|
@ -676,7 +697,7 @@ public class MapManager : Singleton<MapManager> |
|
|
|
//根据随机出的数量表生成物品
|
|
|
|
for (int i=0;i< itemInforStringList.Count;i++) |
|
|
|
{ |
|
|
|
GameObject item = Resources.Load<GameObject>(itemPrefabPath + itemInforStringList[i][0]); |
|
|
|
GameObject item = Resources.Load<GameObject>(itemPrefabPath + itemInforStringList[i][1]); |
|
|
|
int itemCount = itemCountList[i]; |
|
|
|
for(int j=0;j<itemCount;j++) |
|
|
|
{ |
|
|
|
@ -704,6 +725,16 @@ public class MapManager : Singleton<MapManager> |
|
|
|
|
|
|
|
yield return null; |
|
|
|
} |
|
|
|
|
|
|
|
public bool Scope0fJudgment(int min,int max,int value ) |
|
|
|
{ |
|
|
|
Debug.Log("随机判断" + "min:" + min + "max:" + max); |
|
|
|
if(value >=min &&value <=max ) |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
[System .Serializable ] |
|
|
|
public class EnemyGenerateData |
|
|
|
{ |
|
|
|
|