private void _onComfirmClicked(GameObject src) { SolaEngine engine = SolaEngine.getInstance(); DialogueModel[] dialogueModels = new DialogueModel[0]; MapModel mapModel = _mapModel; List <HeroModel> monsterModels = mapModel.getRandomMonster(); int monsterSize = monsterModels.Count; BattleInfoModel[] battleInfos = new BattleInfoModel[3]; for (int j = 0; j < battleInfos.Length; j++) { List <BattleHeroModel> rdModels = new List <BattleHeroModel> (); for (int i = 0; i < 3; i++) { int monsterIndex = engine.randomInt(0, monsterSize); HeroModel monster = monsterModels [monsterIndex]; Vector3 pos = new Vector3(); pos.x = engine.randomInt(-200, 200); pos.y = engine.randomInt(-300, 300); pos.z = 0; BattleHeroModel bhModel = new BattleHeroModel(); bhModel.setModel(monster, true, pos); rdModels.Add(bhModel); } BattleInfoModel bInfoModel = new BattleInfoModel(); bInfoModel.mapBattleInfo(0, 3, rdModels); battleInfos[j] = bInfoModel; } MissionModel missionModel = new MissionModel(); missionModel.formatMapBattle(battleInfos, dialogueModels); BattleMgr bMgr = (BattleMgr)engine.getMgr(typeof(BattleMgr)); bMgr.setMissionModel(missionModel); string sceneName = ScenesName.BATTLE; engine.enterScene(sceneName); Destroy(himeScroll.gameObject); Application.LoadLevel(sceneName); }
public void initBattleInfo(BattleMgr bMgr) { int infoLength = _battleInfoIds.Length; _battleInfoModels = new BattleInfoModel[infoLength]; for (int i = 0; i < infoLength; i++) { int battleInfoId = _battleInfoIds [i]; BattleInfoModel bInfoModel = bMgr.getBattleInfo(battleInfoId); _battleInfoModels [i] = bInfoModel; } }
public bool nextRound() { _curRound++; if (_curRound >= _curBattleInfos.Length) { _isWin = true; _star = 3; _missionModel.setStatus(MissionModel.status.FINISHED); return(true); } BattleInfoModel infoModel = _curBattleInfos [_curRound]; List <BattleHeroModel> monster = infoModel.getMonsters(); _monsters = new List <BattleHeroModel> (); for (int i = 0; i < monster.Count; i++) { BattleHeroModel model = monster [i]; model.formatModel(); _monsters.Add(model); } foreach (BattleHeroModel model in _monsters) { model.HERO_DIED += _onMonsterDeath; } List <BattleHeroModel> totalModel = new List <BattleHeroModel> (); foreach (BattleHeroModel model in _monsters) { totalModel.Add(model); } foreach (BattleHeroModel model in _partners.Values) { totalModel.Add(model); } _totalModel = totalModel; BattleEvent.NEXT_ROUND(); return(false); }
public override bool inited() { _infoModels = new Dictionary <int, BattleInfoModel> (); SolaEngine engine = SolaEngine.getInstance(); List <BattleInfoConfig> infoCfgs = (List <BattleInfoConfig>)engine.getCfg(BattleInfoConfigData.NAME); HeroMgr hMgr = (HeroMgr)engine.getMgr(typeof(HeroMgr)); foreach (BattleInfoConfig cfg in infoCfgs) { BattleInfoModel model = new BattleInfoModel(); model.setCfg(cfg, hMgr); int id = model.getId(); _infoModels.Add(id, model); } MissionMgr mMgr = (MissionMgr)engine.getMgr(typeof(MissionMgr)); mMgr.initBattleInfo(this); return(true); }