public void GetOffCarrier(Vector3 pos)
 {
     m_DrivingController = null;
     m_Seat         = null;
     mIsOnVCCarrier = false;
     if (null != onGetOffCarrier && null != carrier)
     {
         onGetOffCarrier(carrier);
     }
 }
 void WhiteCat.IVCPassenger.GetOn(string sitAnimName, VCPBaseSeat seat)
 {
     m_Seat = seat;
     if (null != mMotionMgr)
     {
         Action_Drive drive = mMotionMgr.GetAction <Action_Drive>();
         if (null != drive)
         {
             drive.SetSeat(sitAnimName, seat);
         }
     }
 }
        void WhiteCat.IVCPassenger.GetOff()
        {
            if (null != mMotionMgr)
            {
                //mMotionMgr.DoAction(PEActionType.GetOnVehicle, sitAnimName, seat);
                m_DrivingController = null;
                m_Seat         = null;
                mIsOnVCCarrier = false;

                if (null != onGetOffCarrier)
                {
                    onGetOffCarrier(carrier);
                }
            }
        }
Beispiel #4
0
        /// <summary> 乘客上载具 </summary>
        /// <param name="seatIndex"> 座位序号, -1 表示驾驶舱, 非负值表示普通座位序号 </param>
        public void GetOn(PeEntity entity, int seatIndex)
        {
            VCPBaseSeat seat = null;

            // 驾驶舱
            if (seatIndex < 0)
            {
                seat = _cockpit;

                ChangeOwner(entity);                      // 设置归属者(攻击判定相关)
                ResetHost(entity.Id);                     // 重置主控端

                // 玩家坐上驾驶舱
                if (isPlayerHost)
                {
                    _playerDriving = this;

                    UIDrivingCtrl.Instance.Show(
                        () => maxHp, () => hp, () => maxEnergy, () => energy,
                        () => { var v = rigidbody.velocity; return(Mathf.Sqrt(v.x * v.x + v.z * v.z) * 3.6f); },
                        () => _jetExhausts.Length > 0 ? _jetRestValue : 0);

                    seat.getOffCallback += () =>
                    {
                        _playerDriving = null;
                        UIDrivingCtrl.Instance.Hide();
                        UIDrivingCtrl.Instance.SetWweaponGroupTogglesVisible(false, this);
                        UISightingTelescope.Instance.Show(UISightingTelescope.SightingType.Null);
                    };

                    // 教程
                    TutorialData.AddActiveTutorialID(TutorialData.GetOnVehicle);
                }

                // 驾驶员离开驾驶舱
                seat.getOffCallback += () =>
                {
                    _inputState = OnDriverGetOff(_inputState);

                    _aimEntity    = null;
                    _lockedTarget = null;
                    _timeToLock   = -1f;
                    _isAttackMode = false;
                    DisableAllWeaponControl();

                    //终止撞击伤害技能
                    ActivateImpactDamage(false);
                };

                //单机模式玩家上车直接释放撞击伤害技能
                if (!GameConfig.IsMultiMode || IsController())
                {
                    ActivateImpactDamage(true);
                }
            }
            // 普通座位
            else
            {
                seat = _sideSeats[seatIndex];
            }

            _passengerCount += 1;

            seat.GetOn(entity.GetCmpt <PassengerCmpt>());

            // 当所有乘客都下车, 车的归属恢复默认
            seat.getOffCallback += () =>
            {
                _passengerCount -= 1;
                if (_passengerCount == 0)
                {
                    ChangeOwner(null);
                }
            };
        }