Beispiel #1
0
    /// <summary>
    /// 向当前战斗场景中添加一个英雄
    /// </summary>
    /// <param name="teamId">英雄所属的队伍ID</param>
    /// <param name="model">英雄的数据</param>
    private void addHero(int teamId, FightPlayerModel model)
    {
        string assetName = "assets/dynamicresources/characters/hero" + model.heroId + ".prefab";

        Debug.Log(assetName);
        GameObject o        = FightUnitMgr.Instance.NewGameObject(model.id, assetName, model.name + model.id, false);
        FightUnit  fu       = o.GetComponent <FightUnit>();
        bool       isMyTeam = (PlayerController.Instance.MyTeamId == teamId);

        fu.Initial(teamId, model, isMyTeam);

        if (model.id == GameData.user.id)
        {
            PlayerController.Instance.Player = model;

            LuaScriptMgr.Instance.CallLuaFunction("initPlayerFightUI", model); //设置玩家界面

            CameraMgr.Instance.FocusMainCameraToPlayer(o.transform);           //摄像机对准角色
            PlayerBehaviourFacade.Instance.UpdateControlUnit(fu);
        }
    }