本文整理匯總了C#中Server.Point2D類的典型用法代碼示例。如果您正苦於以下問題:C# Point2D類的具體用法?C# Point2D怎麽用?C# Point2D使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Point2D類屬於Server命名空間,在下文中一共展示了Point2D類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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;
}
}
示例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;
}
示例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));
}
示例5: MahjongDealerIndicator
public MahjongDealerIndicator( MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind )
{
m_Game = game;
m_Position = position;
m_Direction = direction;
m_Wind = wind;
}
示例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 );
}
示例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 );
}
示例8: MahjongWallBreakIndicator
public MahjongWallBreakIndicator( MahjongGame game, GenericReader reader )
{
m_Game = game;
int version = reader.ReadInt();
m_Position = reader.ReadPoint2D();
}
示例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;
}
示例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;
}
示例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();
}
示例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 );
}
示例13: Move
public void Move( Point2D position )
{
MahjongPieceDim dim = GetDimensions( position );
if ( !dim.IsValid() )
return;
m_Position = position;
m_Game.Players.SendGeneralPacket( true, true );
}
示例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();
}
示例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];
}