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); } } }
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); }
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)))); }
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)))); }
bool CanUnload() { return(!IsEmpty(self) && (helicopter == null || helicopter.CanLand(self.Location)) && CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => p.Trait <IPositionable>().CanEnterCell(c)))); }
protected override bool IsAbleToStart() { return(Passengers.Any() && Driver != null); }
bool CanUnload() { return(!IsEmpty(self) && self.CenterPosition.Z == 0 && CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => p.Trait <IPositionable>().CanEnterCell(c)))); }