Ejemplo n.º 1
0
 // Token: 0x060054F4 RID: 21748 RVA: 0x001D4BE4 File Offset: 0x001D2FE4
 public void RespawnPlayer(VRCPlayer player)
 {
     if (player != null)
     {
         this.mPlayer = player.player;
         VRC_StationInternal.ExitAllStations(this.mPlayer);
         bool isActiveAndEnabled = VRCUiManager.Instance.isActiveAndEnabled;
         if (isActiveAndEnabled)
         {
             VRCUiManager.Instance.CloseUi(true);
         }
         this.mStation = base.GetComponent <VRC_StationInternal>();
         if (this.mStation != null)
         {
             this.PutPlayerInStation();
         }
         else
         {
             Vector3 eulerAngles = base.transform.eulerAngles;
             eulerAngles.x = (eulerAngles.z = 0f);
             this.mPlayer.playerApi.TeleportTo(base.transform.position, Quaternion.Euler(eulerAngles));
         }
     }
 }
Ejemplo n.º 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);
    }