本文整理汇总了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);
}
示例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);
}
示例3: PlanetGenerator
public PlanetGenerator(IMap map, IRandom random)
{
_map = map;
_random = random;
MaximumMapSize = new Size(10000,10000);
MaximumPlanetSize = 250;
}
示例4: frmAttribute
private IMap pMap = null; // ����pMap
#endregion Fields
#region Constructors
public frmAttribute(IMap ppMap,int iLayerID)
{
InitializeComponent();
pMap = ppMap;
pLayerID = iLayerID;
pfrmAttribute = this;
}
示例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;
}
}
示例6: AdventureStage
public AdventureStage(IMap map , IStorage storage , User user)
{
_User = user;
_Observeds = new List<IObservedAbility>();
_Stroage = storage;
_Map = map;
}
示例7: PathToPlayer
internal PathToPlayer( Player player, IMap map, Texture2D sprite )
{
_player = player;
_map = map;
_sprite = sprite;
_pathFinder = new PathFinder( map );
}
示例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 ) );
}
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例12: StepOnButton
public StepOnButton(string triggerName, bool global, IMap map, Rectangle rect, int id)
: base(map, rect, id)
{
_triggerName = triggerName;
_global = global;
_objectType = 84;
}
示例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();
}
示例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++;
}
}
}
示例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;
}