public Transform GetSeat(VehicleSeatIndex index)
        {
            Transform ret = null;

            Seats.TryGetValue(index, out ret);
            return(ret);
        }
        /// <summary>
        /// 刷新载具对应位置上所坐队友情况
        /// </summary>
        /// <param name="index"></param>
        private void UpdateSeatStateByIndex(VehicleSeatIndex index)
        {
            VehicleSeatIndex uiIndex;
            var isOccupied = _adapter.IsSeatOccupied(index, out uiIndex);

            SetSeatState(uiIndex, isOccupied);
        }
        private void SetSeatState(VehicleSeatIndex uiIndex, bool isOccupied)
        {
            Transform seat = null;

            seat = CurVehicle.GetSeat(uiIndex);
            if (seat != null)
            {
                UIUtils.SetActive(seat, isOccupied);
            }
        }
示例#4
0
        public void EnterVehicle(IPawn pawn, VehicleSeatIndex seatIndex, bool @override = false)
        {
            if (!(Seats.GetSeat(seatIndex) is VehicleSeat seat))
            {
                return;
            }

            if (@override && seat.IsOccupied())
            {
                seat.Occupy(pawn);
            }
            else if (seat.IsOccupied())
            {
                seat.Occupy(pawn);
            }
        }
示例#5
0
        public bool IsSeatOccupied(VehicleSeatIndex index, out VehicleSeatIndex uiIndex)
        {
            AssertUtility.Assert(IsOnVehicle);

            uiIndex = VehicleSeatIndex.None;
            var vehicle = GetCurrentVehicle();

            if (vehicle != null)
            {
                var seats = vehicle.vehicleSeat;
                if (seats.IsConfigured((int)index))
                {
                    uiIndex = index;
                }

                return(seats.IsOccupied((int)index));
            }

            return(false);
        }
示例#6
0
 public VehicleSeat(ulong id, VehicleSeatIndex index)
 {
     Id    = id;
     Index = index;
 }