当前位置: 首页>>代码示例>>C#>>正文


C# Grid.GetPoints方法代码示例

本文整理汇总了C#中Grid.GetPoints方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.GetPoints方法的具体用法?C# Grid.GetPoints怎么用?C# Grid.GetPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grid的用法示例。


在下文中一共展示了Grid.GetPoints方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Grid

 public Grid(Grid g)
 {
     //Vector2 setSize, Vector2 setPosition, GPoint.PType fillType
             xyMax = g.xyMax;
             gridType = g.gridType;
             //bump up the size to create room for the buffer;
             size = g.size;
             //translate
             position = g.position;
             //Debug.Log ("creating a grid FROM a grid " + g.GetSize ().x + "by" + g.GetSize ().y + " grid, filled with " + g.gridType);
             //Debug.Log ("actually a " + size.x + "by" + size.y + " grid");
             //create [,] of empty points
             Initialize ();
             //add a buffer
             MarkBuffer ();
             //fill the center
             //Fill (gridType);
             UpdatePoints (g.GetPoints ());
 }
开发者ID:informem,项目名称:MyUnityScripts,代码行数:19,代码来源:Grid.cs

示例2: Generate

            public override TerrainGrid Generate(Vector size, FreqDict freqs = null, Random rand = null)
            {
                freqs = freqs ?? _defaultFreqs;
                UpdateFreqs(ref freqs);
                NormalizeFreqs(ref freqs);

                rand = rand ?? new Random();

                var terrain = new Grid<TerrainType>(size);

                var heightGrid = _topographyGenerator.Generate(terrain.Size, rand);
                heightGrid = _filters.OpenClose(heightGrid);
                var sortedPoints = heightGrid.GetPoints().ToList();
                sortedPoints.Sort((lhs, rhs) => (heightGrid[lhs] - heightGrid[rhs]));

                int numTiles = size.x * size.y;
                int numWaterTiles = (int)(numTiles * freqs[TerrainTypes.Water]);
                var waterTiles = sortedPoints.Take(numWaterTiles);
                foreach (var point in waterTiles)
                    terrain[point] = TerrainTypes.Water;

                int numMountainTiles = (int)(numTiles * freqs[TerrainTypes.Mountain]);
                var mountainTiles = sortedPoints.Skip(numTiles - numMountainTiles);
                foreach (var point in mountainTiles)
                    terrain[point] = TerrainTypes.Mountain;

                var landTiles = new HashSet<Vector>(terrain.GetPoints());
                landTiles.ExceptWith(waterTiles);
                landTiles.ExceptWith(mountainTiles);

                AddLandTiles(ref terrain, landTiles.ToList(), freqs, rand);

                return terrain;
            }
开发者ID:jonkensta,项目名称:KnightGame,代码行数:34,代码来源:Generators.cs

示例3: PostProcess

						private static List<GPoint> PostProcess (Grid g, GPoint.PType scanType, GPoint.PType fillType)
						{
								
								List<GPoint> processedPoints = new List<GPoint> ();
								Debug.Log ("scanning " + g.GetPoints (scanType).Count + "unique points");
								List<Direction[]> ds = new List<Direction[]> ();
								ds.Add (new Direction[]{Direction.n, Direction.ne, Direction.e});
								ds.Add (new Direction[]{Direction.e, Direction.se, Direction.s});
								ds.Add (new Direction[]{Direction.s, Direction.sw, Direction.w});
								ds.Add (new Direction[]{Direction.w, Direction.nw, Direction.n});
								foreach (GPoint gp in g.GetPoints(scanType)) {
										//List<bool> values = new List<bool> ();
										ScanPoint scan = new ScanPoint (gp.GetPosition ());
										if (ProcessPoint (g, scan, scanType, ds)) {
												processedPoints.Add (new GPoint (scan.Position (), fillType));
										}
								}
								Debug.Log (processedPoints.Count + " processed points added");
								return processedPoints;
						}
开发者ID:informem,项目名称:MyUnityScripts,代码行数:20,代码来源:CityMaker.cs

示例4: RotateTiles

				public static void RotateTiles (Grid g)
				{
						Debug.Log ("solving tile rotation...");
						foreach (GPoint gp in g.GetPoints()) {
								switch (gp.GetPType ()) {
								case GPoint.PType.TILE_BUILDING:
										g.UpdatePointDirection (gp.GetPosition (), (CalculateDirection (g, gp)));
										break;
								case GPoint.PType.TILE_HOUSE:
										g.UpdatePointDirection (gp.GetPosition (), (CalculateDirection (g, gp)));
										break;
								default:
										//nothing
										break;
								}
						}
				}
开发者ID:informem,项目名称:MyUnityScripts,代码行数:17,代码来源:CityMaker.cs

示例5: UpdatePoints

 public void UpdatePoints(Grid g)
 {
     foreach (GPoint gp in g.GetPoints()) {
                     UpdatePoint ((gp.GetPosition () + g.GetPosition ()), gp.GetPType ());
             }
 }
开发者ID:informem,项目名称:MyUnityScripts,代码行数:6,代码来源:Grid.cs


注:本文中的Grid.GetPoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。