当前位置: 首页>>代码示例>>C#>>正文


C# Direction.ApplyToCoordinates方法代码示例

本文整理汇总了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);
 }
开发者ID:Rympex,项目名称:proshine,代码行数:20,代码来源:Map.cs

示例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;
        }
开发者ID:Rympex,项目名称:proshine,代码行数:43,代码来源:GameClient.cs


注:本文中的Direction.ApplyToCoordinates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。