本文整理汇总了C#中ITile类的典型用法代码示例。如果您正苦于以下问题:C# ITile类的具体用法?C# ITile怎么用?C# ITile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITile类属于命名空间,在下文中一共展示了ITile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Swap
public void Swap(IList<ITile> tiles, ITile first, ITile second)
{
int firstIndex = tiles.IndexOf(first);
int secondIndex = tiles.IndexOf(second);
if (firstIndex == -1 || secondIndex == -1)
return;
tiles[firstIndex] = second;
tiles[secondIndex] = first;
}
示例2: EntityManager
public EntityManager(ITile parent, List<IEntity> entityList)
{
this.entityList = entityList ?? new List<IEntity>();
this.newEntityList = new List<IEntity>();
this.oldEntityList = new List<IEntity>();
this.drawEntityList = new List<IDrawableEntity>();
}
示例3: LavaEntity
public LavaEntity(ITile tile, Texture2D texture, Color color,
bool isBlocked, float layerDepth, int damage, IEntity parent,
IDefendable defender, Vector2 target)
: base(tile)
{
this.destinationRectangle = new Rectangle
{
X = tile.Rectangle.Center.X,
Y = tile.Rectangle.Center.Y,
Height = texture.Height,
Width = texture.Width
};
this.enabled = true;
this.isBlocked = isBlocked;
this.texture = texture;
this.color = Color.White;
this.layerDepth = layerDepth;
this.MoveRate = 5000;
this.tile = tile;
this.parent = parent;
this.Damage = damage;
this.target = target;
this.defender = defender;
this.Position = new Vector2(parent.Rectangle.Center.X, parent.Rectangle.Center.Y);
this.IsFlying = true;
this.isTileMovement = false;
}
示例4: IsTileTheSame
public static bool IsTileTheSame(ITile tile1, ITile tile2)
{
if (tile1.Active != tile2.Active)
return false;
if (tile1.Active)
{
if (tile1.Type != tile2.Type)
return false;
if (Main.tileFrameImportant[(int)tile1.Type])
{
if ((tile1.FrameX != tile2.FrameX) || (tile1.FrameY != tile2.FrameY))
return false;
}
}
return
tile1.Wall == tile2.Wall
&&
tile1.Liquid == tile2.Liquid
&&
tile1.Lava == tile2.Lava
&&
tile1.Wire == tile2.Wire;
}
示例5: TemplateOveridingDefinitionTile
public TemplateOveridingDefinitionTile(string name, ITemplate template, ITile extends,
IEnumerable<TileAttribute> attributes)
: base(name, template, attributes)
{
_extends = extends;
Attributes.MergeTileLazy(_extends);
}
示例6: Move
public override void Move(ITile destination)
{
if (!this.CheckMove(destination))
return;
this.Mvt--;
base.Move(destination);
}
示例7: CheckMove
/// <summary>
/// A Gaul can move twice if it crosses a Plain
/// Cannot cross Water
/// </summary>
/// <param name="destination"></param>
/// <returns></returns>
public override bool CheckMove(ITile destination)
{
if (!destination.IsAdjacent(this.Position) || destination.Type == TileType.Water)
return false;
return base.CheckMove(destination); ;
}
示例8: TowerEntity
public TowerEntity(ITile location, Texture2D texture, Color color,
bool isBlocked, float layerDepth, IEntity owner)
: base(location)
{
this.destinationRectangle = new Rectangle
{
X = location.Rectangle.X,
Y = location.Rectangle.Y,
Height = location.Rectangle.Height,
Width = location.Rectangle.Width
};
this.enabled = true;
this.isBlocked = true;
this.texture = texture;
this.color = color;
this.layerDepth = layerDepth;
this.owner = owner;
this.timer = 5.0f;
this.IsEnemy = false;
this.Intensity = 70.0f;
this.HP = 150;
this.Damage = 100;
this.attackRate = 50;
}
示例9: HardZombieEntity
public HardZombieEntity(ITile location, Texture2D texture, Color color,
bool isBlocked, float layerDepth)
{
this.destinationRectangle = new Rectangle
{
X = location.Rectangle.X,
Y = location.Rectangle.Y,
Height = location.Rectangle.Height,
Width = location.Rectangle.Width
};
this.enabled = true;
this.isBlocked = isBlocked;
this.texture = texture;
this.color = color;
this.layerDepth = layerDepth;
this.MoveRate = 100;
this.Tile = location;
this.IsEnemy = true;
this.Intensity = 0.1f;
this.HP = 10000;
this.Damage = 200;
this.attackRate = 200;
this.moveTask = new MoveTask(this, location);
this.rand = new Random((int)this.Position.X + DateTime.Now.Second);
//this.Memory = new Memory_Tile[Tile_Engine.Map.Width, Tile_Engine.Map.Height];
//this.Map.Add(this.Tile.Clone());
Tile_Engine.Map.Enemies.Add(this);
}
示例10: TransferToTile
public void TransferToTile(ITile next)
{
this.currentTile.RemoveEntity(this.entity);
this.previousTile = this.currentTile;
this.currentTile = next;
this.currentTile.AddEntity(this.entity);
}
示例11: SpriteEntity
public SpriteEntity(ITile location, Texture2D texture, Color color,
bool isBlocked, float layerDepth)
: base(location)
{
this.Rotation = Vector2.Zero.ToRotation();
this.DrawEnding += _OnDrawEnding;
}
示例12: TileManager
public TileManager(IEntity entity, ITile current)
{
this.entity = entity;
this.currentTile = current;
this.previousTile = null;
this.currentTile.AddEntity(this.entity);
}
示例13: CanMove
/// <summary>
/// Checks if the unit can move during this round to a certain destination.
/// The destination must be next to the current position,
/// the unit must have some movement points left,
/// the tile can't be a sea.
/// </summary>
/// <param name="currentPosition">The current position.</param>
/// <param name="currentTile">The current type of tile.</param>
/// <param name="destination">The destination to reach.</param>
/// <param name="tile">The type of tile the destination is.</param>
/// <returns>True if the unit can move to the destination.</returns>
public override bool CanMove(IPoint currentPosition, ITile currentTile, IPoint destination, ITile tile, bool occupied)
{
return !(tile is ISea)
&& destination.IsNext(currentPosition)
&& (remainingMovementPoints >= MOVEMENT_COST
// Special case for movement to lowland.
|| ((tile is ILowland) && remainingMovementPoints >= MOVEMENT_COST / 2));
}
示例14: AddTile
public void AddTile(ITile tile)
{
if (cache.ContainsKey(tile.Name))
{
throw TileException.DoubleDefinition(tile.Name);
}
cache.Add(tile.Name, tile);
}
示例15: Create_ReturnsAUnitWithALocationAndAnOwner
public void Create_ReturnsAUnitWithALocationAndAnOwner(ITile location, Player owner, ICityFactory<City> factory)
{
// :::: ACT ::::
var city = factory.Create(location, owner);
// :::: ASSERT ::::
city.Location.Should().Be(location);
city.Owner.Should().Be(owner);
}