本文整理汇总了C#中Tile.SetParentStage方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.SetParentStage方法的具体用法?C# Tile.SetParentStage怎么用?C# Tile.SetParentStage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.SetParentStage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRandomTiles
public void CreateRandomTiles()
{
for (int h = 0; h < this.size.height; h++)
{
for (int w = 0; w < this.size.width; w++)
{
//with the randomization of the tiles, we're going to randomize whether or not this is buildiable
int rand = JsMath.round(JsMath.random());
//int rand = (new Random()).Next(0, 1);
//check whether the random # is 0 or 1, the long way, because apparently boolean.parse won't figure it out
bool buildable = false;
if (rand == 1)
{
buildable = true;
}
Tile aTile = new Tile("", true, buildable);
aTile.SetParentStage(this);
aTile.SetPosition(w, h);
stageTiles.Add(aTile);
}
}
}
示例2: SetBackgroundTile
public void SetBackgroundTile(Tile tile)
{
for (short row = 0; row < this.size.height; row++)
{
for (short col = 0; col < this.size.width; col++)
{
Tile newTile = new Tile(tile.GetName(), tile.GetWalkable(), tile.GetBuildable());
newTile.SetPosition(col, row);
this.stageTiles.Add(newTile);
newTile.SetParentStage(this);
}
}
}
示例3: AddTile
public Tile AddTile(string name, bool walkable, bool buildable, Point tilePos)
{
// If a tile already exists at this position, destroy it (for now)...
foreach (Tile tile in this.stageTiles)
{
if (tile.GetPosition().x == tilePos.x && tile.GetPosition().y == tilePos.y)
{
//this.stageTiles.Remove(tile);
//tile.Destroy();
tile.SetBuildable(buildable);
tile.SetWalkable(walkable);
tile.SetSprite(Sprite.GetSpriteByName(name));
return tile;
}
}
// (else)
Tile newTile = new Tile(name, walkable, buildable);
newTile.SetPosition(tilePos.x, tilePos.y);
this.stageTiles.Add(newTile);
newTile.SetParentStage(this);
return newTile;
}