Esempio n. 1
0
        /// <summary>
        /// Leave vehicle player is currently sitting in.
        /// </summary>
        public virtual void LeaveVehicle()
        {
            Client.Assert(currentVehicle != null && state != State.OnFoot, "Player is leaving vehicle but he is not in vehicle.");

            // Detach character game object from vehicle.

            if (characterGameObject != null)
            {
                characterGameObject.transform.SetParent(null);

                // TODO: Teleport interpolator to use current position so ped will not be interpolated from previous on foot location here.
            }

            // Notify vehicle that the player left.

            currentVehicle.ClearPlayer(state == State.Passenger);
            currentVehicle = null;

            // Set state of the player.

            SwitchState(State.OnFoot);

            // Play seated animation
            PlayAnimation(AnimationId.GetOutCar);
        }
Esempio n. 2
0
        /// <summary>
        /// Leave vehicle player is currently sitting in.
        /// </summary>
        public virtual void LeaveVehicle()
        {
            Client.Assert(currentVehicle != null && state != State.OnFoot, "Player is leaving vehicle but he is not in vehicle.");

            // Detach character game object from vehicle.

            if (IsSpawned)
            {
                characterGameObject.transform.SetParent(null);

                Game.Objects.GameVehicle vehicleGameObject = currentVehicle.GameObject;
                Transform seatTransform = vehicleGameObject.SeatTransform;
                Teleport(seatTransform.position, seatTransform.rotation);
            }

            // Notify vehicle that the player left.

            currentVehicle.ClearPlayer(state == State.Passenger);
            currentVehicle = null;

            // Set state of the player.

            SwitchState(State.OnFoot);
        }