private void GenerateCreateInfo() { m_CreateInfo.Capacity = Mathf.Min(m_CreateInfo.Capacity, m_MonsterCount); m_Monsters.Capacity = Mathf.Max(m_Monsters.Capacity, m_MonsterCount / 2); EZ.Data.Monster monsterData = Global.gApp.gGameData.MosterData; if (m_RandomType == RandomType.RandCreateInfo) { int countIndex = 0; foreach (int enemyId in m_WaveData.enemyID) { int eId = enemyId; if (DebugMgr.GetInstance().MonsterId > 0) { eId = DebugMgr.GetInstance().MonsterId; } MonsterItem monsterItem = monsterData.Get(eId); if (monsterItem == null) { Debug.LogError("EnemyId " + eId + " does not exist!"); continue; } var count = Mathf.CeilToInt(m_WaveData.enemyNum[countIndex] * Game.PlayerDataMgr.singleton.StageWaveFactor); for (int i = 0; i < count; i++) { m_CreateInfo.Add(monsterItem); } m_WaveMgr.CacheMonster(eId, count); countIndex++; } } else if (m_RandomType == RandomType.RandMonster) { int enemyIdCount = m_WaveData.enemyID.Length; int enemyCount = Mathf.CeilToInt(m_WaveData.enemyNum[0] * Game.PlayerDataMgr.singleton.StageWaveFactor); for (int i = 0; i < enemyCount; i++) { int enemyIndex = Random.Range(0, enemyIdCount); int enemyId = m_WaveData.enemyID[enemyIndex]; if (DebugMgr.GetInstance().MonsterId > 0) { enemyId = DebugMgr.GetInstance().MonsterId; } MonsterItem monsterItem = monsterData.Get(enemyId); if (monsterItem == null) { Debug.LogError("EnemyId " + enemyId + " does not exist!"); continue; } m_CreateInfo.Add(monsterItem); m_WaveMgr.CacheMonster(enemyId, 1); } } //CacheMonster(); }
public void CacheSpecialEnemy(int id) { EZ.Data.Monster monsterData = Global.gApp.gGameData.MosterData; MonsterItem monsterItem = monsterData.Get(id); Monster monster = m_PlayerMgr.CreateMonsterForceCreate(monsterItem); monster.InitForCache(m_MainPlayer, null, monsterItem); }
private void CacheMonster() { return; EZ.Data.Monster monsterData = Global.gApp.gGameData.MosterData; foreach (int enemyId in m_WaveData.enemyID) { MonsterItem monsterItem = monsterData.Get(enemyId); Monster monster = m_WaveMgr.CreateMonster(monsterItem); monster.InitForCache(m_MainPlayer, this, monsterItem); } }
private void CheckPassData() { PassItem[] items = Global.gApp.gGameData.PassData.items; foreach (PassItem passItem in items) { foreach (int waveId in passItem.waveID) { WaveItem waveData = Global.gApp.gGameData.WaveData.Get(waveId); if (waveData == null) { Debug.LogError("PassData " + passItem.id + " 的 " + "waveData " + waveId + "不存在 "); continue; } EZ.Data.Monster monsterData = Global.gApp.gGameData.MosterData; if (waveData.enemyNum.Length > 1) { if (waveData.enemyNum.Length != waveData.enemyID.Length) { Debug.LogError("waveData " + waveData.id + "配置错误 ememy count 不等于 ememyId count"); continue; } foreach (int enemyId in waveData.enemyID) { MonsterItem monsterItem = monsterData.Get(enemyId); if (monsterItem == null) { Debug.LogError("waveData " + waveData.id + " EnemyId " + enemyId + " does not exist!"); continue; } } } else { if (waveData.enemyNum.Length == 0) { Debug.LogError("waveData " + waveData.id + "配置错误 ememy count 未配置"); continue; } } int totalCount = 0; foreach (int count in waveData.enemyNum) { totalCount += count; } if (totalCount == 0) { Debug.LogError("waveData " + waveData.id + " Enemy 数量为0 !"); } } } Debug.Log("=============ok nor error==========="); }
private void CacheMonster() { EZ.Data.Monster monsterData = Global.gApp.gGameData.MosterData; foreach (KeyValuePair <int, int> keyValuePair in m_InitCacheMonster) { MonsterItem monsterItem = monsterData.Get(keyValuePair.Key); for (int i = 0; i < keyValuePair.Value; i++) { Monster monster = m_PlayerMgr.CreateMonsterForceCreate(monsterItem); monster.InitForCache(m_MainPlayer, null, monsterItem); } } m_InitCacheMonster.Clear(); m_InitCacheMonster = null; }