Пример #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        internal void Init(BattleEntry battleEntry)
        {
            this.frame       = 0;
            this.battleEntry = battleEntry;
            this.rndSeed     = battleEntry.rndSeed;
            this.mapID       = battleEntry.mapID;

            //加载战场配置
            this.LoadDefs();

            //create champions
            int c1 = battleEntry.users.Length;

            for (int i = 0; i < c1; i++)
            {
                BSUser[] _team = battleEntry.users[i];
                Team     team  = new Team(this);
                team.id = i;
                this._teams.Add(team);

                int c2 = _team.Length;
                for (int j = 0; j < c2; j++)
                {
                    BSUser   user     = _team[j];
                    Champion champion = new Champion(this);
                    champion.rid  = user.gcNID;
                    champion.user = BS.instance.userMgr.GetUser(user.gcNID);
                    this._champions.Add(champion);
                    this._idToChampion[champion.rid] = champion;

                    team.AddChampion(champion);
                }
            }

            this._snapshotMgr.Init(this);
            //初始化帧行为管理器
            this._frameActionMgr.Init(this);
            //初始化锁步器
            this._stepLocker.Init(this, this.frameRate, this.keyframeStep);
            //初始化战场结束处理器
            this._battleEndProcessor.Init(this);
        }