public void CheckNextLevel(CleanLevel cleanLevel) { if (cleanLevel != null) { if (gm != null) { if (gm.GetCurrentCountEnemy() <= 0 && gm.GetEnableCheckNextLevel()) { if (actualLevel != 3 || (actualLevel == 3 && bossDead)) { OpenDoors(); } gm.SetEnableCheckNextLevel(false); } } } }
public void Execute(IConfiguration configuration, StepType currentStep) { ICakeContext cake = configuration.Context.CakeContext; CleanLevel cleanLevel = CleanLevel.All; if (cake.HasArgument("no-clean")) { string noCleanArgument = cake.Argument <string>("no-clean"); string[] splitted = noCleanArgument.ToLowerInvariant().Split('#'); foreach (string s in splitted) { switch (s) { case "binobj": cleanLevel &= ~CleanLevel.BinObj; break; case "build": cleanLevel &= ~CleanLevel.Build; break; case "artifacts": cleanLevel &= ~CleanLevel.Artifacts; break; case "all": cleanLevel &= ~CleanLevel.All; break; default: configuration.Context.CakeContext.LogAndThrow($"no-clean option {s} is not supported, only binobj, build, artifacts and all are valid arguments"); break; } } } if (cleanLevel.HasFlag(CleanLevel.Artifacts)) { DirectoryPath directoryPath = configuration.GetSimple <DirectoryPath>(ConfigurationConstants.ARTIFACTS_PATH_KEY); cake.Log.Information($"Clean artifacts {directoryPath.FullPath}"); if (cake.DirectoryExists(directoryPath)) { IDirectory directory = cake.FileSystem.GetDirectory(directoryPath); directory.Delete(true); } } if (cleanLevel.HasFlag(CleanLevel.Build)) { DirectoryPath directoryPath = configuration.GetSimple <DirectoryPath>(ConfigurationConstants.BUILD_PATH_KEY); cake.Log.Information($"Clean build {directoryPath.FullPath}"); if (cake.DirectoryExists(directoryPath)) { IDirectory directory = cake.FileSystem.GetDirectory(directoryPath); directory.Delete(true); } } if (cleanLevel.HasFlag(CleanLevel.BinObj)) { DirectoryPath rootPath = configuration.GetSimple <DirectoryPath>(ConfigurationConstants.ROOT_PATH_KEY); cake.Log.Information($"Clean bin and obj in {rootPath.FullPath}"); cake.DeleteDirectories(cake.GetDirectories(Path.Combine(rootPath.FullPath, "**/bin")), new DeleteDirectorySettings { Force = true, Recursive = true }); cake.DeleteDirectories(cake.GetDirectories(Path.Combine(rootPath.FullPath, "**/obj")), new DeleteDirectorySettings { Force = true, Recursive = true }); } }