本文整理汇总了C#中Tile.Change方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.Change方法的具体用法?C# Tile.Change怎么用?C# Tile.Change使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.Change方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Turn
public void Turn ()
{
if (Random.Range(0, 10) == 0)
Kill();
manager.cascade.UpdateSize();
// Check the four adjacent tiles to make sure that they exist.
// Disqualify mountains and crags
// Also disqualify if last tile occupied
int coordX = currentTile.x;
int coordY = currentTile.y;
List<Tile> candidates = new List<Tile>();
// Four checks
Tile currentCheck;
if (coordY != 0) {
currentCheck = manager.getTile[coordX, coordY-1];
if (currentCheck.type != (int)TileType.tile.MOUNTAIN && (previousTile == null || currentCheck != previousTile))
candidates.Add(currentCheck);
}
if (coordX != 0) {
currentCheck = manager.getTile[coordX-1, coordY];
if (currentCheck.type != (int)TileType.tile.MOUNTAIN && (previousTile == null || currentCheck != previousTile))
candidates.Add(currentCheck);
}
if (coordX != manager.cascade.width-1) {
currentCheck = manager.getTile[coordX+1, coordY];
if (currentCheck.type != (int)TileType.tile.MOUNTAIN && (previousTile == null || currentCheck != previousTile))
candidates.Add(currentCheck);
}
if (coordY != manager.cascade.height-1) {
currentCheck = manager.getTile[coordX, coordY+1];
if (currentCheck.type != (int)TileType.tile.MOUNTAIN && (previousTile == null || currentCheck != previousTile))
candidates.Add(currentCheck);
}
previousTile = currentTile;
if (candidates.Count == 0) {
Kill();
return;
}
currentTile = candidates[Random.Range(0, candidates.Count)];
// Apply air effects here.
currentTile.Change((int)TileType.element.AIR);
manager.Change(manager.objectFromTile[currentTile],currentTile);
Debug.Log(currentTile.x + "," + currentTile.y);
transform.position = new Vector3 (
manager.objectFromTile[currentTile].transform.position.x,
manager.objectFromTile[currentTile].transform.position.y+manager.worldScale.y,
manager.objectFromTile[currentTile].transform.position.z);
}
示例2: StartFire
public void StartFire(Tile newTile)
{
tile = newTile;
tile.fire = true;
burnout = tile.burnout;
MeshFilter filter = gameObject.AddComponent<MeshFilter> ();
MeshRenderer renderer = gameObject.AddComponent<MeshRenderer>();
filter.mesh = Resource.fireMesh;
renderer.material = Resource.fireMaterial;
Vector3 FirePosition =
transform.position = new Vector3 (
manager.objectFromTile[tile].transform.position.x,
manager.objectFromTile[tile].transform.position.y+manager.worldScale.y,
manager.objectFromTile[tile].transform.position.z);
newTile.Change ((int)TileType.element.FIRE);
manager.Change (manager.objectFromTile [tile], tile);
}