void OnInterrupt(EventArgs args) { if (args is IWrapper <bool> wrapper) { if (wrapper.Value) { if (!isActive || isWaiting) { return; } End(); } else { if (!isActive || isWaiting || current.CastingPatterns.Any(pattern => pattern is Point)) { return; } End(); } } else if (args is IWrapper <Tile> tileWrapper) { if (!isActive || isWaiting || current.GetTilesForCasting(tileWrapper.Value, castArgs).HasIntersection()) { return; } End(); } else { if (!isActive || isWaiting || current.CastingPatterns.Any(pattern => pattern is Point)) { return; } End(); } }