Beispiel #1
0
    public void DropPiece()
    {
        if (selectedPiece == null)
        {
            //StateManager.Instance.state = StateManager.State.matching;
            return;
        }

        selectedPiece = null;
        selectBox.anchoredPosition = new Vector2(-432, 0);
        verticalSelectLine.gameObject.SetActive(false);
        horizontalSelectLine.gameObject.SetActive(false);
        cDir = 0;

        if (moving == null || moveAmount == 0)
        {
            //StateManager.Instance.state = StateManager.State.matching;
            return;
        }


        if (moveAmount > 0)
        {
            int j = 8 - moveAmount;
            for (int i = 8; i > 3; i--)
            {
                moving[i].value = moving[j].value;
                moving[i].RestSprite(game.pieces[moving[i].value - 1]);
                j--;
            }
        }
        else if (moveAmount < 0)
        {
            int j = 4 - moveAmount;
            for (int i = 4; i < 9; i++)
            {
                moving[i].value = moving[j].value;
                moving[i].RestSprite(game.pieces[moving[i].value - 1]);
                j++;
            }
        }


        foreach (NodePiece piece in moving)
        {
            piece.MovePositionBack();
        }
        cDir = 0;
        game.UpdateNodeData();
        game.CopyBoard();
        moving = null;
    }
Beispiel #2
0
    public void ForSkillButton()
    {
        if (PlayerData.Instance.currentSP < cost || !game.isCurrentBoardContainDrops(5) || StateManager.Instance.state != StateManager.State.myTurn)
        {
            return;
        }
        PlayerData.Instance.currentSP -= cost;
        List <Node> spList = game.getNodesOfValue(5);

        foreach (Node node in spList)
        {
            NodePiece     p    = node.getPiece();
            RectTransform rect = p.GetComponent <RectTransform>();
            p.value = value;
            node.SetPiece(node.getPiece());
            game.ForSkillChangePieceSprite(node.index, value);
            game.CopyBoard();
            rect.localScale = Vector3.zero;
            rect.DOScale(Vector3.one, 0.3f).SetEase(Ease.OutBack);
        }
    }