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


C# IMap类代码示例

本文整理汇总了C#中IMap的典型用法代码示例。如果您正苦于以下问题:C# IMap类的具体用法?C# IMap怎么用?C# IMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Add

        /// <summary>
        /// ��һ��Map��ӵ�������
        /// </summary>
        /// <param name="Map"></param>
        public void Add(IMap Map)
        {
            if (Map == null)
                throw new Exception("Maps::Add:\r\n�µ�ͼû�г�ʼ��!");

            _mapList.Add(Map);
        }
开发者ID:chinasio,项目名称:minegis,代码行数:11,代码来源:Maps.cs

示例2: BuildCorridor

        private void BuildCorridor(IMap map, MapCell currentCell)
        {
            MapCell nextCell;
            var direction = Dir.Zero;

            bool success;
            do
            {
                _directionPicker.LastDirection = direction;
                _directionPicker.ResetDirections();
                var emptySide = currentCell.Sides
                    .Single(s => s.Value != Side.Wall)
                    .Key;
                success = false;
                do
                {
                    direction = _directionPicker.NextDirectionExcept(emptySide);
                    success = map.TryGetAdjacentCell(currentCell, direction, out nextCell);

                    if (success)
                    {
                        map.CreateCorridorSide(currentCell, nextCell, direction, Side.Empty);
                    }
                } while (_directionPicker.HasDirections && !success);

                if (!success)
                {
                    return;
                }
            } while (currentCell.IsDeadEnd);
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:31,代码来源:SparsifyDeadEndsCommand.cs

示例3: PlanetGenerator

 public PlanetGenerator(IMap map, IRandom random)
 {
     _map = map;
     _random = random;
     MaximumMapSize = new Size(10000,10000);
     MaximumPlanetSize = 250;
 }
开发者ID:LucBos,项目名称:DrunkCodingProject,代码行数:7,代码来源:PlanetGenerator.cs

示例4: frmAttribute

        private IMap pMap = null; // ����pMap

        #endregion Fields

        #region Constructors

        public frmAttribute(IMap ppMap,int iLayerID)
        {
            InitializeComponent();
            pMap = ppMap;
            pLayerID = iLayerID;
            pfrmAttribute = this;
        }
开发者ID:lovelll,项目名称:DQHP,代码行数:13,代码来源:frmAttribute.cs

示例5: FindMyFeatureLayer

 public static IFeatureLayer FindMyFeatureLayer(IMap inMap, string inName)
 {
     string isfound = "false";
     ILayer tempLayer;
     IFeatureLayer goodLayer = new FeatureLayerClass();
     for (int i = 0; i < inMap.LayerCount; i++)
     {
         tempLayer = inMap.get_Layer(i);
         if (tempLayer is IFeatureLayer)
         {
             if (tempLayer.Name == inName)
             {
                 isfound = "true";
                 goodLayer = tempLayer as IFeatureLayer;
             }
         }
     }
     //duplicate name in the map.? How we deal with it
     if (isfound == "true")
     {
         return goodLayer;
     }
     else
     {
         return null;
     }
 }
开发者ID:jiang-ming,项目名称:aerialphotoviewer,代码行数:27,代码来源:Helper.cs

示例6: AdventureStage

 public AdventureStage(IMap map , IStorage storage , User user)
 {
     _User = user;
     _Observeds = new List<IObservedAbility>();
     _Stroage = storage;
     _Map = map;
 }
开发者ID:jiowchern,项目名称:Regulus,代码行数:7,代码来源:AdventureStage.cs

示例7: PathToPlayer

 internal PathToPlayer( Player player, IMap map, Texture2D sprite )
 {
     _player = player;
      _map = map;
      _sprite = sprite;
      _pathFinder = new PathFinder( map );
 }
开发者ID:SourceStep,项目名称:FirstRoguelike,代码行数:7,代码来源:PathToPlayer.cs

示例8: PathFinder

        /// <summary>
        /// Constructs a new PathFinder instance for the specified Map
        /// </summary>
        /// <param name="map">The Map that this PathFinder instance will run shortest path algorithms on</param>
        /// <exception cref="ArgumentNullException">Thrown on null map</exception>
        public PathFinder( IMap map )
        {
            if ( map == null )
             {
            throw new ArgumentNullException( "map", "Map cannot be null" );
             }

             _map = map;
             _graph = new EdgeWeightedDigraph( _map.Width * _map.Height );
             foreach ( Cell cell in _map.GetAllCells() )
             {
            if ( cell.IsWalkable )
            {
               int v = IndexFor( cell );
               foreach ( Cell neighbor in _map.GetBorderCellsInRadius( cell.X, cell.Y, 1 ) )
               {
                  if ( neighbor.IsWalkable )
                  {
                     int w = IndexFor( neighbor );
                     _graph.AddEdge( new DirectedEdge( v, w, 1.0 ) );
                     _graph.AddEdge( new DirectedEdge( w, v, 1.0 ) );
                  }
               }
            }
             }
        }
开发者ID:FaronBracy,项目名称:RogueSharpUnity,代码行数:31,代码来源:PathFinder.cs

示例9: CalculateRoomScore

        private static int CalculateRoomScore(Room room, IMap map, MapCell cell)
        {
            var currentScore = 0;

            foreach (var roomCell in room)
            {
                var currentCell = map[
                    roomCell.Location.X + cell.Location.X,
                    roomCell.Location.Y + cell.Location.Y];

                currentScore += AdjacentCorridorBonus
                    * roomCell.Sides
                        .Count(s => HasAdjacentCorridor(map, currentCell, s.Key));

                if (currentCell.IsCorridor)
                {
                    currentScore += OverlappedCorridorBonus;
                }

                currentScore += OverlappedRoomBonus
                    * map.Rooms.Count(r => r.Bounds.Contains(currentCell.Location));
            }

            return currentScore;
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:25,代码来源:PlaceRoomsCommand.cs

示例10: Create

        public static EffectItem Create( IPoint3D p, IMap map, TimeSpan duration )
        {
            EffectItem item = null;

            for ( int i = m_Free.Count - 1; item == null && i >= 0; --i ) // We reuse new entries first so decay works better
            {
                EffectItem free = (EffectItem) m_Free[i];

                m_Free.RemoveAt( i );

                if ( !free.Deleted && free.Map == Map.Internal )
                    item = free;
            }

            if ( item == null )
            {
                item = new EffectItem();
            }
            else
            {
                item.ItemID = 1;
            }

            item.MoveToWorld( new Point3D( p ), map as Map );
            item.BeginFree( duration );

            return item;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:28,代码来源:EffectItem.cs

示例11: HandleInput

        public bool HandleInput(InputState inputState, IMap map) {
            var potential_new_x = X;
            var potential_new_y = Y;
            bool trying_to_move = false;

            if (inputState.IsLeft(PlayerIndex.One)) {
                potential_new_x = X - speed;
                trying_to_move = true;
            } else if (inputState.IsRight(PlayerIndex.One)) {
                potential_new_x = X + speed;
                trying_to_move = true;
            } else if (inputState.IsUp(PlayerIndex.One)) {
                potential_new_y = Y - speed;
                trying_to_move = true;
            } else if (inputState.IsDown(PlayerIndex.One)) {
                potential_new_y = Y + speed;
                trying_to_move = true;
            }


            if (trying_to_move) {
                if (map.IsWalkable(potential_new_x, potential_new_y)) {
                    var enemy = Global.CombatManager.EnemyAt(potential_new_x, potential_new_y);
                    if (enemy == null) {
                        X = potential_new_x;
                        Y = potential_new_y;
                    } else {
                        Global.CombatManager.Attack(this, enemy);
                    }

                    return true;
                }
            }
            return false;
        }
开发者ID:tyrelsouza,项目名称:roguesharp_learnin,代码行数:35,代码来源:Player.cs

示例12: StepOnButton

 public StepOnButton(string triggerName, bool global, IMap map, Rectangle rect, int id)
     : base(map, rect, id)
 {
     _triggerName = triggerName;
     _global = global;
     _objectType = 84;
 }
开发者ID:MyEyes,项目名称:Igorr,代码行数:7,代码来源:StepOnButton.cs

示例13: ChangeTableName

 public override string ChangeTableName(IMap @from, IMap to) {
     var sql = new StringBuilder("alter table ");
     this.AppendQuotedTableName(sql, from);
     sql.Append(" rename to ");
     this.AppendQuotedTableName(sql, to);
     return sql.ToString();
 }
开发者ID:Polylytics,项目名称:dashing,代码行数:7,代码来源:SqliteDialect.cs

示例14: ExecuteCommand

        protected override void ExecuteCommand(IMap map, DungeonParameters parameters)
        {
            var sparseFactor = parameters.CellSparseFactor;
            var expectedNumberOfRemovedCells =
                   (int)Math.Ceiling(map.Size * (sparseFactor / 100m)) - 1;

            var removedCellsCount = 0;
            var nonWalls = map.Where(c => !c.IsWall).ToList();
            if (!nonWalls.Any())
            {
                throw new InvalidOperationException("All cells are walls.");
            }

            while (removedCellsCount < expectedNumberOfRemovedCells)
            {
                foreach (var cell in nonWalls.Where(c => c.IsDeadEnd).ToList())
                {
                    if (!cell.IsDeadEnd)
                        continue;

                    var emptySide = cell.Sides
                        .Single(s => s.Value != Side.Wall)
                        .Key;

                    map.CreateWall(cell, emptySide);
                    cell.IsCorridor = false;
                    nonWalls.Remove(cell);
                    removedCellsCount++;
                }
            }
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:31,代码来源:SparsifyCellsCommand.cs

示例15: Update

 public override bool Update(IMap map, float seconds)
 {
     bool alive = base.Update(map, seconds);
     Modules.ModuleManager.DoEffect(4, map, -this.Movement, this.Rect.Center, "");
     map.SetGlow(_id, this.MidPosition, Microsoft.Xna.Framework.Color.Green, 20, false, 300);
     return alive;
 }
开发者ID:MyEyes,项目名称:Igorr,代码行数:7,代码来源:SlimeShot.cs


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