示例#1
0
    public void SetPlayer(MapRole playerRoleView)
    {
        playerRoleView.BindRoleInstance(runtime.Player, () => {
            //由于这里是异步加载模型,所以必须加载完后才初始化出生点,因为初始化出生点里有描述玩家是否在船上,需要调用子节点的renderer

            //初始化出生点
            LoadSpawnPosition();
        });
        _playerView     = playerRoleView;
        _player         = playerRoleView.transform;
        _playerNavAgent = playerRoleView.GetComponent <NavMeshAgent>();

        SetPlayerSpeed(0);
        var gameMap = GetCurrentGameMap();

        if (gameMap != null && gameMap.Tags.Contains("WORLDMAP"))
        {
            _playerNavAgent.speed = 10; //大地图上放大一倍
        }
        else
        {
            _playerNavAgent.speed = MapRuntimeData.Instance.ExploreSpeed;
        }

        _playerNavAgent.angularSpeed = MapRuntimeData.Instance.ExploreAngularSpeed;
        _playerNavAgent.acceleration = MapRuntimeData.Instance.ExploreAcceleration;

        var playerCom = _player.GetComponent <Jyx2Player>();

        if (playerCom == null)
        {
            var player = _player.gameObject.AddComponent <Jyx2Player>();
            player.Init();
        }
    }
示例#2
0
    void DoSwitchRoleModel()
    {
        var role = new RoleInstance(PlayerRoleId.ToString());

        player.BindRoleInstance(role, () =>
        {
            var animator = player.GetAnimator();
            animator.runtimeAnimatorController = player.GetComponent <Animator>().runtimeAnimatorController; //force set animator

            SwitchSkillPose();
        });
    }