Example #1
0
 //if state == false : no one sponsored. quest ends
 //if state == true  : quest was sponsored so give rewards and adjust turn order to be player after sponsor
 public void EndQuest(bool state, int turnToSetToAfterQuest)
 {
     SponsorButton.SetActive(true);
     for (int i = 0; i < questCard.numberOfStages; i++)
     {
         StageNames[i].SetActive(false);
         qzones[i].gameObject.SetActive(false);
         FlipDropzone(dzones[i], true);
     }
     boardUI.SetActive(false);
     EndTurnBtn.SetActive(false);
     SponsorButton.SetActive(true);
     if (state)
     {
         RewardPlayers();
         RewardSponsor();
     }
     pop.EnableQuestWinnerPopup(questingPlayers, questCard.numberOfStages, sponsorPlayer, players);
     questingPlayers.Clear();
     ClearQzones();
     ClearDropZones(1);
     gameState = false;
     GameController.ReturnControlFromQuest(false, turnToSetToAfterQuest);
 }
Example #2
0
    public override void EndTurn()
    {
        if (hands[turn].cards.Count > 12)
        {
            if (PhotonNetwork.player.ID == turn + 1)
            {
                pop.ActivateDiscard(hands[turn].cards.Count - 12);
                HandleTextFile.WriteLog((Controler.LogLine += 1) + " Player Attenmpted to EndTurn with too many cards. Show discard prompt to active player only #BNF-22", Controler.SName);
            }
        }
        else
        {
            if (phase == BUILD_QUEST)
            {
                if (CheckSponsorQuestZones())
                {
                    //sponsor has set up a valid quest
                    for (int i = 0; i < questCard.numberOfStages; i++)
                    {
                        FlipDropzone(qzones[i], true);
                        qzones[i].transform.position     = qzonePlaceholder.transform.position;
                        StageNames[i].transform.position = qzoneTextPlaceHolder.transform.position;
                        Dragable[] qzone = qzones[i].GetComponentsInChildren <Dragable>();
                        foreach (Dragable thing in qzone)
                        {
                            thing.enabled = false;
                        }
                        qzones[i].GetComponent <Dropable>().enabled = false;
                    }
                    EndTurnBtn.SetActive(false);
                    SponsorButton.SetActive(false);
                    phase = JOIN_QUEST;
                    AdvanceTurn();
                    Dragable[] TempHand = hands[turn].GetComponentsInChildren <Dragable>();
                    foreach (Dragable thing in TempHand)
                    {
                        thing.enabled = false;
                    }
                    if (players[turn].GetComponent <AiPlayer>() != null)
                    {
                        AiBehavior("Join");
                    }
                }
            }

            else if (phase == QUESTING)
            {
                remainingPlayerTurnsInAStage--;
                if (remainingPlayerTurnsInAStage == 0)
                {
                    ResolveStage();
                }
                else
                {
                    AdvanceTurn();
                    if (players[turn].GetComponent <AiPlayer>() != null)
                    {
                        AiBehavior("Play");
                    }
                }
            }

            else
            {
                Debug.Log("DEATH. THIS SHOULD NEVER PRINT");
            }
        }
    }