예제 #1
0
    public void readyForBattle()
    {
        _curRound   = -1;
        _actionTime = 0;
        _isWin      = false;

        _star  = 0;
        _score = 0;

        _gold  = 0;
        _paper = 0;

        SolaEngine engine = SolaEngine.getInstance();
        PartnerMgr pMgr   = (PartnerMgr)engine.getMgr(typeof(PartnerMgr));

        _partners = new Dictionary <int, BattleHeroModel> ();
        Dictionary <int, HeroModel> partner = pMgr.getPartners();

        foreach (int pos in partner.Keys)
        {
            HeroModel       model   = partner[pos];
            BattleHeroModel bhModel = new BattleHeroModel();
            bhModel.setModel(model, false, new Vector3(0, 0, 0));
            bhModel.formatModel();

            _partners.Add(pos, bhModel);
            bhModel.HERO_DIED += _onPartnerDeath;
        }

        MissionModel missionModel = _missionModel;

        _curBattleInfos = missionModel.getBattleInfos();
    }
예제 #2
0
    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);
    }
예제 #3
0
    public void setCfg(BattleInfoConfig cfg, HeroMgr hMgr)
    {
        _id       = Convert.ToInt32(cfg.id);
        _maxRound = Convert.ToInt32(cfg.round);

        int[] monsterInfos = cfg.monster;
        _monsters = new List <BattleHeroModel> ();

        for (int i = 0; i < monsterInfos.Length; i += 4)
        {
            int id    = Convert.ToInt32(monsterInfos[i]);
            int level = Convert.ToInt32(monsterInfos[i + 1]);

            HeroModel       heroModel = hMgr.createHero(id, level, 0);
            BattleHeroModel bhModel   = new BattleHeroModel();

            int x = Convert.ToInt32(monsterInfos[i + 2]);
            int y = Convert.ToInt32(monsterInfos[i + 3]);
            bhModel.setModel(heroModel, true, new Vector3(x, y, 0));

            _monsters.Add(bhModel);
        }
    }