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


C# Direction.Select方法代码示例

本文整理汇总了C#中Direction.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Direction.Select方法的具体用法?C# Direction.Select怎么用?C# Direction.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Direction的用法示例。


在下文中一共展示了Direction.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsGoblinAdjacent

    bool IsGoblinAdjacent(Vector2 location, out Vector2 goblinLocation)
    {
        var goblins = EntityManager.GetGoblins ();
        var checkableDirections = new Direction[] {
            Direction.Down,
            Direction.Up,
            Direction.Right,
            Direction.Left
        };

        foreach (var direction in checkableDirections.Select(d => d.ToVector2())) {
            var goblin = goblins.FirstOrDefault (g => g.GetTile ().Position == location + direction);

            if (goblin != null) {
                goblinLocation = goblin.GetTile().Position;
                return true;
            }
        }

        goblinLocation = Vector2.zero;
        return false;
    }
开发者ID:andi2,项目名称:FireStarter,代码行数:22,代码来源:WatchmanManager.cs

示例2: IsFireAdjacent

    bool IsFireAdjacent(Vector2 location, out Vector2 fire)
    {
        var fires = FireManager.GetBurningTiles ();
        var checkableDirections = new Direction[] {
            Direction.Up,
            Direction.Down,
            Direction.Left,
            Direction.Right
        };

        foreach (var direction in checkableDirections.Select(d => d.ToVector2())) {
            var burningTile = fires.FirstOrDefault (f => f.Position == location + direction);

            if (burningTile != null) {
                fire = burningTile.Position;
                return true;
            }
        }

        fire = Vector2.zero;
        return false;
    }
开发者ID:andi2,项目名称:FireStarter,代码行数:22,代码来源:FiremanManager.cs

示例3: MultipleAxisMove

        /// <summary>
        /// 多軸移動
        /// </summary>
        /// <param name="axiss">移動若干軸,依陣列表示</param>
        /// <param name="dirs">表明若干軸,各自移動的方向(正向移動或負向移動),依陣列表示</param>
        /// <param name="velocity">移動若干軸之速度</param>
        public void MultipleAxisMove(Axis[] axiss, Direction[] dirs, int velocity)
        {
            try
            {
                int[] axisList = new int[axiss.Length + 1];
                for (int i = 0; i < axiss.Length; i++)
                {
                    axisList[i] = (int)axiss[i];
                }
                axisList[axiss.Length] = -1;
                var dirList = dirs.Select(s => (int)s).ToArray();
                _ch.JogM(_ch.ACSC_AMF_VELOCITY, axisList, dirList, velocity);

            }
            catch (COMException ex)
            {
                On_ErrorHandler(null, ex);
                _log.Error("MultipleAxisMove, Error={0}", ex.StackTrace);
            }
        }
开发者ID:Joncash,项目名称:ACSMotion,代码行数:26,代码来源:MotionController.cs


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