Пример #1
0
    // Assumes that only valid tiles can be pressed.
    // Checking should be done in UpdatePanel.
    public void TilePressed(int _tileID)
    {
        AudioManager.PlayButtonClickSound();

        // Get PlayerPiece to execute move.
        int targetPosX = GameManager.Instance.Player.PosX + (_tileID % 5) - 2;
        int targetPosY = GameManager.Instance.Player.PosY + (_tileID / 5) - 2;

        GameManager.Instance.Player.ExecuteTurn(targetPosX, targetPosY);

        // Dismiss panel.
        ControlAreaManager.SetCardPanelVisibility(CardType.Movement, false);

        // Repeat if any.
        RepeatPanelControls.UseRepeat();
        if (RepeatPanelControls.NumRepeatsLeft > 0)
        {
            // Disable cancel button for future repeats.
            // Players to continue using same repeated card until repeats end.
            mCancelButton.interactable = false;
        }
        else
        {
            // Organise the cards.
            DeckManager.Instance.ReorganiseCards();
            mCancelButton.interactable = true;
        }
    }
Пример #2
0
    public void SelectCard(int _id)
    {
        AudioManager.PlayButtonClickSound();

        RepeatPanelControls.UseRepeat();
        if (RepeatPanelControls.NumRepeatsLeft > 0)
        {
            if (DeckManager.Instance.GetNumCardsInHand() < DeckManager.knMaxCardsInHand - 1)
            {
                mCancelButton.interactable = false;

                DelayAction nextDrawDelay = new DelayAction(1.6f);
                nextDrawDelay.OnActionStart += () => {
                    EventAnimationController.Instance.SetIsAnimating(true);
                    ControlAreaManager.Instance.SetControlBlockerEnabled(true);
                };
                nextDrawDelay.OnActionFinish += () => {
                    EventAnimationController.Instance.SetIsAnimating(false);
                    ControlAreaManager.SetCardPanelVisibility(CardType.MovementJoker, true);
                };
                ActionHandler.RunAction(nextDrawDelay);
            }
            else
            {
                ControlAreaManager.Instance.SetControlBlockerEnabled(false);
                RepeatPanelControls.ClearRepeats();
                mCancelButton.interactable = true;
            }

            GridType _movementType = (GridType)_id;
            DeckManager.Instance.DrawCard(_movementType);
        }
        else
        {
            GridType _movementType = (GridType)_id;
            DeckManager.Instance.DrawCard(_movementType);

            ControlAreaManager.Instance.SetControlBlockerEnabled(false);
            RepeatPanelControls.ClearRepeats();
            mCancelButton.interactable = true;
        }

        // Dismiss panel.
        ControlAreaManager.SetCardPanelVisibility(CardType.MovementJoker, false);

        // Organise the cards.
        DeckManager.Instance.ReorganiseCards();
    }