本文整理汇总了C#中Coords类的典型用法代码示例。如果您正苦于以下问题:C# Coords类的具体用法?C# Coords怎么用?C# Coords使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Coords类属于命名空间,在下文中一共展示了Coords类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetNode
public static Node GetNode(Coords coords)
{
int x = Mathf.Clamp(coords.x, 0, gridSize.x - 1);
int y = Mathf.Clamp(coords.y, 0, gridSize.y - 1);
return grid[x, y];
}
开发者ID:xCosmix,项目名称:Random_Project,代码行数:7,代码来源:Grid.cs
示例2: Satellite
public Satellite(Satellite s)
: this(s.Pos.Lat, s.Pos.Lon, s.Speed, s.RotSpeed, s.MaxRot, s.Id)
{
CurrentRot = new Coords(s.CurrentRot);
CurrentTurn = s.CurrentTurn;
Range = new Range(s.Range);
}
开发者ID:aliphen,项目名称:hashCode2016,代码行数:7,代码来源:Satellite.cs
示例3: CaptureAll
public bool CaptureAll(GameState state, Coords start, Coords end, Direction dir, out IEnumerable<Coords> capture)
{
if (pattern.Count() == 0)
{
capture = new List<Coords>();
return true;
}
if (end != null && !OnSameLine(start, end))
{
capture = new List<Coords>();
return false;
}
if (!pattern.ElementAt(0).IsTarget)
{
throw new NotImplementedException("Target other than the beginning is not supported yet.");
}
List<Coords> cAll = new List<Coords>();
bool retVal = false;
foreach (var incrementer in ToIncrementers(dir))
{
// Try every direction
List<Coords> c = new List<Coords>();
if (FindMatch(state, start, end, incrementer, pattern, out c))
{
cAll.AddRange(c);
retVal = true;
}
}
capture = cAll;
return retVal;
}
开发者ID:hgabor,项目名称:boardgame,代码行数:31,代码来源:Pattern.cs
示例4: Exit
/// <summary>
/// Constructor for Exit class
/// </summary>
/// <param name="from">Coordinates of teleporter in entrance room</param>
/// <param name="fromRoom">Filename of entrance room</param>
/// <param name="to">Coordinates of teleporter in exit room</param>
/// <param name="toRoom">Filename of exit room</param>
public Exit(Coords from, string fromRoom, Backend.Coords to = null, string toRoom = "")
{
_from = from;
_fromRoom = fromRoom;
_toRoom = toRoom;
_to = to;
}
开发者ID:propra13-orga,项目名称:gruppe22,代码行数:14,代码来源:exit.cs
示例5: greedyCoordsSearch
//Greedy BFS starting at "from" Coords
//Returns null or a Coords that satisfies the test
public static Coords greedyCoordsSearch(GameState gs, Coords from, Func<Coords, Coords, bool> test, bool isBombPassable, List<Coords> visited)
{
List<Coords> allCoords = new List<Coords>();
List<Coords> adjCoords = gs.GetAdjacentAccessibleTiles(from.getTileNum(), isBombPassable, false);
if (adjCoords.Count == 0) { return null; }
allCoords.AddRange(adjCoords);
while (allCoords.Count > 0) {
Coords coord = allCoords[0];
//Console.WriteLine("removing " + coord);
allCoords.Remove(coord);
visited.Add(coord);
if (test(coord, from)) {
return coord;
} else {
List<Coords> newCoords = gs.GetAdjacentAccessibleTiles(coord.getTileNum(), isBombPassable, false);
//Console.WriteLine("adding " + newCoords);
foreach(Coords potentialCoord in newCoords) {
if (!visited.Contains(potentialCoord) && !allCoords.Contains(potentialCoord)) {
allCoords.Add(potentialCoord);
}
}
}
}
return null;
}
开发者ID:vermagav,项目名称:bombersquad,代码行数:32,代码来源:Searches.cs
示例6: Match
public bool Match(GameState state, Coords start, Coords end, Direction dir)
{
if (pattern.Count() == 0)
{
return true;
}
if (end != null && !OnSameLine(start, end))
{
return false;
}
if (!pattern.ElementAt(0).IsTarget)
{
throw new NotImplementedException("Target other than the beginning is not supported yet.");
}
foreach (var incrementer in ToIncrementers(dir))
{
// Try every direction
List<Coords> c;
if (FindMatch(state, start, end, incrementer, pattern, out c))
{
return true;
}
}
return false;
}
开发者ID:hgabor,项目名称:boardgame,代码行数:25,代码来源:Pattern.cs
示例7: CanTakePicture
public static bool CanTakePicture(this Satellite s, Coords c, TimeRange t, out int pictureTurn, int maxTurn)
{
pictureTurn = 0;
if (s.CurrentTurn > t.End)
return false;
s = new Satellite(s); //clone
if(s.CurrentTurn < t.Start)
{
s.Move(t.Start - s.CurrentTurn);
}
for (int turn = Math.Max(t.Start, s.CurrentTurn); turn < Math.Min(t.End, maxTurn); turn++)
{
if(c.IsInRange(s.Range, s.Pos))
{
pictureTurn = turn;
return true;
}
s.Move(1);
}
return false;
}
开发者ID:aliphen,项目名称:hashCode2016,代码行数:25,代码来源:Helper.cs
示例8: calcWallToDestroy
//modified pathfinding... assume that agent can path through destructible walls
//and simply calc path
public Coords calcWallToDestroy(Coords from, Coords destination)
{
//path to destination, counting destructible walls as pathable
PathPlan pathPlan = new PathPlan (this.gs);
Graph g = pathPlan.mapQuantization (this.isBombPassable, true);
List<Coords> path = pathPlan.calculateMovementPlan (g, from, destination);
if ((path.Count == 0) && isBombPassable) {
Console.WriteLine("MAP FAIL!"); //TODO JDP ????
this.cannotExecuteStrategy = true;
}
for (int i = 0; i < path.Count; i++) {
//foreach (Coords coord in path) {
Coords coord = path[i];
//first destructible wall encountered on path is the target
LocationData datum = this.gs.GetLocationData (coord);
if (datum.HasDestructibleWall ()) {
Console.WriteLine("BlowUpWall found wall to blow up: " + coord);
//find previous coord
if (i-1 < 0) { //case where we can't move anywhere but we can blow up ourselves and a wall!
return from;
} else {
Coords bombDropCoord = path[i-1];
return bombDropCoord;
}
}
}
return null;
}
开发者ID:vermagav,项目名称:bombersquad,代码行数:34,代码来源:BlowUpWall.cs
示例9: ChunkCoords
public ChunkCoords(ref Coords coords)
{
X = coords.Xblock / Chunk.CHUNK_SIZE;
Z = coords.Zblock / Chunk.CHUNK_SIZE;
WorldCoordsX = X * Chunk.CHUNK_SIZE;
WorldCoordsZ = Z * Chunk.CHUNK_SIZE;
}
开发者ID:MagistrAVSH,项目名称:voxelgame,代码行数:7,代码来源:ChunkCoords.cs
示例10: NeighbourCoordsResult
public NeighbourCoordsResult(bool sameTree, Coords coordsResult, IOctree tree)
{
Assert.IsNotNull(tree, "Cannot have a null tree for a neighbour Coords result, return null instead");
this.sameTree = sameTree;
this.coordsResult = coordsResult;
this.tree = tree;
}
开发者ID:toxicFork,项目名称:vox,代码行数:7,代码来源:NeighbourCoordsResult.cs
示例11: MousePositionCondition
public MousePositionCondition(string name, Coords coordType, Operator inputOperator,
int compareValue)
{
Name = name;
CoordType = coordType;
Operator = inputOperator;
CompareValue = compareValue;
}
开发者ID:kraidleyaran,项目名称:InputManagerLib,代码行数:8,代码来源:MousePositionCondition.cs
示例12: coordsXY
public static Coords coordsXY(int x, int y, int width, int height)
{
Coords coords = new Coords (x, y, width, height);
if (!(coords.isValid ())) {
String msg = coords.ToString () + " invalid due to max width of " + width + " and max height of " + height;
throw new ArgumentException (msg);
}
return coords;
}
开发者ID:vermagav,项目名称:bombersquad,代码行数:9,代码来源:Coords.cs
示例13: Range
/// <summary>
/// creates a range of size zero on the delta between coords and orig
/// </summary>
public Range(Coords origin, Coords coords)
{
var lat = coords.Lat - origin.Lat;
var lon = coords.Lon - origin.Lon;
DeltaLatMin = lat;
DeltaLatMax = lat;
DeltaLonMin = lon;
DeltaLonMax = lon;
}
开发者ID:aliphen,项目名称:hashCode2016,代码行数:12,代码来源:Input.cs
示例14: DisplaceEvent
private void DisplaceEvent(GameToken origin, Coords toLoc)
{
if (origin.id != ID)
{
return;
}
animationQueue.Enqueue (toLoc);
}
开发者ID:bentheax,项目名称:PFClone,代码行数:9,代码来源:PieceHandler.cs
示例15: GetClip
public Rectangle GetClip(Coords coords)
{
if(_labyrinth == null || !IsHandleCreated) return Rectangle.Empty;
var xFactor = Width / (double)_labyrinth.ColsCount;
var yFactor = (Height - MESSAGE_HEIGHT) / (double)_labyrinth.RowsCount;
var x = (int)(xFactor * (coords.Col - 1));
var y = (int)(yFactor * (coords.Row - 1));
return new Rectangle(x, y, (int)xFactor, (int)yFactor);
}
开发者ID:kiple,项目名称:mouselab,代码行数:9,代码来源:LabyrinthView.cs
示例16: PixelsToTile
public Coords PixelsToTile(Coords tempc)
{
// Returns a tile covering region in given pixel coordinates
Coords outc;
outc.x = Math.Ceiling(tempc.x / 256.0) - 1;
outc.y = Math.Ceiling(tempc.y / 256.0) - 1;
return outc;
}
开发者ID:Ecotrust,项目名称:mxdTileCutter,代码行数:9,代码来源:GlobalMercator.cs
示例17: openListContains
//TOOLS______________________________________
private int openListContains(Coords cords)
{
int i = 0;
foreach (PathNode node in openList)
{
if (node.node.coords.x == cords.x && node.node.coords.y == cords.y) return i;
i++;
}
return -1;
}
开发者ID:xCosmix,项目名称:Game,代码行数:11,代码来源:Pathfinding.cs
示例18: pictureBox1_Click
private void pictureBox1_Click(object sender, EventArgs e)
{
if(e.GetType() == typeof(MouseEventArgs))
{
MouseEventArgs me = e as MouseEventArgs;
Coords co = new Coords(me.Location.ToString());
coords.Add(co);
textOutput.Text += me.Location.ToString() + " ";
}
}
开发者ID:guygoudeau,项目名称:Homework,代码行数:10,代码来源:Form1.cs
示例19: ChangeMap
/// <summary>
/// Method to change the "room"
/// Loads the saved (previously visited) version of the next room if possible
/// and the generated version if there is no saved one
/// </summary>
/// <param name="filename">The path to the .xml of the next room</param>
/// <param name="pos">The spawning position in the next room</param>
public override void ChangeMap(string filename, Coords pos)
{
map.Save("savedroom" + map.id + ".xml");
if (File.Exists("save\\auto\\saved" + filename))
map.Load("saved" + filename, pos, false);
else
map.Load(filename, pos, false);
map.Save("saved" + filename);
File.WriteAllText("save\\auto\\GameData", filename);
}
开发者ID:propra13-orga,项目名称:gruppe22,代码行数:17,代码来源:PureLogic.cs
示例20: GamePadThumbStickCondition
public GamePadThumbStickCondition(string name,PlayerIndex playerIndex, ThumbStick thumbStick, Coords coordsType, Operator inputOperator,
float compareValue)
{
Name = name;
Player = playerIndex;
ThumbStick = thumbStick;
CoordsType = coordsType;
Operator = inputOperator;
CompareValue = compareValue;
}
开发者ID:kraidleyaran,项目名称:InputManagerLib,代码行数:10,代码来源:GamePadThumbStickCondition.cs
注:本文中的Coords类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论