public void GenerateMap(ref int[] map, BaseMapContext mapGenContext) { _context = (BSPContext)mapGenContext; _bspGenData = (BSPGeneratorData)_context.GeneratorData; if (_bspGenData.IsSeeded) { URandom.state = JsonUtility.FromJson <URandom.State>(_bspGenData.Seed); } else { Debug.Log("Current state: " + JsonUtility.ToJson(URandom.state)); } int[,] mapAux = new int[_bspGenData.MapSize.x, _bspGenData.MapSize.y]; mapAux.Fill <int>(_bspGenData.NoTile); var tree = new BSPNode(); _context.Tree = tree; tree.context = _context; tree.left = tree.right = null; tree.area = new BSPRect(1, 1, _bspGenData.MapSize.x - 2, _bspGenData.MapSize.y - 2); GenerateRooms(ref mapAux); GeneratorUtils.ConvertGrid(mapAux, out map); }
public void WriteSandboxLog_LogsMessage() { //Arrange SharePointEnvironment.Reset(); var context = new SIApplicationContextProvider() { GetCurrentAppDomainFriendlyName = () => "SandboxDomain", IsProxyCheckerInstalled = () => true, IsProxyInstalledStringString = (a, t) => true, }; SharePointEnvironment.ApplicationContextProvider = context; string testMessage = testMessageString; int testEventId = 99; LoggingOperationArgs loggingArgs = null; BSPSite site = new BSPSite(); MSPSite s = new MSPSite(site) { IDGet = () => TestsConstants.TestGuid }; BSPContext.SetCurrent(); MSPContext c = new MSPContext(BSPContext.Current) { SiteGet = () => site }; MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (a, t, args) => { loggingArgs = args as LoggingOperationArgs; return(null); }; //Act var target = new SharePointLogger(); target.LogToOperations(testMessage, testEventId, SandboxEventSeverity.Error, TestsConstants.AreasCategories); // Assert Assert.IsNotNull(loggingArgs); Assert.AreEqual(loggingArgs.Message, testMessage); Assert.AreEqual(loggingArgs.Category, TestsConstants.AreasCategories); Assert.AreEqual(loggingArgs.EventId, testEventId); Assert.AreEqual((SandboxEventSeverity)loggingArgs.Severity, SandboxEventSeverity.Error); }
public void BuildMap() { if (_mapData.GenerationData.GeneratorType == GeneratorType.Fixed) { BaseMapContext mapContext = new BaseMapContext { GeneratorData = _mapData.GenerationData }; FixedMapGeneratorData genData = ((FixedMapGeneratorData)_mapData.GenerationData); if (!genData.BuildLevelData()) { return; } InitFromArray(genData.MapSize, genData.LevelData, genData.PlayerStart, genData.OriginIsTopLeft); } else if (_mapData.GenerationData.GeneratorType == GeneratorType.BSP) { BSPContext context = new BSPContext { GeneratorData = _mapData.GenerationData, PlayerStart = Vector2Int.zero }; int[] level = null; IMapGenerator generator = new BSPMapGenerator(); generator.GenerateMap(ref level, context); InitFromArray(context.GeneratorData.MapSize, level, context.PlayerStart, _mapData.GenerationData.OriginIsTopLeft); } else if (_mapData.GenerationData.GeneratorType == GeneratorType.Room7DRL) { int[] level = null; var context = new Room7DRLGeneratorContext { GeneratorData = _mapData.GenerationData, PlayerStart = Vector2Int.zero }; IMapGenerator generator = new Room7DRLGenerator(); generator.GenerateMap(ref level, context); InitFromArray(context.GeneratorData.MapSize, level, context.PlayerStart, _mapData.GenerationData.OriginIsTopLeft); } }