public GameDebug() { InitializeComponent(); grid = GridConverter.DeserializeGrid(File.ReadAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"PuzzleGame\level.json"))); LoadPlayer(); UpdateGridTiles(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(tbSaveName.Text)) { WebApi.AddNewLevel(tbSaveName.Text, GridConverter.Serialize(grid)); //string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), string.Format(@"PuzzleGame\{0}.json", tbSaveName.Text)); //string root = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"PuzzleGame\"); //if (!Directory.Exists(root)) //{ // Directory.CreateDirectory(root); //} //// Delete the file if it exists. //if (File.Exists(path)) //{ // //File.Delete(path); // MessageBox.Show("Naam is al bezet kies een ander."); //} //else //{ // //Create the file. // File.WriteAllText(path, grid.Serialize()); //} } }
private bool DecideSplit(int index) { float3 future_position = m_CloudGroup.Position[index].Value + m_CloudGroup.CloudStep[index].Delta * framesForward; var future_cells = GridConverter.RadiusInGrid(future_position, m_CloudGroup.CloudData[index].Radius); var current_cells = GridConverter.RadiusInGrid(m_CloudGroup.Position[index].Value, m_CloudGroup.CloudData[index].Radius); int avaiable_future_cells = 0; int avaiable_current_cells = 0; var cell_map = m_CellMarks.Cell2OwningCloud; foreach (int cell_id in current_cells) { //if avaiable, test if id is different. if (!(cell_map.TryGetValue(cell_id, out int result) && result == m_CloudGroup.CloudData[index].ID) && bioClouds.created_cell_ids.Contains(cell_id)) { avaiable_current_cells++; } } foreach (int cell_id in future_cells) { //if avaiable, test if id is different. if (!(cell_map.TryGetValue(cell_id, out int result) && result == m_CloudGroup.CloudData[index].ID) && bioClouds.created_cell_ids.Contains(cell_id)) { avaiable_future_cells++; } } return((avaiable_future_cells / avaiable_current_cells) < split_threshold); }
public void Solve(String source, String expectedResult) { Grid sourceGrid = GridConverter.Convert(source); Solver solver = new Solver(); Grid destGrid = solver.Solve(sourceGrid); String actualResult = GridConverter.Convert(destGrid); Assert.That(actualResult, Is.EqualTo(expectedResult)); }
private void SaveLevel() { string levelName = Message.InputMessage("Give youre level a name", "Save", "Cancel"); if (!string.IsNullOrWhiteSpace(levelName)) { WebApi.AddNewLevel(levelName, GridConverter.Serialize(levelEditor.grid)); } }
public void MapGridSetup() { var groundMatrix = GridConverter.ToGroundTypeMatrix(_gameInfo.StartRaw.PlacementGrid, _gameInfo.StartRaw.PathingGrid, _gameInfo.StartRaw.PlayableArea); groundMatrix[20, 130].Should().Be(Ground.Airspace); groundMatrix[21, 130].Should().Be(Ground.BuildingPlacable); groundMatrix[39, 123].Should().Be(Ground.Pathable); // Top left of ramp groundMatrix[37, 118].Should().Be(Ground.Pathable); // Bottom right of ramp (ramp points to left) }
private void SetupBoard() { Vector2Int boardSize = Vector2Int.one * 8; Vector2 cellSize = Vector2.one; Grid = new GridConverter(boardSize, cellSize); Board = new DiskType[Grid.CellsCount]; FillBoardDefeult(); }
public void CreateCells(float x, float xf, float y, float yf) { List <float3> cells = new List <float3>(); for (float i = x; i < xf; i += city.BioParameters.CellWidth) { for (float j = y; j < yf; j += city.BioParameters.CellWidth) { int ID = GridConverter.Position2CellID(new float3(i, j, 0f)); //Debug.Log(ID); if (created_cell_ids.Contains(ID)) { continue; } //Debug.Log(ID + " " + i + " " + j + GridConverter.PositionToGridCell(new float3(i, j, 0f))); Entity newCell = entityManager.CreateEntity(city.CellArchetype); entityManager.SetComponentData <Position>(newCell, new Position { Value = new float3(i, j, 0f) }); entityManager.SetComponentData <Rotation>(newCell, new Rotation { Value = quaternion.identity }); entityManager.SetComponentData <CellData>(newCell, new CellData { ID = ID, Area = city.BioParameters.CellWidth * city.BioParameters.CellWidth }); created_cell_ids.Add(ID); cells.Add(new float3(i, j, 0f)); } } using (System.IO.StreamWriter file = new System.IO.StreamWriter(Parameters.Instance.LogFilePath + "Cells.txt")) { foreach (float3 cellPos in cells) { string line = string.Format("{0:D0};{1:F3};{2:F3};\n", GridConverter.Position2CellID(new float3(cellPos.x, cellPos.y, 0f)), cellPos.x, cellPos.y ); file.Write(line); } } }
private IList <Tuple <String, Grid> > ReadInput(String filename) { IList <Tuple <String, Grid> > dest = new List <Tuple <String, Grid> >(); String[] lines = File.ReadAllLines(filename); for (Int32 index = 0; index < lines.Length; index += (1 + Defs.GridSide)) { String name = lines[index]; String[] gridLines = new String[Defs.GridSide]; Array.Copy(lines, index + 1, gridLines, 0, Defs.GridSide); Grid grid = GridConverter.Convert(gridLines); dest.Add(new Tuple <String, Grid>(name, grid)); } return(dest); }
public void Setup() { _currentObservation = new Observation { PlayerCommon = new PlayerCommon { FoodWorkers = 0 }, RawData = new ObservationRaw { Units = { new Unit { UnitType = ConstantManager.Scv, Alliance = Alliance.Self, BuildProgress = 1, Tag = Tag, Pos = new Point{ X = 20, Y = 25 } } } } }; Game.ResponseGameInfo = new ResponseGameInfo { StartRaw = new StartRaw() }; Game.ResponseGameInfo.StartRaw.PlacementGrid = new ImageData { Data = ByteString.CopyFrom(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), // Each bit is 1 Size = new Size2DI { X = 10, Y = 10 } }; Game.ResponseGameInfo.StartRaw.PathingGrid = new ImageData { Data = ByteString.CopyFrom(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }), // Each bit is 1 Size = new Size2DI { X = 10, Y = 10 } }; Game.ResponseGameInfo.StartRaw.PlayableArea = new RectangleI { P0 = new PointI { X = 1, Y = 1 }, P1 = new PointI { X = 9, Y = 9 } }; Game.MapManager = new MapManager(GridConverter.ToGroundTypeMatrix(Game.ResponseGameInfo.StartRaw.PlacementGrid, Game.ResponseGameInfo.StartRaw.PathingGrid, Game.ResponseGameInfo.StartRaw.PlayableArea) , new Point { X = 3, Y = 7, Z = 0 }); // Main Base is top left }
public void Setup() { // From AcropolisLE.SC2Map var mapSize = new Size2DI { X = 176, Y = 184 }; _gameInfo = new ResponseGameInfo { StartRaw = new StartRaw { MapSize = mapSize, PathingGrid = new ImageData { BitsPerPixel = 1, Size = mapSize, Data = ByteString.FromBase64(PathingGridBitmap) }, PlacementGrid = new ImageData { BitsPerPixel = 1, Size = mapSize, Data = ByteString.FromBase64(PlacementGridBitmap) }, PlayableArea = new RectangleI { P0 = new PointI { X = 18, Y = 18 }, P1 = new PointI { X = 156, Y = 153 } } } }; // Test grid setup GridConverter.GetDataValueBit(_gameInfo.StartRaw.PathingGrid, 22, 131).Should().Be(1); GridConverter.GetDataValueBit(_gameInfo.StartRaw.PlacementGrid, 22, 131).Should().Be(1); GridConverter.GetDataValueBit(_gameInfo.StartRaw.PathingGrid, 40, 124).Should().Be(1); GridConverter.GetDataValueBit(_gameInfo.StartRaw.PlacementGrid, 40, 123).Should().Be(0); }
public void GridConverteMAXInterval() { var reader = new TrajectoryFileReader(CoordinateUnit.metric); var trajectory = reader.createTrajectoryFromFile(Globals.testdataDirectory + "test_track.dat"); Aircraft aircraft = new Aircraft("GP7270", "wing"); var noiseModel_MAX = new IntegratedNoiseModel(trajectory, aircraft); noiseModel_MAX.StartCalculation(testMAX); while (!testRunned_MAX) { } var converter_MAX = new GridConverter(noiseModel_MAX.TemporalGrid, GridTransformation.MAX); TemporalGrid res = converter_MAX.transform(); Assert.AreEqual(1, res.Interval); testRunned_MAX = false; }
public void GridConverterSELData() { var reader = new TrajectoryFileReader(CoordinateUnit.metric); var trajectory = reader.createTrajectoryFromFile(Globals.testdataDirectory + "test_track.dat"); Aircraft aircraft = new Aircraft("GP7270", "wing"); var noiseModel_SEL = new IntegratedNoiseModel(trajectory, aircraft); noiseModel_SEL.StartCalculation(testSEL); while (!testRunned_SEL) { } var converter_SEL = new GridConverter(noiseModel_SEL.TemporalGrid, GridTransformation.SEL); TemporalGrid res = converter_SEL.transform(); Assert.AreEqual(30.67, Math.Round(res.GetGrid(1).Data[65][60], 2), 0.001); testRunned_SEL = false; }
//Index = per cloud public void Execute(int index) { float3 currentCellPosition; int cellCount = 0; NativeMultiHashMapIterator <int> it; if (!CloudMarkersMap.TryGetFirstValue(CloudData[index].ID, out currentCellPosition, out it)) { return; } cellCount++; while (CloudMarkersMap.TryGetNextValue(out currentCellPosition, ref it)) { cellCount++; } float totalArea = cellCount * CellArea; CloudData cData = CloudData[index]; float delta = cData.AgentQuantity / totalArea; Color densityColor = Parameters.Density2Color(delta, CloudData[index].ID); if (!CloudMarkersMap.TryGetFirstValue(CloudData[index].ID, out currentCellPosition, out it)) { return; } int2 grid_cell = GridConverter.PositionToGridCell(new float3(currentCellPosition.x, currentCellPosition.y, currentCellPosition.z)); tex_mat[grid_cell.y * mat_rows + grid_cell.x] = densityColor; cloudDensities.TryAdd(CloudData[index].ID, delta); while (CloudMarkersMap.TryGetNextValue(out currentCellPosition, ref it)) { grid_cell = GridConverter.PositionToGridCell(new float3(currentCellPosition.x, currentCellPosition.y, currentCellPosition.z)); tex_mat[grid_cell.y * mat_rows + grid_cell.x] = densityColor; } }
public void GridConverterSELNumberOfGrids() { var reader = new TrajectoryFileReader(CoordinateUnit.metric); var trajectory = reader.createTrajectoryFromFile(Globals.testdataDirectory + "test_track.dat"); Aircraft aircraft = new Aircraft("GP7270", "wing"); var noiseModel_SEL = new IntegratedNoiseModel(trajectory, aircraft); noiseModel_SEL.StartCalculation(testSEL); while (!testRunned_SEL) { } var converter_SEL = new GridConverter(noiseModel_SEL.TemporalGrid, GridTransformation.SEL); TemporalGrid res = converter_SEL.transform(); Assert.IsNotNull(converter_SEL); Assert.AreEqual(2, res.GetNumberOfGrids()); testRunned_SEL = false; }
public void Execute(int index) { var celllist = GridConverter.RadiusInGrid(Position[index].Value, CloudData[index].Radius); var cloudId = CloudData[index].ID; tagQuantity[index] = celllist.Length; cloudPos.TryAdd(CloudData[index].ID, new CloudIDPosRadius() { position = Position[index].Value, ID = CloudData[index].ID, Radius = CloudData[index].Radius, MinRadius = CloudData[index].MinRadius }); foreach (int i in celllist) { if (cellIDmap.TryGetValue(i, out float3 cellPos)) { if (math.distance(cellPos, Position[index].Value) >= CloudData[index].Radius) { continue; } } cellTagMap.Add(i, cloudId); } }
public void Execute(int index) { CloudData currentCloudData = CloudData[index]; CloudGoal currentCloudGoal = CloudGoal[index]; Position currentCloudPosition = Position[index]; int[] desiredCells = GridConverter.RadiusInGrid(currentCloudPosition.Value, currentCloudData.Radius); float3 desiredSum = float3.zero; for (int i = 0; i < desiredCells.Length; i++) { float3 partial; if (cellid2pos.TryGetValue(desiredCells[i], out partial)) { var s = math.length(partial - currentCloudPosition.Value); if (s <= currentCloudData.Radius) { desiredSum += (math.normalize(partial - currentCloudPosition.Value)) * (currentCloudData.Radius - s); } } } float3 currentCellPosition; int cellCount = 0; NativeMultiHashMapIterator <int> it; float3 posSum = float3.zero; bool keepgoing = CloudMarkersMap.TryGetFirstValue(currentCloudData.ID, out currentCellPosition, out it); if (!keepgoing) { return; } cellCount++; var t = math.length(currentCellPosition - currentCloudPosition.Value); posSum += (math.normalize(currentCellPosition - currentCloudPosition.Value)) * (currentCloudData.Radius - t); bool right_desempate = false; if (!right_desempate && math.cross(currentCloudPosition.Value, currentCellPosition - currentCloudPosition.Value).z < 0) { extraWeightCellId.TryAdd(currentCloudData.ID, GridConverter.Position2CellID(currentCellPosition)); right_desempate = true; } while (CloudMarkersMap.TryGetNextValue(out currentCellPosition, ref it)) { cellCount++; t = math.length(currentCellPosition - currentCloudPosition.Value); if (t <= currentCloudData.Radius) { posSum += (math.normalize(currentCellPosition - currentCloudPosition.Value)) * (currentCloudData.Radius - t); } if (!right_desempate && math.cross(currentCloudPosition.Value, currentCellPosition - currentCloudPosition.Value).z < 0) { extraWeightCellId.TryAdd(currentCloudData.ID, GridConverter.Position2CellID(currentCellPosition)); right_desempate = true; } } sumVec[index] = posSum; dessumVec[index] = desiredSum; dotVec[index] = math.dot((CloudGoal[index].SubGoal - currentCloudPosition.Value), posSum - desiredSum); }
private void startLevel(object sender, RoutedEventArgs e) { Button btn = (Button)sender; new GameDebug(GridConverter.DeserializeGrid(WebApi.GetLevelByName(btn.Content.ToString()))).Show(); }
internal CellGrid(List <List <int> > grid) { this.grid = GridConverter.BitsToCells(grid); }
static void Main(string[] args) { Console.WriteLine("Initializing ..."); CellGenerator cellGenerator = new CellGenerator(); Console.WriteLine("Generating dungeons with 150 rooms ..."); /** * ========================================================================= * STEP 1 * ========================================================================= */ List <Cell> cells = cellGenerator.GenerateCellList(150, 50, 250, 750, 50, 1, 0.2); // Draw first step Console.WriteLine("Drawing first step to image ..."); // Generate image with background Image image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); Graphics graph = Graphics.FromImage(image); graph.Clear(Color.White); // Ready pen and draw the cells Pen pen = new Pen(Brushes.Black); //foreach (Cell cell in cells) { foreach (Cell cell in cells) { DrawCube(ref graph, ref pen, cell, image.Width, image.Height); } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step1.png")) { File.Delete("step1.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step1.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step1.png\""); /** * ========================================================================= * STEP 2 * ========================================================================= */ //List<Cell> rearrangedCells = CellProcessor.FlockingSeparation(cells, cells.Count * 2); List <Cell> rearrangedCells; while (true) { try { rearrangedCells = CellProcessor.FlockingSeparation(cells, cells.Count * 2); break; } catch (OutOfIterationException exception) { Console.WriteLine("WARNING: Separation iteration has been exhausted. " + "Iteration limit is " + exception.IterationNumber + ". Retrying with new dataset ...\n"); //cells = cellGenerator.GenerateCellList(150, 50, 250, 750); cells = cellGenerator.GenerateCellList(150, 50, 250, 750, 1, 0.2); } } // Draw second step Console.WriteLine("Drawing second step to image ..."); // Generate image with background image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); graph = Graphics.FromImage(image); graph.Clear(Color.White); //foreach (Cell cell in cells) { foreach (Cell cell in rearrangedCells) { DrawCube(ref graph, ref pen, cell, image.Width, image.Height); } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step2.png")) { File.Delete("step2.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step2.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step2.png\""); /** * ========================================================================= * STEP 3 * ========================================================================= */ List <Cell> selectedCells = CellProcessor.TrimCells(rearrangedCells, 25); // Draw second step Console.WriteLine("Drawing third step to image ..."); // Generate image with background image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); graph = Graphics.FromImage(image); graph.Clear(Color.White); //foreach (Cell cell in cells) { foreach (Cell cell in selectedCells) { DrawCube(ref graph, ref pen, cell, image.Width, image.Height); } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step3.png")) { File.Delete("step3.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step3.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step3.png\""); /** * ========================================================================= * STEP 4.1 * ========================================================================= */ TunnelGenerator tunnelGenerator = new TunnelGenerator(selectedCells); tunnelGenerator.DelaunayTriangulation(); List <Cell> triangulatedCells = tunnelGenerator.ExportCells(); // Draw step Console.WriteLine("Drawing fourth step phase one to image ..."); // Generate image with background image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); graph = Graphics.FromImage(image); graph.Clear(Color.White); // Draw the boxes. foreach (Cell cell in selectedCells) { DrawCube(ref graph, ref pen, cell, image.Width, image.Height); } // Change pen color to difference the lines. pen = new Pen(Brushes.Red); foreach (Cell cell in triangulatedCells) { var foundCells = triangulatedCells.Where(o => cell != o && cell.ConnectedCell.Contains(o.GetHashCode())); foreach (Cell foundCell in foundCells) { DrawLineFromCells(ref graph, ref pen, cell, foundCell, CANVAS_SIZE_X, CANVAS_SIZE_Y); } } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step4.1.png")) { File.Delete("step4.1.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step4.1.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step4.1.png\""); /** * ========================================================================= * STEP 4.2 * ========================================================================= */ tunnelGenerator.RemoveOverlapping(); triangulatedCells = tunnelGenerator.ExportCells(); // Draw step Console.WriteLine("Drawing fourth step phase two to image ..."); // Generate image with background image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); graph = Graphics.FromImage(image); graph.Clear(Color.White); pen = new Pen(Brushes.Black); // Draw the boxes. foreach (Cell cell in selectedCells) { DrawCube(ref graph, ref pen, cell, image.Width, image.Height); } // Change pen color to difference the lines. pen = new Pen(Brushes.Red); foreach (Cell cell in triangulatedCells) { var foundCells = triangulatedCells.Where(o => cell != o && cell.ConnectedCell.Contains(o.GetHashCode())); foreach (Cell foundCell in foundCells) { DrawLineFromCells(ref graph, ref pen, cell, foundCell, CANVAS_SIZE_X, CANVAS_SIZE_Y); } } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step4.2.png")) { File.Delete("step4.2.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step4.2.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step4.2.png\""); /** * ========================================================================= * STEP 4.3 * ========================================================================= */ tunnelGenerator.TrimCellConnections(); tunnelGenerator.TrimCellConnections(); triangulatedCells = tunnelGenerator.ExportCells(); // Draw step Console.WriteLine("Drawing fourth step phase three to image ..."); // Generate image with background image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); graph = Graphics.FromImage(image); graph.Clear(Color.White); pen = new Pen(Brushes.Black); // Draw the boxes. foreach (Cell cell in selectedCells) { DrawCube(ref graph, ref pen, cell, image.Width, image.Height); } // Change pen color to difference the lines. pen = new Pen(Brushes.Red); foreach (Cell cell in triangulatedCells) { var foundCells = triangulatedCells.Where(o => cell != o && cell.ConnectedCell.Contains(o.GetHashCode())); foreach (Cell foundCell in foundCells) { DrawLineFromCells(ref graph, ref pen, cell, foundCell, CANVAS_SIZE_X, CANVAS_SIZE_Y); } } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step4.3.png")) { File.Delete("step4.3.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step4.3.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step4.3.png\""); /** * ========================================================================= * STEP 4.5 * ========================================================================= */ //tunnelGenerator.RemoveOverlapping(); //triangulatedCells = tunnelGenerator.ExportCells(); List <Tunnel> tunnels = tunnelGenerator.GenerateTunnel(); // Draw step Console.WriteLine("Drawing fourth step phase five to image ..."); // Generate image with background image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); graph = Graphics.FromImage(image); graph.Clear(Color.White); pen = new Pen(Brushes.Black); // Draw the boxes. foreach (Cell cell in selectedCells) { DrawCube(ref graph, ref pen, cell, image.Width, image.Height); } // Change pen color to difference the lines. pen = new Pen(Brushes.Blue); // TODO: It sometimes break for some reason. foreach (Tunnel tunnel in tunnels) { var a = triangulatedCells.Single(cell => cell.GetHashCode() == tunnel.CellHashA).LocationCenter; var b = triangulatedCells.Single(cell => cell.GetHashCode() == tunnel.CellHashB).LocationCenter; DrawLineFromPoints(ref graph, ref pen, a, tunnel.AnglePoint.First(), CANVAS_SIZE_X, CANVAS_SIZE_Y); DrawLineFromPoints(ref graph, ref pen, b, tunnel.AnglePoint.Last(), CANVAS_SIZE_X, CANVAS_SIZE_Y); } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step4.5.png")) { File.Delete("step4.5.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step4.5.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step4.5.png\""); /** * ========================================================================= * STEP 5 * ========================================================================= */ //var gridProcessor = new GridConverterAsync(triangulatedCells, tunnels, 200, 200); var gridProcessor = new GridConverter(triangulatedCells, tunnels, 150, 150); //var tunnelLayerTask = gridProcessor.CreateTunnelLayer(); //var cellWallLayerTask = gridProcessor.CreateCellWallLayer(); //var cellLayerTask = gridProcessor.CreateCellLayer(); //tunnelLayerTask.Wait(); //cellWallLayerTask.Wait(); //cellLayerTask.Wait(); //var tunnelLayer = tunnelLayerTask.Result; //var cellWallLayer = cellWallLayerTask.Result; //var cellLayer = cellLayerTask.Result; //var tunnelLayer = gridProcessor.CreateTunnelLayer(); var tunnelLayer = gridProcessor.CreateTunnelLayerSimple(); var cellWallLayer = gridProcessor.CreateCellWallLayer(); //var cellWallLayer = gridProcessor.CreateCellWallLayerSimple(); var cellLayer = gridProcessor.CreateCellLayer(); var connectionLayer = GridConverter.IntersectGrid(tunnelLayer, cellWallLayer, procedural_dungeon_generator.Common.BlockType.RoomConnector); //var gridResult = GridConverterAsync.MergeGrid(tunnelLayer, // cellLayer); //gridResult = GridConverterAsync.MergeGrid(gridResult, cellWallLayer); //gridResult = GridConverterAsync.GenerateConnections(gridResult); var gridResult = GridConverter.MergeGrid(tunnelLayer, cellLayer); gridResult = GridConverter.MergeGrid(gridResult, cellWallLayer); //gridResult = GridConverter.GenerateConnections(gridResult); gridResult = GridConverter.MergeGrid(gridResult, connectionLayer); gridResult = GridConverter.VerifyConnections(gridResult); // Draw step Console.WriteLine("Drawing fifth step to image ..."); // Generate image with background image = new Bitmap(CANVAS_SIZE_X, CANVAS_SIZE_Y); graph = Graphics.FromImage(image); graph.Clear(Color.White); pen = new Pen(Brushes.Black); // Get block size. int blockWidth = CANVAS_SIZE_X / gridResult.Width; int blockHeight = CANVAS_SIZE_Y / gridResult.Height; // Draw the boxes. for (int width = 0; width < gridResult.Width; width++) { for (int height = 0; height < gridResult.Height; height++) { // Draw the colored boxes first. switch (gridResult[width, height].Type) { case procedural_dungeon_generator.Common.BlockType.Room: FillCube(ref graph, Brushes.DarkGreen, new Cell(blockWidth - 2, blockHeight - 2, width * blockWidth + 1, height * blockHeight + 1)); break; case procedural_dungeon_generator.Common.BlockType.Tunnel: FillCube(ref graph, Brushes.DarkGray, new Cell(blockWidth - 2, blockHeight - 2, width * blockWidth + 1, height * blockHeight + 1)); break; case procedural_dungeon_generator.Common.BlockType.RoomWall: FillCube(ref graph, Brushes.Green, new Cell(blockWidth - 2, blockHeight - 2, width * blockWidth + 1, height * blockHeight + 1)); break; case procedural_dungeon_generator.Common.BlockType.RoomConnector: FillCube(ref graph, Brushes.GreenYellow, new Cell(blockWidth - 2, blockHeight - 2, width * blockWidth + 1, height * blockHeight + 1)); break; default: break; } // Then draw the box. DrawCubeNoText(ref graph, ref pen, new Cell(blockWidth, blockHeight, width * blockWidth, height * blockHeight)); } } Console.WriteLine("Image drawn. Saving ..."); if (File.Exists("step5.png")) { File.Delete("step5.png"); Console.WriteLine("Previous save file has been deleted."); } image.Save("step5.png", System.Drawing.Imaging.ImageFormat.Png); Console.WriteLine("Image has been saved as \"step5.png\""); Console.WriteLine("\n\nDebug Log:\n"); triangulatedCells.ForEach(o => Console.WriteLine($"{o}")); }
//[WriteOnly] public NativeQueue<DoublePosition>.Concurrent aux_draw; public void Execute(int index) { cloud2Quantity[index] = GridConverter.QuantityInRadius(Position[index].Value, CloudData[index].Radius); }
public void Execute(int index) { int doNotFreeze = 0; float3 cellPos = WindowManager.Crowds2Clouds(CellName[index].Value); int ind = GridConverter.Position2CellID(cellPos); Parameters spawnList; bool keepgoing = parBuffer.TryGetValue(ind, out spawnList); if (!keepgoing) { return; } float3 convertedOrigin = WindowManager.Clouds2Crowds(spawnList.spawnOrigin); float2 dim = spawnList.spawnDimensions; int qtdAgtTotal = spawnList.qtdAgents; int maxZ = (int)(convertedOrigin.z + dim.y); int maxX = (int)(convertedOrigin.x + dim.x); int minZ = (int)convertedOrigin.z; int minX = (int)convertedOrigin.x; float maxSpeed = spawnList.maxSpeed; //Debug.Log(" MAX MIN " + new int4(maxZ, minZ, maxX, minX)); int startID = AgentAtCellQuantity[index] + LastIDUsed; System.Random r = new System.Random(DateTime.UtcNow.Millisecond); int CellX = minX + 1; int CellZ = minZ + 1; int CellY = 0; //Debug.Log("ConvertedOrigin:" + convertedOrigin + "CELL: " + CellX + " " + CellZ); //Problema total agents for (int i = startID; i < qtdAgtTotal + startID; i++) { //Debug.Log("Agent id : " + i); if (doNotFreeze > qtdAgtTotal) { doNotFreeze = 0; //maxZ += 2; //maxX += 2; } float x = (float)r.NextDouble() * (maxX - minX) + minX; float z = (float)r.NextDouble() * (maxZ - minZ) + minZ; float y = 0; //Debug.Log("AGENT: " + x + " " + z); float3 g = WindowManager.Clouds2Crowds(spawnList.goal); //x = UnityEngine.Random.Range(x - 0.99f, x + 0.99f); //float y = 0f; //z = UnityEngine.Random.Range(z - 0.99f, z + 0.99f); CommandBuffer.CreateEntity(index, AgentArchetype); CommandBuffer.SetComponent(index, new Position { Value = new float3(x, y, z) }); CommandBuffer.SetComponent(index, new Rotation { Value = Quaternion.identity }); //Debug.Log(maxSpeed / Settings.experiment.FramesPerSecond); CommandBuffer.SetComponent(index, new AgentData { ID = i, MaxSpeed = maxSpeed + (maxSpeed /* (float)(r.NextDouble() */ * 0.2f),// / Settings.experiment.FramesPerSecond, Radius = 1f }); CommandBuffer.SetComponent(index, new AgentStep { delta = float3.zero }); CommandBuffer.SetComponent(index, new Rotation { Value = quaternion.identity }); CommandBuffer.SetComponent(index, new CellName { Value = new int3(CellX, CellY, CellZ) }); CommandBuffer.SetComponent(index, new AgentGoal { SubGoal = g, EndGoal = g }); //entityManager.AddComponent(newAgent, ComponentType.FixedArray(typeof(int), qtdMarkers)); //TODO:Normal Life stuff change CommandBuffer.SetComponent(index, new Counter { Value = 0 }); CommandBuffer.SetComponent(index, new NormalLifeData { confort = 0, stress = 0, agtStrAcumulator = 0f, movStrAcumulator = 0f, incStress = 0f }); CommandBuffer.SetComponent <BioCrowdsAnchor>(index, new BioCrowdsAnchor { Pivot = WindowManager.instance.originBase }); CommandBuffer.AddSharedComponent(index, AgentRenderer); CommandBuffer.AddSharedComponent(index, new AgentCloudID { CloudID = spawnList.cloud }); } }
protected void MultipleTrajectoriesINM() { var reader = new TrajectoriesFileReader(); /* * if (TrajectoryFitness.trajectories != null) * { * trajectories = TrajectoryFitness.trajectories; * VisualiseOptimisation = true; * return; * } else * { */ trajectories = reader.CreateFromFile(_view.TrajectoryFile, referencePoint); //} /* * _view.Invoke(delegate { _view.NoiseCalculationCompleted(); }); * return; */ // Calculate the noise for each trajectory temporalGrid = new TemporalGrid(); int counter = 0; foreach (Trajectory trajectory in trajectories) { double percentage = (double)counter / trajectories.Count * 100.0; ProgressChanged(percentage); Console.WriteLine("INM " + counter + " started"); //if (counter > 3) { break; } var INM = new IntegratedNoiseModel(trajectory, trajectory.Aircraft); INM.CellSize = 125; INM.MapToLargerGrid(reader.LowerLeftPoint, reader.UpperRightPoint); INM.MaxDistanceFromAirport(referencePoint.Point, 100000); INM.IntegrateToCurrentPosition = true; INM.NoiseMetric = 0; if (_view.NoiseMetric == 1) { INM.NoiseMetric = 1; } INM.RunINMFullTrajectory(); Grid grid = INM.TemporalGrid.GetGrid(0); Console.WriteLine(grid.Data.Length + "x" + grid.Data[0].Length); grid.ReferencePoint = referencePoint; temporalGrid.AddGrid(grid); Console.WriteLine("INM " + counter + " completed"); counter++; } GridConverter converter; switch (_view.NoiseMetric) { case 0: converter = new GridConverter(temporalGrid, GridTransformation.LDEN); temporalGrid = converter.Transform(); break; case 1: converter = new GridConverter(temporalGrid, GridTransformation.SEL); temporalGrid = converter.Transform(); break; } _view.Invoke(delegate { _view.NoiseCalculationCompleted(); }); }
public Game() { grid = GridConverter.DeserializeGrid(File.ReadAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"PuzzleGame\level.json"))); LoadPlayer(); CountPlates(); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { if (Settings.experiment.BioCloudsEnabled) { lastAgentId = AgentAtCellQuantity[AgentAtCellQuantity.Length - 1] + lastAgentId; int lastValue = 0; for (int i = 1; i < m_CellGroup.Length; i++) { float3 cellPos = WindowManager.Crowds2Clouds(m_CellGroup.CellName[i].Value); int ind = GridConverter.Position2CellID(cellPos); AgentAtCellQuantity[i] = lastValue + AgentAtCellQuantity[i - 1]; if (clouds2Crowds.parameterBuffer.TryGetValue(ind, out Parameters spawnList)) { lastValue = spawnList.qtdAgents; } } var SpawnGroupJob = new SpawnGroup { parBuffer = clouds2Crowds.parameterBuffer, CommandBuffer = barrier.CreateCommandBuffer().ToConcurrent(), CellName = m_CellGroup.CellName, AgentAtCellQuantity = AgentAtCellQuantity, LastIDUsed = lastAgentId }; var SpawnGroupHandle = SpawnGroupJob.Schedule(m_CellGroup.Length, Settings.BatchSize, inputDeps); SpawnGroupHandle.Complete(); return(SpawnGroupHandle); } else { int lastValue = parBuffer[0].qtdAgents; AgentAtCellQuantity[0] = 0; for (int i = 1; i < parBuffer.Length; i++) { AgentAtCellQuantity[i] = lastValue + AgentAtCellQuantity[i - 1]; Parameters spawnList = parBuffer[i - 1]; lastValue = spawnList.qtdAgents; } var job = new InicialSpawn { AgentAtCellQuantity = AgentAtCellQuantity, CommandBuffer = barrier.CreateCommandBuffer().ToConcurrent(), parBuffer = parBuffer }; var handle = job.Schedule(parBuffer.Length, Settings.BatchSize, inputDeps); handle.Complete(); this.Enabled = false; return(handle); } }
public Game(string name) { grid = GridConverter.DeserializeGrid(WebApi.GetLevelByName(name)); LoadPlayer(); CountPlates(); }
protected override void OnUpdate() { processing.records.Clear(); processing.frame = frames++; for (int i = 0; i < agentGroup.Length; i++) { processing.records.Add(new AgentRecord { AgentID = agentGroup.Data[i].ID, Position = WindowManager.Crowds2Clouds(agentGroup.Position[i].Value), CloudID = agentGroup.OwnerCloud[i].CloudID }); } FrameRecord aux = complete; complete = processing; processing = aux; var inst = BioClouds.Parameters.Instance; if (!inst.SaveSimulationData) { return; } //Data recording #region BioClouds Datarecording NativeMultiHashMap <int, float3> cellmap = m_CellMarkSystem.cloudID2MarkedCellsMap; float3 currentCellPosition; NativeMultiHashMapIterator <int> it; //if ((inst.SaveDenstiies || inst.SavePositions)) //{ if (inst.MaxSimulationFrames > CurrentFrame && CurrentFrame % inst.FramesForDataSave == 0) { for (int i = 0; i < m_CloudDataGroup.Length; i++) { List <int> cellIDs = new List <int>(); if (!cellmap.TryGetFirstValue(m_CloudDataGroup.CloudData[i].ID, out currentCellPosition, out it)) { continue; } int2 grid_cell = GridConverter.PositionToGridCell(new float3(currentCellPosition.x, currentCellPosition.y, currentCellPosition.z)); cellIDs.Add(GridConverter.GridCell2CellID(grid_cell)); while (cellmap.TryGetNextValue(out currentCellPosition, ref it)) { grid_cell = GridConverter.PositionToGridCell(new float3(currentCellPosition.x, currentCellPosition.y, currentCellPosition.z)); cellIDs.Add(GridConverter.GridCell2CellID(grid_cell)); } if (inst.IDToRecord == -1 || m_CloudDataGroup.CloudData[i].ID == inst.IDToRecord) { BioClouds.Record record = new BioClouds.Record(frames, m_CloudDataGroup.CloudData[i].ID, m_CloudDataGroup.CloudData[i].AgentQuantity, cellIDs.Count, cellIDs, m_CloudDataGroup.Position[i].Value, m_CloudDataGroup.CloudData[i].Radius ); bioCloudsRecords.Add(record); } } } //if (inst.MaxSimulationFrames == CurrentFrame - 1) //{ using (System.IO.StreamWriter file = new System.IO.StreamWriter(inst.LogFilePath + "Clouds.txt", true)) { foreach (BioClouds.Record record in bioCloudsRecords) { file.Write(record.ToString() + '\n'); } } bioCloudsRecords.Clear(); //} //} #endregion #region BioCrowds DataRecording //if (inst.MaxSimulationFrames == CurrentFrame - 1) //{ using (System.IO.StreamWriter file = new System.IO.StreamWriter(inst.LogFilePath + "Agents.txt", true)) { file.Write(complete.ToString() + '\n'); } //} #endregion }
/// <summary> /// Instantiates an instance of the GridMesh. /// </summary> /// <param name="mesh">The Unity Mesh behavior.</param> /// <param name="collider">The Unity MeshCollider behavior.</param> /// <param name="renderer">The Unity MeshRenderer behavior.</param> /// <param name="args">The arguments used to create the GridMesh.</param> public GridMesh(Mesh mesh, MeshCollider collider, MeshRenderer renderer, GridMeshArgs args) { if (mesh == null) { throw new ArgumentNullException("mesh"); } if (collider == null) { throw new ArgumentNullException("collider"); } if (renderer == null) { throw new ArgumentNullException("renderer"); } if (args == null) { throw new ArgumentNullException("args"); } GameLogger.Info("Generating GridMesh. {0}x{1} squares @ {2:0.00f}; Starting height {3} of {4} @ {5:0.00f}; Submesh count = {6}", args.CountX, args.CountZ, args.GridSquareSize, args.StartingHeight, args.CountY, args.GridStepSize, args.Materials == null ? "NULL" : args.Materials.Length.ToString()); _mesh = mesh; _collider = collider; _renderer = renderer; GameObject = renderer.gameObject; GridSquareSize = args.GridSquareSize; GridStepSize = args.GridStepSize; CountX = args.CountX; CountZ = args.CountZ; CountY = args.CountY; MaterialCount = args.Materials.Length; SubmaterialSize = args.SubmaterialSize; foreach (var material in args.Materials) { if (material.mainTexture.width % SubmaterialSize != 0 || material.mainTexture.height % SubmaterialSize != 0) { throw new InvalidOperationException(string.Format("GridMesh material '{0}' is not a {1}x{1} grid sheet. [{2}x{3}]", material.name, SubmaterialSize, material.mainTexture.width, material.mainTexture.height)); } } _materials = args.Materials; _gridData = new GridData[CountX, CountZ]; _vertexHeight = new int[CountX + 1, CountZ + 1]; _gridDataTriLookup = new Dictionary <int, GridData> [MaterialCount]; Convert = new GridConverter( gridSize: GridSquareSize, gridStepSize: GridStepSize, minTerrainX: GameObject.transform.position.x, minTerrainZ: GameObject.transform.position.z, minTerrainY: args.StartingHeight * -GridStepSize); Editor = new SafeTerrainEditor(this); if (args.Skirt) { var skirtPrefab = Resources.Load <GameObject>("terrain_skirt"); var skirtObject = UnityEngine.Object.Instantiate(skirtPrefab); skirtObject.transform.parent = GameObject.transform; // the skirt prefab is rotated 90 degrees, so scale y-axis instead of z skirtObject.transform.localScale = new Vector3(CountX * GridSquareSize, CountZ * GridSquareSize, 1.0f); } GenerateMesh(); Flatten(args.StartingHeight); }
public void Execute(int index) { //fetch cloud id int currentCloudID = CloudData[index].ID; //fetch cloud agents in window int agentsInWindow; if (!CloudID2AgentInWindow.TryGetValue(currentCloudID, out agentsInWindow)) { return; } // Debug.Log("PASS1"); //fetch desired cloud agents in window int desiredAgentsInWindow; if (!DesiredCloudID2AgentInWindow.TryGetValue(currentCloudID, out desiredAgentsInWindow)) { return; } //Debug.Log("PASS2"); //create um menos o outro int agentsToCreate = (int)math.max(desiredAgentsInWindow - agentsInWindow, 0f); //Debug.Log(agentsToCreate); //if (agentsToCreate < 0) // Debug.Log("DEU MEME GURIZADA"); List <float3> positionList = new List <float3>(); NativeMultiHashMapIterator <int> it; float3 currentCellPosition; bool keepgoing = CloudMarkersMap.TryGetFirstValue(currentCloudID, out currentCellPosition, out it); if (!keepgoing) { return; } //Debug.Log("PASSTOT"); if (CheckCreatePosition(currentCellPosition)) { //Debug.Log(currentCellPosition); positionList.Add(currentCellPosition); } while (CloudMarkersMap.TryGetNextValue(out currentCellPosition, ref it)) { if (CheckCreatePosition(currentCellPosition)) { positionList.Add(currentCellPosition); //Debug.Log(currentCellPosition); } } agentsToCreate = math.min(CloudData[index].AgentQuantity - Counter[index].Quantity, agentsToCreate); int spawnPerCell = (int)math.max(math.ceil((float)agentsToCreate / positionList.Count), 0f); int spawned = 0; //TODO: Fix postionList count == 0 if (positionList.Count <= 0) { return; } //Random Distribution System.Random r = new System.Random(System.DateTime.UtcNow.Millisecond); while (agentsToCreate - spawned > 0) { float3 position = positionList[r.Next(positionList.Count - 1)]; //create agent BioCrowds.AgentSpawner.Parameters par = new BioCrowds.AgentSpawner.Parameters { cloud = currentCloudID, goal = CloudGoal[index].SubGoal, maxSpeed = CloudData[index].MaxSpeed, qtdAgents = math.min(agentsToCreate - spawned, spawnPerCell), spawnDimensions = new float2 { x = 2f, y = 2f }, spawnOrigin = position }; //Debug.Log("CREATE AGENT " + currentCloudID); buffer.TryAdd(GridConverter.Position2CellID(position), par); AddedAgentsPerCloud.Add(currentCloudID, par.qtdAgents); spawned += par.qtdAgents; } //Uniform distribution //foreach (float3 position in positionList) //{ // //create agent // BioCrowds.AgentSpawner.Parameters par = new BioCrowds.AgentSpawner.Parameters // { // cloud = currentCloudID, // goal = CloudGoal[index].SubGoal, // maxSpeed = CloudData[index].MaxSpeed, // qtdAgents = math.min(agentsToCreate-spawned, spawnPerCell), // spawnDimensions = new float2 { x = 2f, y = 2f }, // spawnOrigin = position // }; // //Debug.Log("CREATE AGENT " + currentCloudID); // buffer.TryAdd(GridConverter.Position2CellID(position), par); // AddedAgentsPerCloud.Add(currentCloudID, par.qtdAgents); // spawned += par.qtdAgents; //} //Debug.Log("Agents to create: " + agentsToCreate + " , spawnPerCell: " + spawnPerCell + " , positions: " + positionList.Count + " , spawned: " + spawned); }
//Methods public void Init() { Parameters inst = Parameters.Instance; entityManager = World.Active.GetOrCreateManager <EntityManager>(); city = new BioCity(); city.CellMeshes = new List <MeshInstanceRenderer>(); city.AgentMeshes = new List <MeshInstanceRenderer>(); city.CloudMeshes = new List <MeshInstanceRenderer>(); if (!inst.BioCloudsActive) { DeactivateBioclouds(); return; } city.BioEntityManager = entityManager; city.BioParameters = Object.FindObjectOfType <Parameters>(); var folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); var bioCloudsFolder = System.IO.Directory.CreateDirectory(folder + "\\VHLAB\\BioClouds"); var expFolder = System.IO.Directory.CreateDirectory(folder + "\\VHLAB\\BioClouds\\Experiments"); exp = LoadExperiment(city.BioParameters.ExperimentPath); r.InitState((uint)exp.SeedState); Debug.Log("domain: " + exp.Domain); city.BioParameters.DefaultDomainMinX = exp.Domain.minX; //0 city.BioParameters.DefaultDomainMinY = exp.Domain.minY; //1 city.BioParameters.DefaultDomainMaxX = exp.Domain.maxX; //2 city.BioParameters.DefaultDomainMaxY = exp.Domain.maxY; //3 densityQuad.transform.position = new Vector3((exp.Domain.minX + exp.Domain.maxX) / 2, (exp.Domain.minY + exp.Domain.maxY) / 2, 5); densityQuad.transform.localScale = new Vector3(exp.Domain.maxX - exp.Domain.minX, exp.Domain.maxY - exp.Domain.minY, 1); background.transform.position = new Vector3((exp.Domain.minX + exp.Domain.maxX) / 2, (exp.Domain.minY + exp.Domain.maxY) / 2, 10); background.transform.localScale = new Vector3(exp.Domain.maxX - exp.Domain.minX, exp.Domain.maxY - exp.Domain.minY, 1); collisionMask.transform.position = new Vector3((exp.Domain.minX + exp.Domain.maxX) / 2, (exp.Domain.minY + exp.Domain.maxY) / 2, 10); collisionMask.transform.localScale = new Vector3(exp.Domain.maxX - exp.Domain.minX, exp.Domain.maxY - exp.Domain.minY, 1.01f); inst.IDToRecord = exp.IDToRecord; float z = 0; Camera cam = mainCamera.GetComponent <Camera>(); if (cam.orthographic) { z = -15; } else { z = -((exp.Domain.maxX - exp.Domain.minX) / 2) / math.tan(math.radians(cam.fieldOfView / 2)); } mainCamera.transform.localPosition = new Vector3((exp.Domain.minX + exp.Domain.maxX) / 2, (exp.Domain.minY + exp.Domain.maxY) / 2, z); Parameters.Instance.MaxSimulationFrames = exp.FramesToRecord; GridConverter.Width = city.BioParameters.CellWidth; GridConverter.SetDomain(city.BioParameters.DefaultDomainMinX, city.BioParameters.DefaultDomainMinY, city.BioParameters.DefaultDomainMaxX, city.BioParameters.DefaultDomainMaxY); city.CloudArchetype = city.BioEntityManager.CreateArchetype(typeof(Position), typeof(Rotation), typeof(CloudData), typeof(CloudGoal), typeof(CloudMoveStep), typeof(SpawnedAgentsCounter), typeof(CloudSplitData)); city.CellArchetype = city.BioEntityManager.CreateArchetype(typeof(Position), typeof(Rotation), typeof(CellData)); foreach (MeshMaterial m in city.BioParameters.FixedParameters.CloudRendererData) { city.CloudMeshes.Add(new MeshInstanceRenderer() { mesh = m.mesh, material = m.mat }); } Texture2D noise = CreateNoiseTexture.GetNoiseTexture(512, 512, 1, new float2(0.0f, 0.0f)); noise.wrapMode = TextureWrapMode.Mirror; Texture2D density = new Texture2D(inst.Rows, inst.Cols); density.wrapMode = TextureWrapMode.Clamp; density.filterMode = FilterMode.Point; CloudHeatMap.DensityRenderer = densityQuad.GetComponent <MeshRenderer>(); CloudHeatMap.DensityRenderer.material.SetTexture("_DensityTex", density); CloudHeatMap.DensityRenderer.material.SetTexture("_NoiseTex", noise); CloudHeatMap.DensityRenderer.material.SetInt("_Rows", inst.Rows); CloudHeatMap.DensityRenderer.material.SetInt("_Cols", inst.Cols); CloudHeatMap.DensityRenderer.material.SetFloat("_CellWidth", inst.CellWidth); CloudHeatMap.DensityRenderer.material.SetTexture("_HeatMapScaleTex", inst.GetHeatScaleTexture()); if (!city.BioParameters.DrawCloudToMarkerLines) { World.Active.GetExistingManager <CloudCellDrawLineSystem>().Enabled = false; } if (!city.BioParameters.EnableRightPreference) { World.Active.GetExistingManager <CloudRightPreferenceSystem>().Enabled = false; } // Setup the Collision Mask GetComponent <CollisionMaskSettings>().Init(); }