示例#1
0
    // Token: 0x06005989 RID: 22921 RVA: 0x001F1BEC File Offset: 0x001EFFEC
    public void DoPositionSync(double now, double delta)
    {
        if (base.isMine || (double)(Time.time - this.LastUnsettledTime) > VRC.Network.SimulationDelay(base.Owner) * 2.0)
        {
            return;
        }
        VRC.Player componentInParent      = base.gameObject.GetComponentInParent <VRC.Player>();
        List <VRC_StationInternal> source = VRC_StationInternal.FindActiveStations(componentInParent);

        if (this.isPlayer)
        {
            if ((from s in source
                 where s.isImmobilized
                 select s).FirstOrDefault <VRC_StationInternal>() != null)
            {
                return;
            }
        }
        VRC_StationInternal componentInParent2  = base.gameObject.GetComponentInParent <VRC_StationInternal>();
        VRC_StationInternal componentInChildren = base.gameObject.GetComponentInChildren <VRC_StationInternal>();

        if (this.hasCamera || base.gameObject.IsVisible() || (componentInParent2 != null && componentInParent2.Occupant != null && componentInParent2.Occupant.isLocal) || (componentInChildren != null && componentInChildren.Occupant != null && componentInChildren.Occupant.isLocal))
        {
            if (SyncPhysics.f__mg2 == null)
            {
                SyncPhysics.f__mg2 = new TweenFunctions.TweenFunction <SyncPhysics.PositionEvent>(TweenFunctions.CatMullRomTween <SyncPhysics.PositionEvent>);
            }
            this.InterpolateFunction = SyncPhysics.f__mg2;
        }
        else
        {
            if (SyncPhysics.f__mg3 == null)
            {
                SyncPhysics.f__mg3 = new TweenFunctions.TweenFunction <SyncPhysics.PositionEvent>(TweenFunctions.NoTween <SyncPhysics.PositionEvent>);
            }
            this.InterpolateFunction = SyncPhysics.f__mg3;
        }
        double num = now - VRC.Network.SimulationDelay(base.Owner);

        SyncPhysics.PositionEvent positionEvent = TweenFunctions.Tween <SyncPhysics.PositionEvent>(this.positionHistory, this.InterpolateFunction, num, VRC.Network.ExpectedInterval, (!this.isPlayer) ? -1 : base.photonView.viewID);
        if (positionEvent == null && this.positionHistory.Full && this.positionHistory[0].Time > num)
        {
            this.positionHistory.Capacity *= 2;
        }
        if (positionEvent != null)
        {
            this.DoAdjustment(positionEvent);
        }
    }
示例#2
0
    // Token: 0x06005AA3 RID: 23203 RVA: 0x001F9724 File Offset: 0x001F7B24
    public static bool ExitAllStations(VRC.Player target)
    {
        if (target == null)
        {
            return(false);
        }
        bool flag = true;
        List <VRC_StationInternal> list = VRC_StationInternal.FindActiveStations(target);

        foreach (VRC_StationInternal vrc_StationInternal in list)
        {
            vrc_StationInternal.ExitStation(target);
            flag = (flag && vrc_StationInternal.Occupant != target);
        }
        return(flag);
    }
示例#3
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);
    }