public static bool FcExternSequenceOk(int fcOld, int fcNew, int wps0 = 5) { FcState oldValue = FcExternToFc(fcOld); FcState newValue = FcExternToFc(fcNew); return(FcExternSequenceOk(oldValue, newValue, wps0)); }
public static bool FcExternSequenceOk(FcState oldValue, FcState newValue, int wps0 = 5) { bool result = true; if (wps0 != 5) { return(true); //bij niet regelen, altijd OK } switch (oldValue) { case FcState.groen: if (newValue != FcState.groen && newValue != FcState.geel) { result = false; //alleen groen blijven of naar geel gaan is OK } break; case FcState.geel: if (newValue != FcState.geel && newValue != FcState.rood) { result = false; //alleen geel blijven of naar rood gaan is OK } break; case FcState.rood: if (newValue != FcState.rood && newValue != FcState.groen) { result = false; //alleen rood blijven of naar groen gaan is OK } break; default: result = false; break; } return(result); }