示例#1
0
    // Token: 0x06005506 RID: 21766 RVA: 0x001D5058 File Offset: 0x001D3458
    public void AlignTrackingToPlayer(VRCPlayer player, VRC_SceneDescriptor.SpawnOrientation orientation)
    {
        if (player == null || !player.isLocal)
        {
            return;
        }
        bool flag = !VRCTrackingManager.GetSeatedPlayMode() && (orientation == VRC_SceneDescriptor.SpawnOrientation.AlignRoomWithSpawnPoint || this.spawnOrder == VRC_SceneDescriptor.SpawnOrder.Demo);

        if (flag)
        {
            player.AlignTrackingToPlayer();
        }
    }
示例#2
0
    private void InternalUseStation(VRC.Player player)
    {
        bool flag = false;

        if (player == null || (this.Occupant != null && this.Occupant != player) || player == this.Occupant)
        {
            return;
        }
        List <VRC_StationInternal> source = VRC_StationInternal.FindActiveStations(player);

        if (source.FirstOrDefault((VRC_StationInternal s) => s != this) != null)
        {
            if (!this.canUseStationFromStation)
            {
                return;
            }
            if (!VRC_StationInternal.ExitAllStations(player))
            {
                return;
            }
            flag = true;
        }
        else
        {
            VRC_StationInternal.ExitAllStations(player);
        }
        if (this.Occupant != null)
        {
            return;
        }
        VRC_StationInternal.FlagDiscontinuity(player);
        this.Occupant = player;
        if (flag)
        {
            this._occupant = null;
            return;
        }
        if (VRC_EventHandler.HasEventTrigger(base.gameObject))
        {
            this.AddUseExit(player);
        }
        if (this.stationControls != null)
        {
            this.stationControls.controllingPlayer = player.GetComponent <VRC_PlayerApi>();
        }
        Vector3    position = Vector3.zero;
        Quaternion rhs      = Quaternion.identity;

        if (player.isLocal)
        {
            VRCPlayer component = player.GetComponent <VRCPlayer>();
            component.AlignTrackingToPlayer();
            Transform  trackingTransform = VRCTrackingManager.GetTrackingTransform();
            Vector3    position2         = trackingTransform.position;
            Quaternion rotation          = trackingTransform.rotation;
            position = player.transform.InverseTransformPoint(trackingTransform.position);
            rhs      = Quaternion.Inverse(player.transform.rotation) * rotation;
        }
        if (this.isSeated)
        {
            this.ApplySeatedAnimation(player);
        }
        this.SetEnterPlayerTransform(player.gameObject);
        player.currentStation = this;
        if (player.isLocal)
        {
            VRCTrackingManager.SetTrackingWorldOrigin(player.transform.TransformPoint(position), player.transform.rotation * rhs);
            if (this.isSeated)
            {
                VRCTrackingManager.UseAvatarStationViewPoint(true);
            }
            if (this.stationEnterPlayerLocation != null)
            {
                this.stationEnterInitialRotation = this.stationEnterPlayerLocation.rotation;
            }
            else
            {
                this.stationEnterInitialRotation = base.transform.rotation;
            }
            this.trackingOriginDeltaPosition = VRCTrackingManager.GetTrackingWorldOrigin() - player.transform.position;
            this.trackingOriginDeltaRotation = Quaternion.FromToRotation(player.transform.TransformDirection(Vector3.forward), VRCTrackingManager.GetTrackingTransform().TransformDirection(Vector3.forward));
            player.GetComponent <LocomotionInputController>().immobilize = this.isImmobilized;
            player.GetComponent <VRCMotionState>().IsSeated  = this.isSeated;
            player.GetComponent <VRCMotionState>().InVehicle = this.inVehicle;
        }
        if (this.isImmobilized)
        {
            Collider component2 = player.GetComponent <Collider>();
            if (component2 != null)
            {
                component2.enabled = false;
            }
            if (player.isLocal)
            {
                this.AttachInputControllerTo(player, "ImmobileInputController");
            }
        }
        if (this.controlsObject != null)
        {
            VRC.Network.SetOwner(player, this.controlsObject.gameObject, VRC.Network.OwnershipModificationType.Request, false);
        }
        if (TutorialManager.Instance != null && player.isLocal && this.isImmobilized && !this.disableStationExit)
        {
            base.StartCoroutine(this.ShowGetUpInstructions());
        }
        VRC_StationInternal.AddActiveStation(this);
        base.SendMessage("OnStationEntered", SendMessageOptions.DontRequireReceiver);
    }