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); }
private IAvatar GetOrCreateMain() { if (_system.GetMain() == null) { IAvatar avatar = _system.CreateMain(); avatar.SetAvatarController(_playerAvatarController); } return(_system.GetMain()); }
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); }
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); }
private void Start() { IAvatar avatar = _avatarService.Create(); avatar.SetAvatarController(this); WearablePack pack = new WearablePack(new[] { _headWearable1, _headWearable2, _leftHandWearable, _rightHandWearable, }); avatar.SetWearablePack(pack); }