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


C# Zone.IsInScreen方法代码示例

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


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

示例1: PostProcess

        public void PostProcess(Zone zone, Point globalScreenCoord)
        {
            if (!m_initialized)
            {
                if (zone.TopLeftPosition == globalScreenCoord)
                {
                    m_side = Direction.Right;
                }
                else
                {
                    m_side = Direction.Left;
                }
            }

            ScreenConstructionInfo sci = zone.ScreenConstructionInfos[globalScreenCoord];

            sci.Parameters.Connections[m_side] = Connection.None;

            // create fractal for edge of wall; fill in everything inside that wall

            int primaryCoord = sci.OutsidePts[m_side.RotationCCW];
            int secondaryCoord = sci.EdgePts[m_side.RotationCCW][m_side];
            if (m_side.IsHorizontal) AFractalCreator.swap(ref primaryCoord, ref secondaryCoord);
            Point start = new Point(primaryCoord, secondaryCoord);

            primaryCoord = sci.OutsidePts[m_side.RotationCW];
            secondaryCoord = sci.EdgePts[m_side.RotationCW][m_side];
            if (m_side.IsHorizontal) AFractalCreator.swap(ref primaryCoord, ref secondaryCoord);
            Point end = new Point(primaryCoord, secondaryCoord);

            LineFractalInfo fractal = AFractalCreator.createFractal(start, end);
            List<Point> wall =
                GridUtils.getGridIntersects(
                    fractal.fractal,
                    Zone.TILE_WIDTH,
                    Zone.TILE_HEIGHT,
                    new Dictionary<Point, MetroidAI.GridUtils.TileConfigurer>());

            foreach (Point p in wall)
            {
                zone.BlockedTiles.Add(new KeyValuePair<Point, Point>(globalScreenCoord, p));
                if (zone.IsInScreen(p)) zone.Tiles[globalScreenCoord][p.X, p.Y] = zone.EnvironmentFillInfo.FILL;

                Point next = m_side.Move(p);
                while (zone.IsInScreen(next))
                {
                    zone.BlockedTiles.Add(new KeyValuePair<Point, Point>(globalScreenCoord, next));
                    zone.Tiles[globalScreenCoord][next.X, next.Y] = zone.EnvironmentFillInfo.FILL;
                    next = m_side.Move(next);
                }
            }

            // create a path for the ball

            primaryCoord = sci.OutsidePts[m_side];
            secondaryCoord = sci.PathPts[m_side];
            if (m_side.IsVertical) AFractalCreator.swap(ref primaryCoord, ref secondaryCoord);
            start = new Point(primaryCoord, secondaryCoord);

            primaryCoord =
                (Math.Abs(sci.EdgePts[m_side.RotationCCW][m_side] - sci.OutsidePts[m_side]) >
                 Math.Abs(sci.EdgePts[m_side.RotationCW][m_side] - sci.OutsidePts[m_side]))
                 ? sci.EdgePts[m_side.RotationCCW][m_side] : sci.EdgePts[m_side.RotationCW][m_side];
            secondaryCoord = sci.PathPts[m_side];
            if (m_side.IsVertical) AFractalCreator.swap(ref primaryCoord, ref secondaryCoord);
            end = new Point(primaryCoord, secondaryCoord);

            LineFractalInfo line = AFractalCreator.createLine(start, end);

            List<Point> path =
                GridUtils.getGridIntersects(
                    line.fractal,
                    Zone.TILE_WIDTH,
                    Zone.TILE_HEIGHT,
                    new Dictionary<Point, MetroidAI.GridUtils.TileConfigurer>());

            Point endTile = new Point(end.X / Zone.TILE_WIDTH, end.Y / Zone.TILE_HEIGHT);
            zone.TileDebugLabels[globalScreenCoord][endTile] = "End";

            Point insetTile = m_side.Move(endTile);
            zone.TileDebugLabels[globalScreenCoord][insetTile] = "Inset";
            zone.BlockedTiles.Remove(new KeyValuePair<Point, Point>(globalScreenCoord, insetTile));
            zone.Tiles[globalScreenCoord][insetTile.X, insetTile.Y] = zone.EnvironmentFillInfo.EMPTY;

            // clear a 3x3 square above path to guarantee samus can get to the opening
            for (int i = 0; i < 3; ++i)
            {
                Point basePt = m_side.Opposite.Move(endTile, i);
                for (int j = 1; j < 4; ++j)
                {
                    Point cur = Direction.Up.Move(basePt, j);
                    zone.TileDebugLabels[globalScreenCoord][cur] = "Cleared";
                    zone.BlockedTiles.Remove(new KeyValuePair<Point, Point>(globalScreenCoord, cur));
                    if (zone.IsInScreen(cur))
                    {
                        zone.Tiles[globalScreenCoord][cur.X, cur.Y] = zone.EnvironmentFillInfo.EMPTY;
                    }
                }
            }

//.........这里部分代码省略.........
开发者ID:dallasmccall,项目名称:metroid-ai-project,代码行数:101,代码来源:BallLock.cs


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