Ejemplo n.º 1
0
    public Reposition(Battlefield attackerBattlefield, Battlefield opponentBattlefield, UICustomBtn endRepositioningBtn, GameObject youCanRepositionNowText, GameObject btnsBackground)
    {
        this.attackerBattlefield           = attackerBattlefield;
        this.opponentBattlefield           = opponentBattlefield;
        this.endRepositioningBtn           = endRepositioningBtn;
        this.youCanRepositionNowGameObject = youCanRepositionNowText;

        ClearSelection();

        youCanRepositionNowText.SetActive(true);
        btnsBackground.SetActive(currentBattleStatesFactory == playerBattleStatesFactory);

        if (!alreadyAskedTip && currentBattleStatesFactory == playerBattleStatesFactory)
        {
            TipDragAndDrop.AskToUseTips();
            alreadyAskedTip = true;
        }

        endRepositioningBtn.onClicked = OnEndRepositioningBtnClicked;

        if (currentBattleStatesFactory == enemyBattleStatesFactory)
        {
            new EnemyAI().Reposition(attackerBattlefield, endRepositioningBtn);
        }
        else
        {
            endRepositioningBtn.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 2
0
    public override void ExecuteAction()
    {
        if (shouldDisplayPlaceCardsNowTip)
        {
            shouldDisplayPlaceCardsNowTip = false;
            TipDragAndDrop.ShowPlaceCardsNowTip();
        }
        else if (PlayerIsTryingToReposition())
        {
            ClearSelections();
            shouldDisplayPlaceCardsNowTip = true;
            // I suspect the lag of bringing this UI to the screen was the cause of a bug in which the card couldn't be dropped.
            // That's why the PlaceCardsTip is not being displayed immediatelly.
        }
        else if (ReceivedValidInput())
        {
            Card card = hand.RemoveCardFromSelectedIndex();

            bool smooth = currentBattleStatesFactory == enemyBattleStatesFactory;
            if (smooth)
            {
                battlefield.PutCardInSelectedIndexWithSmoothMovement(card);
            }
            else
            {
                battlefield.PutCardInSelectedIndexThenTeleportToSlot(card);
            }
            cardWasSuccessfullyPlaced = true;

            placeCardSFXRequest.RequestPlaying();

            card.ChangeToHorizontalVersion();
        }
    }
Ejemplo n.º 3
0
 private void Start()
 {
     if (shouldAskForTip)
     {
         TipDragAndDrop.AskToUseTips();
         shouldAskForTip = false;
     }
 }
Ejemplo n.º 4
0
    private void OnEnable()
    {
        if (shouldDisplayTipOnEnable)
        {
            TipDragAndDrop.AskToUseTips();
            shouldDisplayTipOnEnable = false;
        }

        StartCoroutine(OnAFrameAfterEnabled());
    }
Ejemplo n.º 5
0
    public Attack(
        Battlefield attackerBattlefield,
        Battlefield opponentBattleField,
        UICustomBtn endTurnBtn,
        UICustomBtn repositionAgainBtn,
        GameObject toActivate,
        CustomPopUp popUpOpener,
        PreMadeAudioRequest confirmOnUselessAtackSFXRequisitor,
        PreMadeAudioRequest onCancelUselessAtackSFXRequisitor
        )
    {
        this.attackerBattlefield = attackerBattlefield;
        this.opponentBattleField = opponentBattleField;

        obfWasFullAtBeggining = opponentBattleField.IsFull();

        this.repositionAgainBtn = repositionAgainBtn;

        this.toActivate = toActivate;

        this.confirmOnUselessAtackSFXRequisitor = confirmOnUselessAtackSFXRequisitor;
        this.onCancelUselessAtackSFXRequisitor  = onCancelUselessAtackSFXRequisitor;

        toActivate.SetActive(true);

        ClearSelections();

        if (currentBattleStatesFactory == enemyBattleStatesFactory)
        {
            new EnemyAI().Attack(MAX_AMOUNT_OF_ATTACKS, enemyBattlefield: attackerBattlefield, playerBattlefield: opponentBattleField);
        }
        else
        {
            if (shouldAskForTip)
            {
                TipDragAndDrop.AskToUseTips();
                shouldAskForTip = false;
            }
        }

        attackersThatHaveNotAttacked = ListCardsThatCanAttackDuringThisState();
        TOTAL_OF_ATTACKERS           = attackersThatHaveNotAttacked.Count + GetAmountOfCardsThatAlreadyAttacked();

        this.endTurnBtn  = endTurnBtn;
        this.popUpOpener = popUpOpener;

        if (currentBattleStatesFactory == playerBattleStatesFactory)
        {
            endTurnBtn.onClicked = OnClickedEndTurnBtn;
            endTurnBtn.gameObject.SetActive(true);

            repositionAgainBtn.onClicked = OnClickedRepositionAgainBtn;
            repositionAgainBtn.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 6
0
    public EndTurn(Battlefield battlefield, Deck deck, Hand hand, GameObject toDeactivate)
    {
        this.battlefield = battlefield;
        this.deck        = deck;
        this.hand        = hand;

        toDeactivate.SetActive(false);

        // It might be active if there was a Bonus Reposition State
        TipDragAndDrop.HideBonusRepositioningTip();
    }
Ejemplo n.º 7
0
    public BonusReposition
    (
        Hand playerHand,
        Battlefield battlefield,
        Deck deck,
        PreMadeAudioRequest placeCardSFX,
        GameObject btnsBackground,
        CustomPopUp customPopUpOpener,
        Hand opponentHand,
        Deck opponentDeck,
        Text endRepositioningBtnText
    )
        : base
        (
            playerHand,
            battlefield,
            deck,
            placeCardSFX,
            btnsBackground,
            customPopUpOpener
        )
    {
        this.opponentHand = opponentHand;
        this.opponentDeck = opponentDeck;

        if (currentBattleStatesFactory == playerBattleStatesFactory)
        {
            endRepositioningBtnText.text = "Pass ->";
            TipDragAndDrop.ShowBonusRepositioningTip();
        }

        if (!EnemyIsCompletelyDefeated())
        {
            GiveHandBackToDeck();
            GiveBattlefieldBackToHand();
        }
    }
Ejemplo n.º 8
0
 private void Ask()
 {
     TipDragAndDrop.AskToUseTips();
 }
Ejemplo n.º 9
0
 protected void OnGoToRepositionState()
 {
     TipDragAndDrop.HidePlaceCardsNowTip();
 }