private void CreatedRemotePlayer(IRemotePlayer remotePlayer, object args)
        {
            PlayerID pid = _infra.ResolvePlayerID(args);

            NetworkArgs nargs = null;

            if (args is object[] argList)
            {
                if (argList.Length >= 2)
                {
                    if (argList[1] is NetworkArgs result)
                    {
                        nargs = result;
                    }
                }
            }

            IAvatar avatar = GetOrCreateAvatar(pid, nargs);

            avatar.SetAvatarController(remotePlayer);

            remotePlayer.PlayerID = pid;
            remotePlayer.OnDestroyingRemotePlayer += HandleRemotePlayerDestroying;

            OnCreatedRemotePlayer?.Invoke(avatar, remotePlayer);
        }
Exemplo n.º 2
0
        private IAvatar GetOrCreateMain()
        {
            if (_system.GetMain() == null)
            {
                IAvatar avatar = _system.CreateMain();
                avatar.SetAvatarController(_playerAvatarController);
            }

            return(_system.GetMain());
        }
Exemplo n.º 3
0
        private void CreatedRemotePlayer(IRemotePlayer remotePlayer, object args)
        {
            PlayerID pid    = _infra.ResolvePlayerID(args);
            IAvatar  avatar = GetOrCreateAvatar(pid);

            avatar.SetAvatarController(remotePlayer);

            remotePlayer.PlayerID = pid;
            remotePlayer.OnDestroyingRemotePlayer += HandleRemotePlayerDestroying;

            OnCreatedRemotePlayer?.Invoke(avatar, remotePlayer);
        }
Exemplo n.º 4
0
        private void CreateRemotePlayerLocalPlayer(IRemotePlayer remotePlayer, object args)
        {
            PlayerID pid    = _infra.ResolvePlayerID(args);
            IAvatar  avatar = _avatarService.GetMain();

            remotePlayer.PlayerID = pid;
            remotePlayer.OnDestroyingRemotePlayer += HandleRemotePlayerDestroying;
            remotePlayer.SetTargetAvatarController(_mainAvatarController);
            avatar.SetAvatarController(remotePlayer);

            OnCreatedLocalPlayer?.Invoke(avatar, remotePlayer);
        }
Exemplo n.º 5
0
        private void Start()
        {
            IAvatar avatar = _avatarService.Create();

            avatar.SetAvatarController(this);

            WearablePack pack = new WearablePack(new[]
            {
                _headWearable1,
                _headWearable2,
                _leftHandWearable,
                _rightHandWearable,
            });

            avatar.SetWearablePack(pack);
        }