Пример #1
0
    private void SetCard(CellSlot[] emptyCells, GameObject[] slots, GameObject prevCard)
    {
        var card     = slots[Random.Range(0, slots.Length - 1)].transform.GetChild(0).gameObject;
        var cardProp = card.GetComponent <DragAndDrop>();

        cardProp.SendBeginDragEvent();
        var playerHand = battle.playerHand.GetComponent <CanvasGroup>();

        playerHand.blocksRaycasts = false;
        playerHand.alpha          = 0.5f;

        cardProp.handler          = "bot";
        cardProp.probability      = suitsManager.CalculateProbability(card);
        cardProp.numerator.text   = suitsManager.GetCurrentSuit(card).ToString();
        cardProp.denominator.text = suitsManager.GetCurrentPack().ToString();
        cardProp.decimLine.SetActive(true);
        var cellToDrop = emptyCells[Random.Range(0, emptyCells.Length - 1)];

        battle.MoveCard(prevCard, cellToDrop.gameObject);
        cellToDrop.StartCoroutine(cellToDrop.DropCardFromBot(card));
        StartCoroutine(HideAfterSeconds(prevCard));
    }
Пример #2
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        //if(!Battle.IsPlayerTurn) return;

        startPosition = gameObject.transform;
        if (!IsInCell)
        {
            probability      = suitsManager.CalculateProbability(gameObject);
            numerator.text   = suitsManager.GetCurrentSuit(gameObject).ToString();
            denominator.text = suitsManager.GetCurrentPack().ToString();
            decimLine.SetActive(true);
        }

        if (GameConstants.gameMode == 2)
        {
            handler = "player";
        }

        canvasGroup.blocksRaycasts = false;
        canvasGroup.alpha          = 0.7f;
        SendBeginDragEvent();
    }