示例#1
0
    public override void Execute()
    {
        do
        {
            if (cards != null)
            {
                Destroy(cards[0].gameObject);
                Destroy(cards[1].gameObject);
            }

            cards = PlayerAndEnemyDeckHolder.Get2DifferentRandomUnlockedNotMonsterCards(deckSize: 2);
        } while (cards[0].IsAnotherInstanceOf(cards[1]));

        customPopUpOpener.OpenDisplayingCardsToChoose
        (
            title: "Earn a Card",
            warningMessage: "Choose a card to add to your collection, I mean, to become your friend.",
            confirmBtnMessage: "<<< The Leftmost",
            cancelBtnMessage: "The rightmost >>>",
            onConfirm: () => { AddCardClosePopUpClearSpot(0); },
            onCancel: () => { AddCardClosePopUpClearSpot(1); },
            PreMadeAudioRequest.CreateSFX_AND_STOP_BGMAudioRequest(earnCardAudio, audioRequisitor, assignor: gameObject),
            cards
        );
    }
示例#2
0
    public PlaceCard
    (
        Hand hand,
        Battlefield battlefield,
        Deck deck,
        PreMadeAudioRequest placeCardSFX,
        GameObject btnsBackground,
        CustomPopUp customPopUpOpener
    )
    {
        this.hand                = hand;
        this.battlefield         = battlefield;
        this.deck                = deck;
        this.placeCardSFXRequest = placeCardSFX;
        this.btnsBackground      = btnsBackground;
        this.customPopUpOpener   = customPopUpOpener;

        btnsBackground.SetActive(false);

        ClearSelections();

        if (currentBattleStatesFactory == enemyBattleStatesFactory)
        {
            new EnemyAI().PlaceCard(this.hand, battlefield);
        }
    }
示例#3
0
    private PreMadeAudioRequest CreateSFX_AND_STOP_BGMSoundRequest(GameObject assignor, string audioName)
    {
        AudioClip           defeatBGM           = audioHolder.GetAudioByName(audioName);
        PreMadeAudioRequest preMadeAudioRequest =
            PreMadeAudioRequest.CreateSFX_AND_STOP_BGMAudioRequest(defeatBGM, audioRequisitor, assignor);

        return(preMadeAudioRequest);
    }
示例#4
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);
        }
    }
示例#5
0
 public void OpenWithBGM // With Custom Cancel / With BGM
 (
     string title,
     string warningMessage,
     string confirmBtnMessage,
     string cancelBtnMessage,
     OnBtnClicked onConfirm,
     OnBtnClicked onCancel,
     PreMadeAudioRequest openingBGM
 )
 {
     openingBGM.RequestPlaying();
     Open(title, warningMessage, confirmBtnMessage, cancelBtnMessage, onConfirm, onCancel);
 }
示例#6
0
 public void OpenDisplayingUnblockedCardsOfClass
 (
     string title,
     string warningMessage,
     string confirmBtnMessage,
     OnBtnClicked onConfirm,
     PreMadeAudioRequest openingBGM,
     Classes classeOfCardsToShow
 )
 {
     openingBGM.RequestPlaying();
     cardsDisplay.ShowUnlockedCardsOfClass(classeOfCardsToShow);
     OpenAndMakeUncloseable(title, warningMessage, confirmBtnMessage,
                            "",
                            onConfirm: () => { cardsDisplay.ClearAttributes(); onConfirm(); },
                            onCancel: () => {}
                            );
     customCancelBtn.gameObject.SetActive(false);
 }
示例#7
0
 public void OpenDisplayingRewardCards
 (
     string title,
     string warningMessage,
     string confirmBtnMessage,
     OnBtnClicked onConfirm,
     PreMadeAudioRequest openingBGM,
     Card[] cards
 )
 {
     openingBGM.RequestPlaying();
     cardsDisplay.ShowCards(cards);
     OpenAndMakeUncloseable(title, warningMessage, confirmBtnMessage,
                            "",
                            onConfirm: () => { onConfirm(); cardsDisplay.ClearAttributes(); },
                            onCancel: () => {}
                            );
     customCancelBtn.gameObject.SetActive(false);
 }
示例#8
0
 public void OpenDisplayingCardsToChoose
 (
     string title,
     string warningMessage,
     string confirmBtnMessage,
     string cancelBtnMessage,
     OnBtnClicked onConfirm,
     OnBtnClicked onCancel,
     PreMadeAudioRequest openingBGM,
     Card[] cards
 )
 {
     openingBGM.RequestPlaying();
     cardsDisplay.ShowCards(cards);
     OpenAndMakeUncloseable(title, warningMessage, confirmBtnMessage,
                            cancelBtnMessage,
                            onConfirm: () => { onConfirm(); cardsDisplay.ClearAttributes(); },
                            onCancel: () => { onCancel(); cardsDisplay.ClearAttributes(); }
                            );
 }
示例#9
0
 public EndGame(BattleStatesFactory winnerFactory,
                GameObject sceneCanvas,
                ThePopUpOpenerInstance popUpOpener,
                CustomPopUp customPopUpOpener,
                SceneOpener sceneOpener,
                PreMadeAudioRequest victoryBGMRequest,
                PreMadeAudioRequest defeatBGMRequest,
                PreMadeAudioRequest stopAllSFXRequest,
                PreMadeAudioRequest cricketsAudioRequest,
                PreMadeAudioRequest cryingAudioRequest)
 {
     this.winnerFactory        = winnerFactory;
     this.sceneCanvas          = sceneCanvas;
     this.popUpOpener          = popUpOpener;
     this.customPopUpOpener    = customPopUpOpener;
     this.sceneOpener          = sceneOpener;
     this.victoryBGMRequest    = victoryBGMRequest;
     this.defeatBGMRequest     = defeatBGMRequest;
     this.stopAllSFXRequest    = stopAllSFXRequest;
     this.cricketsAudioRequest = cricketsAudioRequest;
     this.cryingAudioRequest   = cryingAudioRequest;
 }
示例#10
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();
        }
    }
示例#11
0
 private PreMadeAudioRequest CreateSFXRequestUsingTheName(GameObject assignor, string audioName)
 {
     return(PreMadeAudioRequest.CreateSFXSoundRequest
                (audioHolder.GetAudioByName(audioName), audioRequisitor, assignor));
 }
示例#12
0
 private PreMadeAudioRequest CreateSFXRequestUsingArrayOfClips(AudioClip[] clips, GameObject assignor)
 {
     return(PreMadeAudioRequest.CreateSFXSoundRequest(clips, audioRequisitor, assignor));
 }
示例#13
0
 public PreMadeAudioRequest CreateStopAllSFXRequest(GameObject assignor)
 {
     return(PreMadeAudioRequest.CreateSTOP_SFXAudioRequest(audioRequisitor, assignor));
 }