本文整理汇总了C#中IPosition类的典型用法代码示例。如果您正苦于以下问题:C# IPosition类的具体用法?C# IPosition怎么用?C# IPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPosition类属于命名空间,在下文中一共展示了IPosition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CompareTo
public int CompareTo(IPosition other)
{
NaryPosition otherNary = other as NaryPosition;
if (otherNary != null)
return CompareTo(otherNary);
return 0;
}
开发者ID:JeroenBos,项目名称:ASDE,代码行数:7,代码来源:NaryPosition.cs
示例2: CheckIfFigureOnTheWay
/// <summary>
/// Checks if the figure is on the way that the figures want to move
/// </summary>
/// <param name="position">Position on which the figure moves</param>
/// <param name="board">The game board</param>
/// <exception cref="InvalidPositionException"></exception>
public static void CheckIfFigureOnTheWay(IPosition position, IBoard board)
{
if (board.GetFigureAtPosition(position) != null)
{
throw new InvalidPositionException(GlobalErrorMessages.FigureOnTheWayErrorMessage);
}
}
开发者ID:kskondov,项目名称:King-Survival-4,代码行数:13,代码来源:Validator.cs
示例3: WithinRadiusOf
public static SpatialCriteria WithinRadiusOf(this SpatialCriteriaFactory @this,
double radius,
IPosition position)
{
var coordinate = position.GetCoordinate();
return @this.WithinRadiusOf(radius, coordinate.Longitude, coordinate.Latitude);
}
开发者ID:sibartlett,项目名称:RavenDB.Client.Spatial,代码行数:7,代码来源:SpatialCriteriaFactoryExtensions.cs
示例4: MouseUp
public override void MouseUp(IPosition p, MouseButtons b)
{
if (b == MouseButtons.Left)
{
RectFinish();
}
}
开发者ID:steve-stanton,项目名称:backsight,代码行数:7,代码来源:ZoomRectangleTool.cs
示例5: RobotReportedPosition
private void RobotReportedPosition(int robotId, IPosition position, IHeading heading)
{
if (ReportedPosition != null)
{
ReportedPosition(robotId, position, heading);
}
}
开发者ID:iworm,项目名称:marsexplorer,代码行数:7,代码来源:RobotCollection.cs
示例6: Create
/// <summary>
/// Creates a new <c>PositionGeometry</c> from the supplied position (or casts
/// the supplied position if it's already an instance of <c>PositionGeometry</c>).
/// </summary>
/// <param name="p">The position the geometry should correspond to</param>
/// <returns>A newly created <c>PositionGeometry</c> instance, or the supplied
/// position if it's already an instance of <c>PositionGeometry</c></returns>
public static PositionGeometry Create(IPosition p)
{
if (p is PositionGeometry)
return (p as PositionGeometry);
else
return new PositionGeometry(p.X, p.Y);
}
开发者ID:steve-stanton,项目名称:backsight,代码行数:14,代码来源:PositionGeometry.cs
示例7: AddFigure
/// <summary>
/// Add the specific figure at the specific position on the board
/// </summary>
/// <param name="figure">Figure to be added</param>
/// <param name="position">The position on which the figure should be added</param>
public void AddFigure(IFigure figure, IPosition position)
{
Validator.CheckIfObjectIsNull(figure);
Validator.CheckIfPositionValid(position);
this.board[position.Row, position.Col] = figure;
this.figurePositionsOnBoard[figure.DisplaySign] = position;
}
开发者ID:kskondov,项目名称:King-Survival-4,代码行数:12,代码来源:Board.cs
示例8: FindOverlapsQuery
/// <summary>
/// Creates a new <c>FindOverlapsQuery</c> (and executes it). The result of the query
/// can then be obtained through the <c>Result</c> property.
/// </summary>
/// <param name="index">The spatial index to search</param>
/// <param name="closedShape">The closed shape defining the search area.</param>
/// <param name="spatialType">The type of objects to look for.</param>
internal FindOverlapsQuery(ISpatialIndex index, IPosition[] closedShape, SpatialType spatialType)
{
m_ClosedShape = new ClosedShape(closedShape);
m_Points = new List<PointFeature>(100);
m_Result = new List<ISpatialObject>(100);
// If we are looking for points or lines, locate points that overlap. Note that
// if the user does not actually want points in the result, we still do a point
// search, since it helps with the selection of lines.
if ((spatialType & SpatialType.Point)!=0 || (spatialType & SpatialType.Line)!=0)
{
index.QueryWindow(m_ClosedShape.Extent, SpatialType.Point, OnPointFound);
// Remember the points in the result if the caller wants them
if ((spatialType & SpatialType.Point)!=0)
m_Result.AddRange(m_Points.ToArray());
}
// Find lines (this automatically includes lines connected to the points we just found)
if ((spatialType & SpatialType.Line)!=0)
index.QueryWindow(m_ClosedShape.Extent, SpatialType.Line, OnLineFound);
// Find any overlapping text
if ((spatialType & SpatialType.Text)!=0)
index.QueryWindow(m_ClosedShape.Extent, SpatialType.Text, OnTextFound);
m_Result.TrimExcess();
m_Points = null;
}
开发者ID:steve-stanton,项目名称:backsight,代码行数:36,代码来源:FindOverlapsQuery.cs
示例9: CircularArcGeometry
public CircularArcGeometry(ICircleGeometry circle, IPosition bc, IPosition ec, bool isClockwise)
{
m_Circle = circle;
m_BC = PositionGeometry.Create(bc);
m_EC = PositionGeometry.Create(ec);
m_IsClockwise = isClockwise;
}
开发者ID:steve-stanton,项目名称:backsight,代码行数:7,代码来源:CircularArcGeometry.cs
示例10: StandardPlayFieldGenerator
/// <summary>
/// Constructor with 3 parameters
/// </summary>
/// <param name="playerPosition">Parameter of type IPosition</param>
/// <param name="rows">Parameter of type int</param>
/// <param name="cols">Parameter of type int</param>
public StandardPlayFieldGenerator(IPosition playerPosition, int rows = Constants.StandardGameLabyrinthRows, int cols = Constants.StandardGameLabyrinthCols)
{
this.playField = new ICell[rows, cols];
this.playerPosition = playerPosition;
this.rows = rows;
this.cols = cols;
}
开发者ID:HQC-Team-Labyrinth-2,项目名称:Labyrinth-2,代码行数:13,代码来源:StandardPlayFieldGenerator.cs
示例11: AddFigure
public void AddFigure(IFigure figure, IPosition position)
{
Validator.CheckIfObjectIsNull(figure, GlobalErrorMessages.NullFigureErrorMessage);
Validator.CheckIfPositionValid(position, GlobalErrorMessages.PositionNotValidMessage);
this.board[position.Row, position.Col] = figure;
this.figurePositionsOnBoard[figure.DisplayName] = position;
}
开发者ID:Fatme,项目名称:King-Survival-4,代码行数:7,代码来源:Board.cs
示例12: Parse
public static MediaQuery Parse(string value, IPosition forPosition)
{
if (value.Contains(','))
{
var parts = value.Split(',');
var ret = new List<MediaQuery>();
foreach (var part in parts)
{
ret.Add(Parse(part.Trim(), forPosition));
}
if (ret.Count == 1) return ret[0];
return new CommaDelimitedMedia(ret, forPosition);
}
if (value.StartsWith("only ", StringComparison.InvariantCultureIgnoreCase))
{
return new OnlyMedia(ParseQuery(value.Substring("only ".Length).Trim(), forPosition), forPosition);
}
if (value.StartsWith("not ", StringComparison.InvariantCultureIgnoreCase))
{
return new NotMedia(ParseQuery(value.Substring("not ".Length).Trim(), forPosition), forPosition);
}
return ParseQuery(value, forPosition);
}
开发者ID:repos-css,项目名称:More,代码行数:30,代码来源:MediaQueryParser.cs
示例13: CheckIfFigureOnTheWay
public static void CheckIfFigureOnTheWay(IPosition position, IBoard board, string message)
{
if (board.GetFigureAtPosition(position) != null)
{
throw new ArgumentException(message);
}
}
开发者ID:Fatme,项目名称:King-Survival-4,代码行数:7,代码来源:Validator.cs
示例14: CalculateDistance
public static double CalculateDistance(IPosition position1, IPosition position2)
{
var xPortion = (position2.XCoord - position1.XCoord) * (position2.XCoord - position1.XCoord);
var yPortion = (position2.YCoord - position1.YCoord) * (position2.YCoord - position1.YCoord);
return Math.Sqrt(xPortion + yPortion);
}
开发者ID:TBD-Games,项目名称:DodgeballGame,代码行数:7,代码来源:DistanceCalculator.cs
示例15: Goto
public void Goto(IPosition position, bool KeepRunning)
{
var distance = DistanceTo(position);
if (DistanceTo(position) > DistanceTolerance)
{
DateTime duration = DateTime.Now.AddSeconds(5);
var player = api.Entity.GetLocalPlayer();
api.ThirdParty.KeyDown(Keys.NUMPAD8);
while (DistanceTo(position) > DistanceTolerance && DateTime.Now < duration)
{
if ((ViewMode)api.Player.ViewMode != ViewMode.FirstPerson)
{
api.Player.ViewMode = (int)ViewMode.FirstPerson;
}
FaceHeading(position);
System.Threading.Thread.Sleep(30);
}
api.ThirdParty.KeyUp(Keys.NUMPAD8);
}
}
开发者ID:leloulight,项目名称:EasyFarm,代码行数:25,代码来源:EliteMMOWrapper.cs
示例16: MouseMove
public override void MouseMove(IPosition p, MouseButtons b)
{
if (b == MouseButtons.Left)
{
RectUpdate(p);
}
}
开发者ID:steve-stanton,项目名称:backsight,代码行数:7,代码来源:ZoomRectangleTool.cs
示例17: Fill
public virtual IGrid Fill(IPosition position, Mark mark)
{
var grid = new Mark[3, 3];
Array.Copy(_grid, grid, _grid.Length);
grid[position.Row, position.Col] = mark;
return new Grid3X3(grid);
}
开发者ID:alexmiranda,项目名称:tictactoe,代码行数:7,代码来源:Grid3X3.cs
示例18: WhenMarkPosition_TheGridShouldGetUpdatedForTheSamePosition
public void WhenMarkPosition_TheGridShouldGetUpdatedForTheSamePosition(IPosition position)
{
var mock = new Mock<IGrid>();
mock.Setup(x => x.Fill(position, Mark.Cross));
Mark.Cross.On(mock.Object, position);
mock.Verify(x => x.Fill(position, Mark.Cross), Times.Once());
}
开发者ID:alexmiranda,项目名称:tictactoe,代码行数:7,代码来源:MarkTests.cs
示例19: StandardPlayer
private StandardPlayer(string name, int id, IGame game, ICharacter character, IPosition position)
{
this._name = name;
this._id = id;
this._game = game;
this._character = character;
this._position = position;
}
开发者ID:spolnik,项目名称:Magiczny_Miecz_Game,代码行数:8,代码来源:StandardPlayer.cs
示例20: Field
/// <summary>
/// Field constructor that takes an IPosition object as argument
/// </summary>
/// <param name="position">The position for the current IField object</param>
/// <param name="color">The color for the current IField object</param>
/// <param name="chessBoard">The chess board for the current IField object</param>
protected Field(IPosition position, ColorType color, IChessBoard chessBoard)
{
this.ChessBoard = chessBoard;
this.Position = position;
this.Color = color;
this.HasChessPiece = false;
this.IsDrawable = true;
}
开发者ID:BadassGamingCrew,项目名称:Chess-Might-and-Magic,代码行数:14,代码来源:Field.cs
注:本文中的IPosition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论