本文整理汇总了C#中Tile.RotateDiagonal方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.RotateDiagonal方法的具体用法?C# Tile.RotateDiagonal怎么用?C# Tile.RotateDiagonal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.RotateDiagonal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Adjacent
private void Adjacent(Tile tile)
{
if (tile.Value.text != "0")
{
undoTiles.Add(new TileScore(tile, 1));
scoreScript.IncreaseScore(10);
undoScore += 10;
StartCoroutine(tile.RotateDiagonal());
tile.Value.text = (Int32.Parse(tile.Value.text) + 1).ToString();
tile.CanTouch = false;
tile.touchy = tile.CanTouch;
if (Int32.Parse(tile.Value.text) >= 10)
{
tile.UpdateTileImage();
}
}
else
{
if (!tile.CanTouch)
{
openedTiles.Add(tile);
}
tile.CanTouch = true;
tile.touchy = tile.CanTouch;
tile.StartCoroutine(tile.ChangeTileColors());
}
}
示例2: Diagonal
private void Diagonal(Tile tile, Tile adjacent1, Tile adjacent2)
{
if (adjacent1.Value.text != "0" && adjacent2.Value.text != "0")
{
int tileScoreValue = Int32.Parse(adjacent1.Value.text) + Int32.Parse(adjacent2.Value.text) - 2;
undoTiles.Add(new TileScore(tile, tileScoreValue));
scoreScript.IncreaseScore(50);
undoScore += 50;
StartCoroutine(tile.RotateDiagonal());
tile.Value.text = (Int32.Parse(tile.Value.text) + Int32.Parse(adjacent1.Value.text) + Int32.Parse(adjacent2.Value.text) - 2).ToString();
tile.CanTouch = false;
tile.touchy = tile.CanTouch;
if (Int32.Parse(tile.Value.text) >= 10)
{
tile.UpdateTileImage();
}
}
}
示例3: OnTouchUp
void OnTouchUp()
{
touchedTile = gameObject.GetComponent<Tile>();
if(!touchedTile.CanTouch)
{
return;
}
if (tileCondition.GetFirstTouch())
{
tileCondition.SetFirstTouch(false);
tileCondition.DisableTileList();
}
undoTiles = new List<TileScore>();
openedTiles = new List<Tile>();
undoScore = 0;
touchedTile.CanTouch = false;
touchedTile.touchy = touchedTile.CanTouch;
touchedTile.Value.text = (Int32.Parse(touchedTile.Value.text) + 1).ToString();
scoreScript.IncreaseScore(10);
StartCoroutine(touchedTile.RotateDiagonal());
undoTiles.Add(new TileScore(touchedTile, 1));
undoScore += 10;
/*
* If there's a non-zero tile next to the touched tile, increment it by one
*/
// Top Mid
if(touchedTile.TopMid != null)
{
Adjacent(touchedTile.TopMid.GetComponent<Tile>());
}
// Left
if (touchedTile.Left != null)
{
Adjacent(touchedTile.Left.GetComponent<Tile>());
}
// Right
if (touchedTile.Right != null)
{
Adjacent(touchedTile.Right.GetComponent<Tile>());
}
// Bottom Mid
if (touchedTile.BottomMid != null)
{
Adjacent(touchedTile.BottomMid.GetComponent<Tile>());
}
/*
* If there's a non-zero tile in a diagonal, take the two adjacent tiles to the diagonal and add them.
*/
// Top Left
if (touchedTile.TopLeft != null && touchedTile.TopMid != null && touchedTile.Left != null)
{
Diagonal(touchedTile.TopLeft.GetComponent<Tile>(), touchedTile.TopMid.GetComponent<Tile>(), touchedTile.Left.GetComponent<Tile>());
}
// Top Right
if (touchedTile.TopRight != null && touchedTile.TopMid != null && touchedTile.Right != null)
{
Diagonal(touchedTile.TopRight.GetComponent<Tile>(), touchedTile.TopMid.GetComponent<Tile>(), touchedTile.Right.GetComponent<Tile>());
}
// Bot Left
if (touchedTile.BottomLeft != null && touchedTile.BottomMid != null && touchedTile.Left != null)
{
Diagonal(touchedTile.BottomLeft.GetComponent<Tile>(), touchedTile.BottomMid.GetComponent<Tile>(), touchedTile.Left.GetComponent<Tile>());
}
// Bot Right
if (touchedTile.BottomRight != null && touchedTile.BottomMid != null && touchedTile.Right != null)
{
Diagonal(touchedTile.BottomRight.GetComponent<Tile>(), touchedTile.BottomMid.GetComponent<Tile>(), touchedTile.Right.GetComponent<Tile>());
}
undo.AddUndo(undoTiles, undoScore, openedTiles);
// Cycle through the modified tiles and check for win
for (int i = 0; i < undoTiles.Count; i++)
{
CheckForWin(undoTiles[i].tile);
}
}