本文整理汇总了C#中Server.Point2D类的典型用法代码示例。如果您正苦于以下问题:C# Point2D类的具体用法?C# Point2D怎么用?C# Point2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Point2D类属于Server命名空间,在下文中一共展示了Point2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TrackingInfo
public TrackingInfo( Mobile tracker, Mobile target )
{
m_Tracker = tracker;
m_Target = target;
m_Location = new Point2D( target.X, target.Y );
m_Map = target.Map;
}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:7,代码来源:Tracking.cs
示例2: CanMoveTo
public override bool CanMoveTo(Point2D newLocation, ref string err)
{
if ( ! base.CanMoveTo (newLocation, ref err) )
return false;
// Care only about absolutes for knights
int dx = Math.Abs( newLocation.X - m_Position.X );
int dy = Math.Abs( newLocation.Y - m_Position.Y );
if ( ! ( ( dx == 1 && dy == 2 ) || ( dx == 2 && dy == 1 ) ) )
{
err = "Knights can only make L shaped moves (2-3 tiles length)";
return false; // Wrong move
}
// Verify target piece
BaseChessPiece piece = m_BChessboard[ newLocation ];
if ( piece == null || piece.Color != m_Color )
return true;
else
{
err = "You can't capture pieces of your same color";
return false;
}
}
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:26,代码来源:Knight.cs
示例3: GetMoves
public override ArrayList GetMoves(bool capture)
{
ArrayList moves = new ArrayList();
for ( int dx = -2; dx <= 2; dx++ )
{
for ( int dy = -2; dy <= 2; dy++ )
{
if ( ! ( ( Math.Abs( dx ) == 1 && Math.Abs( dy ) == 2 ) || ( Math.Abs( dx ) == 2 && Math.Abs( dy ) == 1 ) ) )
continue;
Point2D p = new Point2D( m_Position.X + dx, m_Position.Y + dy );
if ( ! m_BChessboard.IsValid( p ) )
continue;
BaseChessPiece piece = m_BChessboard[ p ];
if ( piece == null )
moves.Add( p );
else if ( capture && piece.Color != m_Color )
moves.Add( p );
}
}
return moves;
}
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:27,代码来源:Knight.cs
示例4: LoadLocations
private static void LoadLocations()
{
string filePath = Path.Combine(Core.BaseDirectory, "Data/treasure.cfg");
ArrayList list = new ArrayList();
ArrayList havenList = new ArrayList();
if (File.Exists(filePath))
{
using (StreamReader ip = new StreamReader(filePath))
{
string line;
while ((line = ip.ReadLine()) != null)
{
try
{
string[] split = line.Split(' ');
int x = Convert.ToInt32(split[0]), y = Convert.ToInt32(split[1]);
Point2D loc = new Point2D(x, y);
list.Add(loc);
}
catch
{
}
}
}
}
m_Locations = (Point2D[])list.ToArray(typeof(Point2D));
}
开发者ID:greeduomacro,项目名称:annox,代码行数:33,代码来源:TreasureMessage.cs
示例5: MahjongDealerIndicator
public MahjongDealerIndicator( MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind )
{
m_Game = game;
m_Position = position;
m_Direction = direction;
m_Wind = wind;
}
开发者ID:Godkong,项目名称:RunUO,代码行数:7,代码来源:MahjongDealerIndicator.cs
示例6: GetDimensions
public static MahjongPieceDim GetDimensions( Point2D position, MahjongPieceDirection direction )
{
if ( direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down )
return new MahjongPieceDim( position, 40, 20 );
else
return new MahjongPieceDim( position, 20, 40 );
}
开发者ID:Godkong,项目名称:RunUO,代码行数:7,代码来源:MahjongDealerIndicator.cs
示例7: Move
/// <summary>
/// Creates a new Move object without capturing a piece
/// </summary>
/// <param name="piece">The chess piece performing the move</param>
/// <param name="target">The target location of the move</param>
public Move( BaseChessPiece piece, Point2D target )
{
m_Piece = piece;
m_From = m_Piece.Position;
m_To = target;
m_Captured = m_Piece.GetCaptured( target, ref m_EnPassant );
}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:12,代码来源:Move.cs
示例8: MahjongWallBreakIndicator
public MahjongWallBreakIndicator( MahjongGame game, GenericReader reader )
{
m_Game = game;
int version = reader.ReadInt();
m_Position = reader.ReadPoint2D();
}
开发者ID:Godkong,项目名称:Origins,代码行数:8,代码来源:MahjongWallBreakIndicator.cs
示例9: FindAhead
//----------------------------------------------------------------------
// Here, we are going to search the quadrant that it is ahead of the player, because
// he is running
//----------------------------------------------------------------------
public static bool FindAhead(
PlayerMobile pm,
Point3D centerPoint,
ref Point3D spawnPoint,
LandType landType,
int distance,
EffectType effectType,
int effectHue
)
{
Direction dir = (Direction)((int)pm.Direction & 0x0f);
Point3D foundPoint = new Point3D();
Tour tour = delegate( Map map, int x, int y )
{
if( Utility.RandomDouble() < .5 ) return false; // break it up a little.
Point2D currentPoint = new Point2D( pm.Location.X + x, pm.Location.Y + y );
if( FindSpawnTileInternal(
pm,
centerPoint,
currentPoint,
ref foundPoint,
landType,
effectType,
effectHue
)
)
{
return true;
}
return false;
};
bool found = Search.Octant(
pm.Map,
dir,
distance,
SearchDirection.Inwards,
tour
);
if( found )
{
spawnPoint.X = foundPoint.X;
spawnPoint.Y = foundPoint.Y;
spawnPoint.Z = foundPoint.Z;
return true;
}
return false;
}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:60,代码来源:SpawnFinder.cs
示例10: MahjongTile
public MahjongTile( MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel, MahjongPieceDirection direction, bool flipped )
{
m_Game = game;
m_Number = number;
m_Value = value;
m_Position = position;
m_StackLevel = stackLevel;
m_Direction = direction;
m_Flipped = flipped;
}
开发者ID:zerodowned,项目名称:angelisland,代码行数:10,代码来源:MahjongTile.cs
示例11: StudyObjective
public StudyObjective( Point2D point, int range, Map map, string[] messages, int seconds ) : base( 1, seconds )
{
Point = point;
Range = range;
Map = map;
Messages = messages;
OnMessage = 0;
CheckTimer();
}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:10,代码来源:StudyObjective.cs
示例12: EndCastle
public void EndCastle( Point2D location )
{
m_HasMoved = true;
m_Move = new Move( this, location );
Point2D worldLocation = m_BChessboard.BoardToWorld( location );
m_Piece.GoTo( worldLocation );
}
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:10,代码来源:King.cs
示例13: Move
public void Move( Point2D position )
{
MahjongPieceDim dim = GetDimensions( position );
if ( !dim.IsValid() )
return;
m_Position = position;
m_Game.Players.SendGeneralPacket( true, true );
}
开发者ID:Godkong,项目名称:Origins,代码行数:11,代码来源:MahjongWallBreakIndicator.cs
示例14: MahjongTile
public MahjongTile( MahjongGame game, GenericReader reader )
{
m_Game = game;
int version = reader.ReadInt();
m_Number = reader.ReadInt();
m_Value = (MahjongTileType) reader.ReadInt();
m_Position = reader.ReadPoint2D();
m_StackLevel = reader.ReadInt();
m_Direction = (MahjongPieceDirection) reader.ReadInt();
m_Flipped = reader.ReadBool();
}
开发者ID:justdanofficial,项目名称:khaeros,代码行数:13,代码来源:MahjongTile.cs
示例15: ToolbarInfo
public ToolbarInfo(
Point2D dimensions, List<string> entries, int skin, List<Point3D> points, int font, bool[] switches)
{
_Dimensions = dimensions;
_Entries = entries;
_Skin = skin;
_Points = points;
_Font = font;
_Phantom = switches[0];
_Stealth = switches[1];
_Reverse = switches[2];
_Lock = switches[3];
}
开发者ID:jasegiffin,项目名称:JustUO,代码行数:13,代码来源:ToolbarInfo.cs
示例16: Move
public void Move( Point2D position, MahjongPieceDirection direction, MahjongWind wind )
{
MahjongPieceDim dim = GetDimensions( position, direction );
if ( !dim.IsValid() )
{
return;
}
m_Position = position;
m_Direction = direction;
m_Wind = wind;
m_Game.Players.SendGeneralPacket( true, true );
}
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:15,代码来源:MahjongDealerIndicator.cs
示例17: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadEncodedInt();
Point = reader.ReadPoint2D();
Range = reader.ReadInt();
Map = reader.ReadMap();
int count = reader.ReadInt();
Messages = new string[ count ];
for ( int i = 0; i < count; i++ )
Messages[i] = reader.ReadString();
OnMessage = reader.ReadInt();
}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:16,代码来源:StudyObjective.cs
示例18: CanMoveTo
public override bool CanMoveTo(Point2D newLocation, ref string err)
{
if ( ! base.CanMoveTo (newLocation, ref err) )
return false;
int dx = newLocation.X - m_Position.X;
int dy = newLocation.Y - m_Position.Y;
if ( Math.Abs( dx ) != Math.Abs( dy ) )
{
err = "Bishops can move only on diagonals";
return false; // Not a diagonal movement
}
int xDirection = dx > 0 ? 1 : -1;
int yDirection = dy > 0 ? 1 : -1;
if ( Math.Abs( dx ) > 1 )
{
// Verify that the path to target is empty
for ( int i = 1; i < Math.Abs( dx ); i++ ) // Skip the bishop square and stop before target
{
int xOffset = xDirection * i;
int yOffset = yDirection * i;
if ( m_BChessboard[ m_Position.X + xOffset, m_Position.Y + yOffset ] != null )
{
err = "Bishops can't move over other pieces";
return false;
}
}
}
// Verify target piece
BaseChessPiece piece = m_BChessboard[ newLocation ];
if ( piece == null || piece.Color != m_Color )
{
return true;
}
else
{
err = "You can't capture pieces of your own color";
return false;
}
}
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:46,代码来源:Bishop.cs
示例19: Move
public void Move( Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea )
{
MahjongPieceDim dim = GetDimensions( position, direction );
int curHandArea = Dimensions.GetHandArea();
int newHandArea = dim.GetHandArea();
if ( !IsMovable || !dim.IsValid() || ( validHandArea >= 0 && ((curHandArea >= 0 && curHandArea != validHandArea) || (newHandArea >= 0 && newHandArea != validHandArea)) ) )
return;
m_Position = position;
m_Direction = direction;
m_StackLevel = -1; // Avoid self interference
m_StackLevel = m_Game.GetStackLevel( dim ) + 1;
m_Flipped = flip;
m_Game.Players.SendTilePacket( this, true, true );
}
开发者ID:zerodowned,项目名称:angelisland,代码行数:17,代码来源:MahjongTile.cs
示例20: GoTo
/// <summary>
/// Moves the NPC to the specified location
/// </summary>
/// <param name="to">The location the NPC should move to</param>
public void GoTo( Point2D to )
{
AI = AIType.AI_Melee;
m_NextMove = new Point3D( to, Z );
if ( m_Piece is Knight )
{
WayPoint end = new WayPoint();
WayPoint start = new WayPoint();
end.MoveToWorld( m_NextMove, Map );
// This is a knight, so do L shaped move
int dx = to.X - X;
int dy = to.Y - Y;
Point3D p = Location; // Point3D is a value type
if ( Math.Abs( dx ) == 1 )
p.X += dx;
else
p.Y += dy;
start.MoveToWorld( p, Map );
start.NextPoint = end;
CurrentWayPoint = start;
m_WayPoints.Add( start );
m_WayPoints.Add( end );
}
else
{
WayPoint wp = new WayPoint();
wp.MoveToWorld( m_NextMove, Map );
CurrentWayPoint = wp;
m_WayPoints.Add( wp );
}
Paralyzed = false;
}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:47,代码来源:ChessMobile.cs
注:本文中的Server.Point2D类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论