public static bool RemoveMatch(Player player, List <string> exits, ExitData exit) { var regex = GetBarrierExitRegex(player.Model, exit, BarrierState.Open, BarrierState.Closed); foreach (var exitString in exits.ToArray()) { if (regex.IsMatch(exitString)) { exits.Remove(exitString); return(true); } } return(false); }
public static Regex GetBarrierExitRegex(MajorModelEntities model, ExitData exit, params BarrierState[] barrierStates) { string objectName = model.DoorNames[(int)exit.Direction]; if (exit.ExitType == ExitType.Gate) { objectName = model.GateNames[(int)exit.Direction]; } string barrierSegment = String.Join("|", barrierStates.Select(x => model.BarrierStateNames[(int)x])); barrierSegment = String.Format("({0}) ", barrierSegment); return(new Regex(barrierSegment + objectName + " " + model.SpecialExitNames[(int)exit.Direction], RegexOptions.IgnoreCase)); }
public void DrawExit(Room room, ExitData exit, bool isCurrentRoom) { if (exit.Direction == Direction.Up) { Up.Visibility = System.Windows.Visibility.Visible; } else if (exit.Direction == Direction.Down) { Down.Visibility = System.Windows.Visibility.Visible; } else { Lines[(int)exit.Direction].Visibility = System.Windows.Visibility.Visible; } }
public IEnumerable <ExitData> GetExits() { if (Exit_0 != 0) { yield return(ExitData.Create(this, Direction.North, Exit_0, Type_0, Para1_0, Para2_0, Para3_0, Para4_0)); } if (Exit_1 != 0) { yield return(ExitData.Create(this, Direction.South, Exit_1, Type_1, Para1_1, Para2_1, Para3_1, Para4_1)); } if (Exit_2 != 0) { yield return(ExitData.Create(this, Direction.East, Exit_2, Type_2, Para1_2, Para2_2, Para3_2, Para4_2)); } if (Exit_3 != 0) { yield return(ExitData.Create(this, Direction.West, Exit_3, Type_3, Para1_3, Para2_3, Para3_3, Para4_3)); } if (Exit_4 != 0) { yield return(ExitData.Create(this, Direction.Northeast, Exit_4, Type_4, Para1_4, Para2_4, Para3_4, Para4_4)); } if (Exit_5 != 0) { yield return(ExitData.Create(this, Direction.Northwest, Exit_5, Type_5, Para1_5, Para2_5, Para3_5, Para4_5)); } if (Exit_6 != 0) { yield return(ExitData.Create(this, Direction.Southeast, Exit_6, Type_6, Para1_6, Para2_6, Para3_6, Para4_6)); } if (Exit_7 != 0) { yield return(ExitData.Create(this, Direction.Southwest, Exit_7, Type_7, Para1_7, Para2_7, Para3_7, Para4_7)); } if (Exit_8 != 0) { yield return(ExitData.Create(this, Direction.Up, Exit_8, Type_8, Para1_8, Para2_8, Para3_8, Para4_8)); } if (Exit_9 != 0) { yield return(ExitData.Create(this, Direction.Down, Exit_9, Type_9, Para1_9, Para2_9, Para3_9, Para4_9)); } }