本文整理汇总了C#中TileCoord类的典型用法代码示例。如果您正苦于以下问题:C# TileCoord类的具体用法?C# TileCoord怎么用?C# TileCoord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TileCoord类属于命名空间,在下文中一共展示了TileCoord类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MultiTileSelectionAnnot
public MultiTileSelectionAnnot(Point start)
{
_selectedLocations = new HashSet<TileCoord>();
TileMinExtant = new TileCoord(Int32.MaxValue, Int32.MaxValue);
TileMaxExtant = new TileCoord(Int32.MinValue, Int32.MinValue);
}
开发者ID:Elof3,项目名称:Treefrog,代码行数:7,代码来源:MultiTileSelectionAnnot.cs
示例2: FloodFill
public void FloodFill(int x, int y)
{
_ranges = new FloodFillRangeQueue((_fillLayer.TilesWide + _fillLayer.TilesHigh) / 2 * 5);
_matchStack = _fillLayer[x, y];
LinearFill(ref x, ref y);
while (_ranges.Count > 0) {
FloodFillRange range = _ranges.Dequeue();
int upY = range.Y - 1;
int downY = range.Y + 1;
TileCoord tid;
for (int i = range.StartX; i <= range.EndX; i++) {
tid = new TileCoord(i, upY);
if (range.Y > 0 && /*!_sourceStack.Equals(_fillLayer[tid]) &&*/
(_matchStack == null ? _matchStack == _fillLayer[tid] : _matchStack.Equals(_fillLayer[tid])))
LinearFill(ref i, ref upY);
tid = new TileCoord(i, downY);
if (range.Y < (_fillLayer.TilesHigh - 1) && /*!_sourceStack.Equals(_fillLayer[tid]) &&*/
(_matchStack == null ? _matchStack == _fillLayer[tid] : _matchStack.Equals(_fillLayer[tid])))
LinearFill(ref i, ref downY);
}
}
}
开发者ID:jaquadro,项目名称:Treefrog,代码行数:28,代码来源:TileFillTool.cs
示例3: CreateTile
public void CreateTile(TileCoord pos, Tile tile)
{
// Make sure the prefab we want to spawn exists, if it doesn't cry in
// the console and exit out of this method.
if (!(tile.prefab >= 0 && tile.prefab < levelSet.items.Length))
{
Debug.LogWarning(string.Format("This tile index {0} is not a valid index: Didn't do anything.", tile.prefab));
return;
}
// Check to see if a tile is already here if so, windge about it and
// return out of this method.
if (level.data.ContainsKey(pos))
return;
if (!spawnedTiles.ContainsKey(pos))
{
// Spawn in the prefab.
Transform inst = (Transform)Instantiate(levelSet.items[tile.prefab].prefab.transform, new Vector3(0.5f + pos.x, 0, 0.5f + pos.y), Quaternion.identity);
inst.SetParent(transform);
spawnedTiles.Add(pos, inst);
}
level.data.Add(pos, tile);
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:25,代码来源:LevelManager.cs
示例4:
public TileStack this[TileCoord location]
{
get { return this[location.X, location.Y]; }
set
{
this[location.X, location.Y] = value;
}
}
开发者ID:JuliaABurch,项目名称:Treefrog,代码行数:8,代码来源:MultiTileGridLayer.cs
示例5: GetBrush
public override Dictionary<TileCoord, Tile> GetBrush(int radius, TileCoord pos, Tile fill)
{
Dictionary<TileCoord, Tile> brush = new Dictionary<TileCoord, Tile>();
for (int y, x = pos.x - radius; x <= (pos.x + radius); x++)
{
for (y = pos.y - radius; y <= (pos.y + radius); y++)
{
brush.Add(new TileCoord(x, y), fill);
}
}
return brush;
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:12,代码来源:Brushes.cs
示例6: LinearFill
private void LinearFill(ref int x, ref int y)
{
// Find left edge
int lFillLoc = x;
while (true) {
TileCoord tid = new TileCoord(lFillLoc, y);
if (SourceType == TileSourceType.Brush && ActiveBrush != null) {
ActiveBrush.ApplyBrush(_fillLayer, tid.X, tid.Y);
}
else {
_fillCommand.QueueReplacement(tid, _sourceStack);
_fillLayer[tid] = _sourceStack;
}
lFillLoc--;
tid = new TileCoord(lFillLoc, y);
if (lFillLoc < 0 || /*_sourceStack.Equals(_fillLayer[tid]) ||*/
!(_matchStack == null ? _matchStack == _fillLayer[tid] : _matchStack.Equals(_fillLayer[tid])))
break;
}
lFillLoc++;
// Find right edge
int rFillLoc = x;
while (true) {
TileCoord tid = new TileCoord(rFillLoc, y);
/*if (!_sourceStack.Equals(_fillLayer[tid])) {*/
if (SourceType == TileSourceType.Brush && ActiveBrush != null) {
ActiveBrush.ApplyBrush(_fillLayer, tid.X, tid.Y);
}
else {
_fillCommand.QueueReplacement(tid, _sourceStack);
_fillLayer[tid] = _sourceStack;
}
//}
rFillLoc++;
tid = new TileCoord(rFillLoc, y);
if (rFillLoc >= _fillLayer.TilesWide || /*_sourceStack.Equals(_fillLayer[tid]) ||*/
!(_matchStack == null ? _matchStack == _fillLayer[tid] : _matchStack.Equals(_fillLayer[tid])))
break;
}
rFillLoc--;
FloodFillRange r = new FloodFillRange(lFillLoc, rFillLoc, y);
_ranges.Enqueue(ref r);
}
开发者ID:jaquadro,项目名称:Treefrog,代码行数:53,代码来源:TileFillTool.cs
示例7: InsideSquare
// Return an array of Tiles that fit inside a square the size of radius
// with an offset.
public TileCoord[] InsideSquare(int radius, TileCoord offset)
{
List<TileCoord> tiles = new List<TileCoord>();
for (int y, x = offset.x - radius; x <= (offset.x + radius); x++)
{
for (y = offset.y - radius; y <= (offset.y + radius); y++)
{
tiles.Add(new TileCoord(x, y));
}
}
return tiles.ToArray();
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:15,代码来源:LevelEditorHelpers.cs
示例8: getClosestDirection
public static TileCoord getClosestDirection ( TileCoord from, TileCoord to ) {
TileCoord diff = to - from;
if ( diff.x == diff.y ) {
return null;
}
else
if ( Mathf.Abs ( diff.x ) > Mathf.Abs ( diff.y ) ) {
return new TileCoord ( ( diff.x > 0 ) ? +1 : -1, 0 );
}
else {
return new TileCoord ( 0, ( diff.y > 0 ) ? +1 : -1 );
}
}
开发者ID:preda7or,项目名称:game1,代码行数:13,代码来源:GridManager.cs
示例9: InsideSquareOfType
// Return an array of Tiles that fit inside a square the size of radius
// with an offset of the same type of 'type'.
public TileCoord[] InsideSquareOfType(int radius, TileCoord offset, Tile type)
{
List<TileCoord> tiles = new List<TileCoord>();
for (int y, x = offset.x - radius; x <= (offset.x + radius); x++)
{
for (y = offset.y - radius; y <= (offset.y + radius); y++)
{
if (level.GetTile(new TileCoord(x, y)) == type)
tiles.Add(new TileCoord(x, y));
}
}
return tiles.ToArray();
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:16,代码来源:LevelEditorHelpers.cs
示例10: VisualiseBrush
public void VisualiseBrush(Brush brush, int radius, TileCoord start, TileCoord end)
{
tiles = new List<TileCoord>();
foreach (TileCoord lineTile in editor.getTiles.AlongLine(start, end))
{
foreach (TileCoord tile in brush.GetBrush(radius, lineTile, new Cow.Tile(0)).Keys)
{
if (!tiles.Contains(tile))
tiles.Add(tile);
}
}
tiles = new List<TileCoord>(brush.GetBrush(radius, new TileCoord(), new Tile(0)).Keys);
RenderTiles();
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:14,代码来源:EditorCursorGraphic.cs
示例11: MouseHold
public void MouseHold(TileCoord pos)
{
// Only paint a line if the cursor has moved more than one unit else
// just paint a single tile at the new cursor pos. Also set the lastPos
// to the current pos for the next time the cursor moves.
if (pos.x > lastPos.x + 1 || pos.x < lastPos.x - 1 || pos.y > lastPos.y + 1 || pos.y < lastPos.y - 1)
// Just loop through each tile in the line and paint a brush over
// the tile.
foreach (TileCoord posInLine in getTiles.AlongLine(lastPos, pos))
Paint(posInLine, currTile);
else
Paint(pos, currTile);
lastPos = pos;
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:15,代码来源:EditorManager.cs
示例12: TileSelection
public TileSelection(TileSelection selection)
{
if (selection != null) {
_offset = selection._offset;
_tileAnnot = new MultiTileSelectionAnnot(selection._tileAnnot);
_active = selection._active;
_floating = selection._floating;
_tiles = new Dictionary<TileCoord, TileStack>();
foreach (KeyValuePair<TileCoord, TileStack> kvp in selection._tiles)
_tiles.Add(kvp.Key, new TileStack(kvp.Value));
}
}
开发者ID:JuliaABurch,项目名称:Treefrog,代码行数:15,代码来源:TileSelection.cs
示例13: QueueAdd
public void QueueAdd(TileCoord coord, Tile tile)
{
if (tile != null) {
TileStack srcStack = null;
if (_tileSource.InRange(coord))
srcStack = new TileStack(_tileSource[coord]);
TileStack stack = new TileStack(srcStack);
stack.Add(tile);
if (_tiles.ContainsKey(coord))
_tiles[coord] = new TileRecord(_tiles[coord].Original, stack);
else
_tiles[coord] = new TileRecord(srcStack, stack);
}
}
开发者ID:jaquadro,项目名称:Treefrog,代码行数:16,代码来源:TileReplace2DCommand.cs
示例14: Tile
public void Tile(TileCoord pos)
{
//Create the top face
Quad(
new Vector3(pos.x + 0, height, pos.y + 0),
new Vector3(pos.x + 0, height, pos.y + 1),
new Vector3(pos.x + 1, height, pos.y + 1),
new Vector3(pos.x + 1, height, pos.y + 0));
if (!tiles.Contains(new TileCoord(pos.x - 1, pos.y)))
{
Quad(
new Vector3(pos.x + 0, height, pos.y + 1),
new Vector3(pos.x + 0, height, pos.y + 0),
new Vector3(pos.x + 0, 0, pos.y + 0),
new Vector3(pos.x + 0, 0, pos.y + 1));
}
if (!tiles.Contains(new TileCoord(pos.x + 1, pos.y)))
{
Quad(
new Vector3(pos.x + 1, height, pos.y + 0),
new Vector3(pos.x + 1, height, pos.y + 1),
new Vector3(pos.x + 1, 0, pos.y + 1),
new Vector3(pos.x + 1, 0, pos.y + 0));
}
if (!tiles.Contains(new TileCoord(pos.x, pos.y-1)))
{
Quad(
new Vector3(pos.x + 0, height, pos.y + 0),
new Vector3(pos.x + 1, height, pos.y + 0),
new Vector3(pos.x + 1, 0, pos.y + 0),
new Vector3(pos.x + 0, 0, pos.y + 0));
}
if (!tiles.Contains(new TileCoord(pos.x, pos.y + 1)))
{
Quad(
new Vector3(pos.x + 1, height, pos.y + 1),
new Vector3(pos.x + 0, height, pos.y + 1),
new Vector3(pos.x + 0, 0, pos.y + 1),
new Vector3(pos.x + 1, 0, pos.y + 1));
}
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:41,代码来源:EditorCursorGraphic.cs
示例15: AlongLine
// Returns an array of tiles along a line from start to end.
public TileCoord[] AlongLine(TileCoord start, TileCoord end)
{
// This if statement just swaps the start and end around if the start
// is left of the end.
if (start.x > end.x)
{
TileCoord swapTile = start;
start = end;
end = swapTile;
}
// Bresenham's line algorithm.
// http://wki.pe/Bresenham's_line_algorithm
// C.O.W. C# Implementation written by Tom Parker.
List<TileCoord> tiles = new List<TileCoord>();
float deltaX = end.x - start.x;
float deltaY = end.y - start.y;
float error = 0;
float deltaError = Mathf.Abs(deltaY / deltaX);
int y = start.y;
for (int x = start.x; x < end.x; x++)
{
tiles.Add(new TileCoord(x, y));
error += deltaError;
while (error >= 0.5f)
{
tiles.Add(new TileCoord(x, y));
y += (int)Mathf.Sign(end.y - start.y);
error -= 1;
}
}
return tiles.ToArray();
}
开发者ID:alexkirwan29,项目名称:Cubes-Of-Wrath,代码行数:38,代码来源:LevelEditorHelpers.cs
示例16: AddTile
private void AddTile(MultiTileGridLayer layer, TileCoord location)
{
if (!_tiles.ContainsKey(location)) {
TileStack stack = layer.TileStacksAt(location);
if (!TileStack.NullOrEmpty(stack))
_tiles.Add(location, stack);
_tileAnnot.AddTileLocation(location);
}
}
开发者ID:JuliaABurch,项目名称:Treefrog,代码行数:9,代码来源:TileSelection.cs
示例17: UpdateExtants
private void UpdateExtants(TileCoord coord)
{
if (coord.X < _minX)
_minX = coord.X;
if (coord.X > _maxX)
_maxX = coord.X;
if (coord.Y < _minY)
_minY = coord.Y;
if (coord.Y > _maxY)
_maxY = coord.Y;
}
开发者ID:Elof3,项目名称:Treefrog,代码行数:11,代码来源:StaticTileBrush.cs
示例18: RemoveTile
public void RemoveTile(TileCoord coord, Tile tile)
{
if (_tiles.ContainsKey(coord))
_tiles[coord].Remove(tile);
}
开发者ID:Elof3,项目名称:Treefrog,代码行数:5,代码来源:StaticTileBrush.cs
示例19: ClearTile
public void ClearTile(TileCoord coord)
{
_tiles.Remove(coord);
ResetExtants();
}
开发者ID:Elof3,项目名称:Treefrog,代码行数:5,代码来源:StaticTileBrush.cs
示例20: AddTile
public void AddTile(TileCoord coord, Tile tile)
{
if (!_tiles.ContainsKey(coord))
_tiles.Add(coord, new TileStack());
_tiles[coord].Remove(tile);
_tiles[coord].Add(tile);
UpdateExtants(coord);
}
开发者ID:Elof3,项目名称:Treefrog,代码行数:10,代码来源:StaticTileBrush.cs
注:本文中的TileCoord类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论