private EntityPlayer CreatePlayer(EHeroType heroType, Vector3 pos, Vector3 rot)
    {
        CfgPlayerTable playerTable = CfgPlayer.Instance.GetConfigTable((int)heroType);

        if (playerTable == null)
        {
            return(null);
        }

        EntityPlayer player = new EntityPlayer(++EntityID, heroType);

        player.Create(this, playerTable.AvatarID, pos, rot);
        return(player);
    }
Exemple #2
0
    protected override void OnCreate()
    {
        base.OnCreate();

        // 初始化角色数据
        CfgPlayerTable table = CfgPlayer.Instance.GetConfigTable((int)_heroType);

        CharData.InitData(table.BodyRadius, table.MoveSpeed, table.Hp, table.Mp, table.Damage, table.Armor);

        // 跟随相机脚本
        _cameraFlow = Camera.main.GetComponent <BhvCameraFlow>();
        if (_cameraFlow == null)
        {
            _cameraFlow = Camera.main.gameObject.AddComponent <BhvCameraFlow>();
        }
        _cameraFlow.FlowTarget = Root.transform;
    }