本文整理汇总了C#中Position.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Position.Clone方法的具体用法?C# Position.Clone怎么用?C# Position.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position.Clone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BoarEnemy
public BoarEnemy(ShootingGame game, Position pos)
: base(game)
{
this.Position = pos.Clone();
Radius = 20;
color = DX.GetColor(255, 128, 0);
speed = 3.0;
angle = Math.Atan2(game.OwnChar.Position.Y - Position.Y, game.OwnChar.Position.X - Position.X);
}
示例2: TurnEnemy
public TurnEnemy(ShootingGame game,
Position startPos, int startTime,
Position stopPos, int stopTime,
Position leavePos, int leaveTime,
int interval, int bulletsCount)
: base(game)
{
Radius = 20;
Position = startPos.Clone();
this.StartPos = startPos.Clone();
this.StartTime = startTime;
this.StopPos = stopPos.Clone();
this.StopTime = stopTime;
this.LeavePos = leavePos.Clone();
this.LeaveTime = leaveTime;
this.Interval = interval;
this.BulletsCount = bulletsCount;
}
示例3: ICLonable_Position
public static void ICLonable_Position(
int attempt = 100,
int maxDimention = 3,
int maxCoordinate = 30
)
{
// Standart situation
Random random = new Random();
for (int i = 0; i < attempt; i++)
{
int dimention = random.Next(maxDimention + 1);
int[] coordinate = new int[dimention];
for (int j = 0; j < dimention; j++)
{
coordinate[j] = random.Next(maxCoordinate + 1);
}
Position position = new Position(coordinate);
Position clone = (Position)position.Clone();
// Check;
int length = Math.Max(position.Dimention, clone.Dimention);
for (int k = 0; k < length; k++)
Assert.AreEqual
(position.Coordinate[k], clone.Coordinate[k]);
}
// Unique situation
Position obj = new Position();
Position obj_clone = (Position)obj.Clone();
int length0 = Math.Max(obj.Dimention, obj_clone.Dimention);
for (int k = 0; k < length0; k++)
Assert.AreEqual
(obj.Coordinate[k], obj_clone.Coordinate[k]);
Position obj1 = new Position(new List<int> { });
Position obj_clone1 = (Position)obj.Clone();
int length1 = Math.Max(obj1.Dimention, obj_clone1.Dimention);
for (int k = 0; k < length1; k++)
Assert.AreEqual
(obj1.Coordinate[k], obj_clone1.Coordinate[k]);
}
示例4: RandomWalkerEnemy
public RandomWalkerEnemy(ShootingGame game,
int rangeX1, int rangeY1, int rangeX2, int rangeY2,
Position startPos, Position endPos,
int moveFrame, int stopFrame, int moveCount)
: base(game)
{
Radius = 20;
Position = new Position(320, -20);
this.RangeX1 = rangeX1;
this.RangeY1 = rangeY1;
this.RangeX2 = rangeX2;
this.RangeY2 = rangeY2;
this.StartPos = startPos.Clone();
this.EndPos = endPos.Clone();
this.MoveFrame = moveFrame;
this.StopFrame = stopFrame;
this.MoveCount = moveCount;
prevPos = this.StartPos;
nextPos = new Position((double)Game.Rnd.Next(RangeX1, RangeX2), (double)Game.Rnd.Next(RangeY1, RangeY2));
}
示例5: CssContext
internal CssContext(Position start, Position end)
{
m_start = start.Clone();
m_end = end.Clone();
}