本文整理汇总了C#中Direction.ApplyToCoordinates方法的典型用法代码示例。如果您正苦于以下问题:C# Direction.ApplyToCoordinates方法的具体用法?C# Direction.ApplyToCoordinates怎么用?C# Direction.ApplyToCoordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction.ApplyToCoordinates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyCompleteIceMovement
public void ApplyCompleteIceMovement(Direction direction, ref int x, ref int y, ref bool isOnGround)
{
MoveResult result;
do
{
int destinationX = x;
int destinationY = y;
bool destinationGround = isOnGround;
bool isSurfing = false;
direction.ApplyToCoordinates(ref destinationX, ref destinationY);
result = CanMove(direction, destinationX, destinationY, destinationGround, false, false, false);
if (ApplyMovement(direction, result, ref destinationX, ref destinationY, ref destinationGround, ref isSurfing))
{
x = destinationX;
y = destinationY;
isOnGround = destinationGround;
}
}
while (result == MoveResult.Icing);
}
示例2: ApplyMovement
private bool ApplyMovement(Direction direction)
{
int destinationX = PlayerX;
int destinationY = PlayerY;
bool isOnGround = IsOnGround;
bool isSurfing = IsSurfing;
direction.ApplyToCoordinates(ref destinationX, ref destinationY);
Map.MoveResult result = Map.CanMove(direction, destinationX, destinationY, isOnGround, isSurfing, CanUseCut, CanUseSmashRock);
if (Map.ApplyMovement(direction, result, ref destinationX, ref destinationY, ref isOnGround, ref isSurfing))
{
PlayerX = destinationX;
PlayerY = destinationY;
IsOnGround = isOnGround;
IsSurfing = isSurfing;
PositionUpdated?.Invoke(MapName, PlayerX, PlayerY);
if (result == Map.MoveResult.Icing)
{
_movements.Insert(0, direction);
}
if (result == Map.MoveResult.Sliding)
{
int slider = Map.GetSlider(destinationX, destinationY);
if (slider != -1)
{
_slidingDirection = Map.SliderToDirection(slider);
}
}
if (_slidingDirection != null)
{
_movements.Insert(0, _slidingDirection.Value);
}
return true;
}
_slidingDirection = null;
return false;
}