public static UnitData GetUnitData(int id) { AssetManager mng; mng = GameRoot.GetInstance().BattleField.assetManager; CreatureFightData data = new CreatureFightData(); data.LoadData(mng.GetCreatureData(id)); return(AssetManager.PackCreatureData(data)); }
//create new data public CreatureFightData CreateNewCreature(int id, int level) { AssetManager assetManager = GameRoot.GetInstance().BattleField.assetManager; CreatureFightData temp = new CreatureFightData(); temp.LoadData(assetManager.GetCreatureData(id)); temp.level = level; temp.hp = temp.hp + (level - 1) * temp.hp_up; temp.attack = temp.attack + (level - 1) * temp.attack_up; temp.expMax = level * 20; temp.exp = level == 1 ? 0 : UnityEngine.Random.Range(0, temp.expMax); return(temp); }
public BattleData GetBattleData() { BattleData battleData = new BattleData(); List <UnitData> allStructures = GetBattleConstructures(); List <UnitData> allCreatures = GetBattleCreatures(); int num = allStructures.Count + allCreatures.Count; battleData.units = new UnitData[num]; battleData.roomCol = roomCol; battleData.roomRow = roomRow; for (int i = 0; i < allStructures.Count; ++i) { battleData.units[i] = allStructures[i]; } for (int i = 0; i < allCreatures.Count; ++i) { battleData.units[allStructures.Count + i] = allCreatures[i]; } battleData.enemys = new UnitData[25]; for (int i = 0; i < 24; ++i) { CreatureFightData temp = new CreatureFightData(); temp.LoadData(GameRoot.GetInstance().BattleField.assetManager.GetCreatureData(109)); if (UnityEngine.Random.Range(0f, 1f) < 0.1f) { temp.enemy_level = 1; } battleData.enemys[i] = AssetManager.PackCreatureData(temp, 2); battleData.enemys[i].init_room = -1; } CreatureFightData e_boss = new CreatureFightData(); e_boss.LoadData(GameRoot.GetInstance().BattleField.assetManager.GetCreatureData(110)); e_boss.enemy_level = 2; battleData.enemys[24] = AssetManager.PackCreatureData(e_boss, 2); battleData.enemys[24].init_room = -1; battleData.boss = GetHeroData(); return(battleData); }