Пример #1
0
 public bool Register(string passengerId, int cargoCount)
 {
     lock (Passengers)
     {
         if (IsRegistrationOpened == false)
         {
             return(false);
         }
         if (Passengers.Any(x => x.Equals(passengerId)))
         {
             return(false);
         }
         if (Passengers.Count < PassengerCapacity)
         {
             Passengers.Add(passengerId);
             CargoCount += cargoCount;
             return(true);
         }
         else
         {
             IsRegistrationOpened = false;
             return(false);
         }
     }
 }
Пример #2
0
        public virtual bool Launch()
        {
            if (Driver == null || !Passengers.Any())
            {
                return(false);
            }

            Console.WriteLine($"The {GetType().FullName?.Split('.').Last() ?? "vehicle"} leaves station with {Passengers.Count} passenger(s)");
            return(true);
        }
Пример #3
0
        bool CanUnload()
        {
            if (checkTerrainType)
            {
                var terrainType = self.World.Map.GetTerrainInfo(self.Location).Type;

                if (!Info.UnloadTerrainTypes.Contains(terrainType))
                {
                    return(false);
                }
            }

            return(!IsEmpty(self) && (aircraft == null || aircraft.CanLand(self.Location)) &&
                   CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => p.Trait <IPositionable>().CanEnterCell(c))));
        }
Пример #4
0
        public bool CanUnload(bool immediate = false)
        {
            if (checkTerrainType)
            {
                var terrainType = self.World.Map.GetTerrainInfo(self.Location).Type;

                if (!Info.UnloadTerrainTypes.Contains(terrainType))
                {
                    return(false);
                }
            }

            return(!IsEmpty(self) && (aircraft == null || aircraft.CanLand(self.Location, blockedByMobile: false)) &&
                   CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => !p.IsDead && p.Trait <IPositionable>().CanEnterCell(c, null, immediate))));
        }
Пример #5
0
 bool CanUnload()
 {
     return(!IsEmpty(self) && (helicopter == null || helicopter.CanLand(self.Location)) &&
            CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => p.Trait <IPositionable>().CanEnterCell(c))));
 }
Пример #6
0
 protected override bool IsAbleToStart()
 {
     return(Passengers.Any() && Driver != null);
 }
Пример #7
0
 bool CanUnload()
 {
     return(!IsEmpty(self) && self.CenterPosition.Z == 0 &&
            CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => p.Trait <IPositionable>().CanEnterCell(c))));
 }