Пример #1
0
    // Use this for initialization
    void Start()
    {
        BattleFuncs.ResetBattle();
        BattleGlobals.monsters = JsonFuncs.LoadEnemys(BattleGlobals.placeName);
        MusicManager.PlayBgm("battle");
        MusicManager.SetVolume();
        //Load Infos
        string place = BattleGlobals.placeName;

        BattleGlobals.currentWave = 1;
        currentMonsters           = BattleGlobals.monsters[BattleGlobals.currentWave - 1];

        RenderSettings.skybox = (Material)GameFuncs.GetResource("SkyBox/" + place);
        GameFuncs.FindHiden(place + "Parent").SetActive(true);
        //Load Transforms
        BattleGlobals.hpoints = GameObject.Find("hpoints").transform;
        BattleGlobals.mpoints = GameObject.Find("mpoints").transform;
        foreach (Transform t in BattleGlobals.hpoints)
        {
            hpoints.Add(t);
        }
        foreach (Transform t in BattleGlobals.mpoints)
        {
            if (!t.gameObject.name.Contains("one"))
            {
                mpoints.Add(t);
            }
            else
            {
                mone = t;
            }
        }
        //Create Hero
        for (int i = 0; i < BattleGlobals.selectHeroes.Count; i++)
        {
            //create hero
            GameObject hero = Instantiate((GameObject)GameFuncs.GetResource
                                              ("Prefabs/" + BattleGlobals.selectHeroes[i]), hpoints[i]);
            Hero h = hero.AddComponent <Hero>();
            GameFuncs.CopyHero(h, BattleGlobals.selectHeroes[i]);
            h.anim      = hero.GetComponent <Animator>();
            h.currentMp = h.infos[1];
            h.cp        = 100;
            hero.name   = "h" + i;
            h.battleId  = hero.name;
            BattleGlobals.liveHeroes.Add(hero.name);
        }
        CreateCurrentEnemy();
    }