当前位置: 首页>>代码示例>>C#>>正文


C# Tile.RotateDiagonal方法代码示例

本文整理汇总了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());
        }
    }
开发者ID:jreala,项目名称:Numbers,代码行数:28,代码来源:Button.cs

示例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();
            }
        }
    }
开发者ID:jreala,项目名称:Numbers,代码行数:19,代码来源:Button.cs

示例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);
        }
    }
开发者ID:jreala,项目名称:Numbers,代码行数:86,代码来源:Button.cs


注:本文中的Tile.RotateDiagonal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。