本文整理汇总了C#中System.Windows.Vector.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Vector.Clone方法的具体用法?C# Vector.Clone怎么用?C# Vector.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Vector
的用法示例。
在下文中一共展示了Vector.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(int iterations)
{
input.Update(iterations, world, this);
if (!acceleration.IsValid())
acceleration = new Vector(0, 0);
Velocity += acceleration * factor1;
Velocity *= 0.97;
oldPosition = Position.Clone();
Position += Velocity * factor2;
Cell currentCell = GetCurrentCell();
if (currentCell.CellType == CellType.Attractor && Collide(currentCell))
{
Score += 50;
currentCell.CellType = CellType.Normal;
}
foreach (Bumpership b in world.Bumperships.Where(b => b != this && Collide(b)))
{
Position = oldPosition;
Vector oldVelocityA = Velocity.Clone();
Vector oldVelocityB = b.Velocity.Clone();
Velocity = Reflect(Velocity, Normalize(Position - b.Position));
b.Velocity = Reflect(b.Velocity, Normalize(b.Position - Position));
lastcollider = b;
b.lastcollider = this;
if (Velocity.Length > b.Velocity.Length)
{
b.Velocity += oldVelocityA * 0.8;
Velocity *= 0.2;
Score += 5;
b.Score -= 5;
}
else
{
b.Velocity += oldVelocityB * 0.8;
Velocity *= 0.2;
b.Score += 5;
Score -= 5;
}
}
if (currentCell.CellType == CellType.None)
{
if (lastcollider != null)
{
lastcollider.Score += 50;
lastcollider = null;
}
if (IsSpawnable())
{
Score -= 50;
Spawn();
}
}
foreach (Cell cell in GetTouchingCells().Where(Collide))
{
if (cell.CellType == CellType.Blocked && Collide(cell.Position, 0.5))
{
Position = oldPosition;
Velocity = Reflect(Velocity, Normalize(Position - cell.Position));
}
else if (cell.CellType == CellType.Boost)
Velocity *= 1.1;
else if (cell.CellType == CellType.SlowDown)
Velocity *= 0.9;
}
}