Exemplo n.º 1
0
        void EnterVehicleInternal()
        {
            Vehicle vehicle = this.CurrentVehicle;

            Vehicle.Seat seat = this.CurrentVehicleSeat;

            if (m_isServer)
            {
                m_vehicleParentOffset = m_model.VehicleParentOffset;
            }
            else if (m_isClientOnly)
            {
                m_model.VehicleParentOffset = m_vehicleParentOffset;
            }

            BaseVehicleState.PreparePedForVehicle(m_ped, vehicle, seat);

            // save root frame position

            // this.UpdateDriverAnim();	// play driver anim
            // m_model.AnimComponent.Sample();	// sample it
            // if (m_model.RootFrame != null)
            //  m_rootFramePos = m_model.RootFrame.transform.localPosition;	// save root frame position
            // this.UpdateAnimsInternal();	// restore the correct anim
            // m_model.AnimComponent.Sample();

            // play anims
            this.UpdateAnimsInternal();

            // start vehicle radio
            if (m_ped.IsControlledByLocalPlayer)
            {
                vehicle.PlayRadio();
            }
        }
        void EnterVehicleInternal()
        {
            Vehicle vehicle = this.CurrentVehicle;

            Vehicle.Seat seat      = this.CurrentVehicleSeat;
            bool         immediate = m_immediate;


            BaseVehicleState.PreparePedForVehicle(m_ped, vehicle, seat);

            if (seat.IsDriver)
            {
                // TODO: this should be done when ped enters the car - or, it should be removed, because
                // vehicle should know if it has a driver
                vehicle.StartControlling();

                // if (m_isServer) {
                //  var p = Net.Player.GetOwningPlayer(m_ped);
                //  if (p != null)
                //      Net.NetManager.AssignAuthority(vehicle.gameObject, p);
                // }
            }

            if (!vehicle.IsNightToggled && WorldController.IsNight)
            {
                vehicle.IsNightToggled = true;
            }
            else if (vehicle.IsNightToggled && !WorldController.IsNight)
            {
                vehicle.IsNightToggled = false;
            }


            m_coroutine = StartCoroutine(EnterVehicleAnimation(seat, immediate));
        }
Exemplo n.º 3
0
        protected override void EnterVehicleInternal()
        {
            m_vehicleParentOffset       = Vector3.zero;
            m_model.VehicleParentOffset = Vector3.zero;

            BaseVehicleState.PreparePedForVehicle(m_ped, this.CurrentVehicle, this.CurrentVehicleSeat);

            // only update firing if ped is not currently firing, because otherwise it can cause stack overflow
            // by switching states indefinitely
            // also, we must update firing here, because otherwise shooting rate will be lower
            this.UpdateAnimsInternal(!m_ped.IsFiring);
        }
        void ExitVehicleInternal()
        {
            BaseVehicleState.PreparePedForVehicle(m_ped, this.CurrentVehicle, this.CurrentVehicleSeat);

            // TODO: no need for this, vehicle should know when there is no driver
            // TODO: but, right now, this should be included in cleanup
            if (this.CurrentVehicleSeat.IsDriver)
            {
                this.CurrentVehicle.StopControlling();
            }

            if (m_isServer && this.CurrentVehicleSeat.IsDriver)
            {
                // remove authority
                //	Net.NetManager.RemoveAuthority(this.CurrentVehicle.gameObject);
            }

            m_coroutine = StartCoroutine(ExitVehicleAnimation(m_isExitingImmediately));
        }