bool CheckConditions(MissionTrigger tr) { bool cndSatisfied = true; foreach (var cnd in tr.Conditions) { if (cnd.Type == TriggerConditions.Cnd_True || cnd.Type == TriggerConditions.Cnd_SpaceEnter || cnd.Type == TriggerConditions.Cnd_BaseEnter || cnd.Type == TriggerConditions.Cnd_SpaceExit) { cndSatisfied = true; } else if (cnd.Type == TriggerConditions.Cnd_CommComplete) { if (finishedLines.Contains(cnd.Entry[0].ToString())) { cndSatisfied = true; } else { cndSatisfied = false; break; } } else if (cnd.Type == TriggerConditions.Cnd_Timer) { MissionTimer t; if (!timers.TryGetValue(tr.Nickname, out t)) { t = new MissionTimer(); timers.Add(tr.Nickname, t); } if (t.T < cnd.Entry[0].ToSingle()) { cndSatisfied = false; break; } } else { cndSatisfied = false; break; } } return(cndSatisfied); }
bool CheckConditions(MissionTrigger tr) { bool cndSatisfied = true; foreach (var cnd in tr.Conditions) { if (cnd.Type == TriggerConditions.Cnd_True || cnd.Type == TriggerConditions.Cnd_SpaceEnter || cnd.Type == TriggerConditions.Cnd_BaseEnter || cnd.Type == TriggerConditions.Cnd_SpaceExit) { cndSatisfied = true; } else if (cnd.Type == TriggerConditions.Cnd_CommComplete) { if (finishedLines.Contains(cnd.Entry[0].ToString())) { cndSatisfied = true; } else { cndSatisfied = false; break; } } else if (cnd.Type == TriggerConditions.Cnd_Timer) { MissionTimer t; if (!timers.TryGetValue(tr.Nickname, out t)) { t = new MissionTimer(); timers.Add(tr.Nickname, t); } if (t.T < cnd.Entry[0].ToSingle()) { cndSatisfied = false; break; } } else if (cnd.Type == TriggerConditions.Cnd_LocEnter) { var room = cnd.Entry[0].ToString(); var bse = cnd.Entry[1].ToString(); bool entered = false; foreach (var c in locsEntered) { if (c.Item1.Equals(room, StringComparison.OrdinalIgnoreCase) && c.Item2.Equals(bse, StringComparison.OrdinalIgnoreCase)) { entered = true; break; } } if (!entered) { cndSatisfied = false; break; } } else { cndSatisfied = false; break; } } return(cndSatisfied); }