/***** There Are 3 Phases For A Quest *****/ //Sponsor Set Up //Player Play Through //Final Results //Needs to take in the sponsor and the Quest in play //Send that player to a setup screen public void Setup(GameObject sponsor) { //string currentCard = GameObject.Find ("CurrentStoryCard").GetComponent<StoryDeckManager> ().getCurrentCard (); numStages = GameObject.FindGameObjectWithTag("StoryCard").GetComponent <Quest>().getStages(); cardsPlayed = 0; logger.test("QuestManager.cs :: Starting Setup for Quest with Sponsor " + sponsor.GetComponent <User>().getName()); spawnStages(numStages, sponsor); //while stages are not elligible for submission wait here //hide stages to players //let the players know how many cards are there, and if it is a test or not }
// 1. King's Recoginition // - This next player(s) to complete a Quest will receive 2 extra shields. public void Kings_Recoginition(User player, Users players) { logger.test("EventsManager.cs :: Event :: Running King's Recoginition."); int shields = player.getShields() + 2; GameObject.Find("GameManager").GetComponent <GameManager> ().KingsRecognition = true; logger.info("EventsManager.cs :: " + player.getName() + " number of shields: " + shields); player.setShields(shields); logger.info("EventsManager.cs :: " + player.getName() + " number of shields: " + shields); }
public void beginTournament(User currentUser, Users Players) { participants = Players.getNumberOfUsers(); logger.info("TournamentManager.cs :: Beginning Tournament."); foreach (GameObject currentPlayer in Players.getUsers()) { logger.test("TournamentManager.cs :: Executing Tournament with players " + currentPlayer.GetComponent <User>().getName()); SubmissionZone = Resources.Load("PreFabs/aStage") as GameObject; SubmitButton = Resources.Load("Prefabs/TournamentSubmit") as GameObject; SubmissionZone = Instantiate(SubmissionZone, currentPlayer.transform); SubmitButton = Instantiate(SubmitButton, currentPlayer.transform); if (currentPlayer != currentUser.gameObject) { SubmissionZone.gameObject.SetActive(false); SubmitButton.gameObject.SetActive(false); } } }
public void submitTournamentCard() { GameObject stage = GameObject.FindGameObjectWithTag("Stage"); // HERE Debug.Log("Tournament Submit: " + stage); List <AdventureCard> cards = new List <AdventureCard>(); foreach (Transform j in stage.transform) { //if contains a weapon if (j.gameObject.GetComponent <AdventureCard> ().getType() == "Weapon") { //check if duplicates of weapons if (sameName(j.gameObject.GetComponent <AdventureCard> ().getName(), cards)) { Debug.Log("uh oh!!"); return; } else { Debug.Log("Yay!"); cards.Add(j.gameObject.GetComponent <AdventureCard>()); } } else { Debug.Log("uh oh2!!"); return; } } GameObject game_manager = GameObject.FindGameObjectWithTag("GameController"); game_manager.GetComponent <GameManager>().Tournaments.setCardsSubmitted(true); logger.test("TournamentSubmit.cs :: Setting Cards Submitted to: " + GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>().Tournaments.getCardsSubmitted()); game_manager.GetComponent <GameManager> ().Tournaments.addDictionary(cards, GameObject.FindGameObjectWithTag("Stage").GetComponentInParent <User> ().getName()); //game_manager.GetComponent<GameManager>().advDeck.GetComponent<AdventureDeck>().adventureDeck.Add( foreach (AdventureCard i in cards) { game_manager.GetComponent <GameManager> ().advDeck.GetComponent <AdventureDeck> ().adventureDeck.Add(i.getName()); } }
void Update() { if (Input.GetKeyDown(KeyCode.M)) { Mordred(); } if (Input.GetKeyDown("tab")) { statsToggle = true; PlayerStats = Resources.Load("PreFabs/Stats") as GameObject; PlayerStats = Instantiate(PlayerStats, GameObject.Find("MainUI").transform); displayUsersInfo(); } if (statsToggle == true && Input.GetKeyUp("tab")) { logger.info("GameManager.cs :: 'tab' key has been pressed toggling Player Statistics."); Destroy(PlayerStats.gameObject); foreach (GameObject g in GameObject.FindGameObjectsWithTag("SmallCard")) { Destroy(g); } statsToggle = false; } if (GameObject.Find("Button (1)") != null) { GameObject.Find("Button (1)").GetComponent <Button>().onClick.AddListener(delegate { buttonToggle(); }); } /* BRANDONS QUEST STUFF START */ if (questInPlay) { if (counter < 4) { if (Input.GetKeyDown(KeyCode.UpArrow)) { logger.info("GameManager.cs :: Up Arrow Key has been pressed..."); logger.info("GameManager.cs :: Quest :: Player Sponsoring Quest: player" + playerTurn); Debug.Log(playerTurn + "Sponsoring"); Quests.Setup(gameUsers.findByUserName("Player" + playerTurn).gameObject); passed [playerTurn] = false; sponsorturn = playerTurn; //questInProgress = true; questInPlay = false; counter = 0; } else if (Input.GetKeyDown(KeyCode.DownArrow)) { logger.info("GameManager.cs :: Down Arrow Key has been pressed..."); logger.info("GameManager.cs :: Quest :: Player NOT Sponsoring Quest: player" + playerTurn); Debug.Log(playerTurn + "Not Sponsoring"); playerTurn++; if (playerTurn > 3) { playerTurn = 0; } togglePlayerCanvas(playerTurn); counter++; } } else { logger.info("GameManager.cs :: Quest :: No one has sponsored."); Debug.Log("no one sponsored so continue to next story card"); questInProgress = false; questInPlay = false; questPlaying = false; playerTurn++; counter = 0; if (playerTurn > 3) { playerTurn = 0; } } } if (questInProgress) { //Debug.Log (counter); if (counter < 3) { if (Input.GetKeyDown(KeyCode.UpArrow)) { logger.info("GameManager.cs :: Up Arrow Key has been pressed..."); logger.info("GameManager.cs :: Quest :: Player Joining Quest: player" + playerTurn); Debug.Log(playerTurn + "Joining"); passed [playerTurn] = true; PickUpAdventureCards(playerTurn, 1); playerTurn++; if (playerTurn > 3) { playerTurn = 0; } togglePlayerCanvas(playerTurn); counter++; } else if (Input.GetKeyDown(KeyCode.DownArrow)) { logger.info("GameManager.cs :: Down Arrow Key has been pressed..."); logger.info("GameManager.cs :: Quest :: Player NOT Joining Quest: player" + playerTurn); Debug.Log(playerTurn + "Not Joining"); passed [playerTurn] = false; playerTurn++; if (playerTurn > 3) { playerTurn = 0; } togglePlayerCanvas(playerTurn); counter++; } } else { logger.info("GameManager.cs :: Quest :: Starting runthrough of stages..."); Debug.Log("Starting runthrouhg of stages"); questInProgress = false; questPlaying = true; keepPlaying = true; counter = 0; for (int j = 0; j < passed.Length; j++) { //Debug.Log ("PT: " + j + " bool: " + passed[j]); if (passed[j] == true) { playersPlaying++; } } //start at first player to join, add necessary subzone and subbutton for stage } } if (questPlaying) { if (keepPlaying) { if (counter < 4) { Debug.Log("Counter = " + counter); Debug.Log("Player turn passed: " + playerTurn + " passed = " + passed [playerTurn]); logger.test("GameManager.cs :: Quest :: player" + playerTurn + " has passed to the next stage."); if (passed [playerTurn] == true) //then playthrough with that player { if (stageInt != 6) //then quest not over yet { togglePlayerCanvas(playerTurn); currentUser = gameUsers.findByUserName("Player" + playerTurn).GetComponent <User> (); Quests.Playthrough(currentUser.gameObject, stageInt); counter++; } else //the quest is done { logger.info("GameManager.cs :: Quest :: The Quest has finished."); logger.info("GameManager.cs :: Quest :: The sponsor: player" + sponsorturn + " Picks up cards"); Debug.Log("THE QUEST IS DONE NINJA!!"); Debug.Log("Sponsor is drawing cards"); PickUpAdventureCards(sponsorturn, 6); for (int j = 0; j < passed.Length; j++) { if (passed [j] == true) { Debug.Log("Player: " + j + " is a winner"); User temp = gameUsers.findByUserName("Player" + j).GetComponent <User> (); if (KingsRecognition) { logger.info("GameManager.cs :: Quest :: Kings Recognition is active."); temp.setShields(temp.getShields() + StoryCard.GetComponent <Quest> ().getStages() + 2); KingsRecognition = false; } else { temp.setShields(temp.getShields() + StoryCard.GetComponent <Quest> ().getStages()); } passed [j] = false; } } playerTurn = sponsorturn + 1; if (playerTurn > 3) { playerTurn = 0; } questPlaying = false; } if (questPlaying) { playerTurn++; if (playerTurn > 3) { playerTurn = 0; } } } else if (!allDead) //they didnt pass and need to be incremented; { playerTurn++; if (playerTurn > 3) { playerTurn = 0; } counter++; } else { logger.info("GameManager.cs :: Quest :: Everyone died before the end of the quest."); questPlaying = false; Debug.Log("Sponsor is drawing cards"); logger.info("GameManager.cs :: Quest :: The sponsor: player" + sponsorturn + " Picks up cards"); PickUpAdventureCards(sponsorturn, 6); playerTurn = sponsorturn + 1; if (playerTurn > 3) { playerTurn = 0; } //give sponsor cards; } playersPlaying = 0; for (int j = 0; j < passed.Length; j++) { if (passed[j] == true) { playersPlaying++; logger.info("GameManager.cs :: Quest :: There is " + playersPlaying + " in quest."); } } if (playersPlaying < 1) { logger.info("GameManager.cs :: Quest :: All Players did not pass."); allDead = true; } } else { if (playersPlaying > 0) { counter = 0; stageInt++; Debug.Log("Increasing the stage to: " + stageInt); logger.info("GameManager.cs :: Quest :: Moving on to next stage: " + stageInt); for (int m = 0; m < passed.Length; m++) { if (passed[m] == true) { logger.info("GameManager.cs :: Quest :: player" + m + " has passed. Drawing one card."); Debug.Log("Player: " + m + " is drawing a card"); PickUpAdventureCards(m, 1); } } if (stageInt > StoryCard.GetComponent <Quest>().getStages() - 1) { stageInt = 6; Debug.Log("dont do this"); } } } } } /* BRANDONS QUEST STUFF END */ if (buttonPushed == true) { Instantiate(Resources.Load("PreFabs/MiddleScreen") as GameObject); logger.info("Toggling Middle Screen. Please click before moving on"); togglePlayerCanvas(playerTurn); PickupStoryCards(playerTurn); // PickUpAdventureCards(playerTurn, 1); currentUser = gameUsers.findByUserName("Player" + playerTurn).GetComponent <User> (); logger.info("GameManager.cs :: Next turn: " + currentUser.getName()); if (currentUser.getCards().Count > 12) { logger.info("GameManager.cs :: " + currentUser.getName() + "Hand Count is: " + currentUser.getCards().Count + " cards: Please Discard Cards. "); } handleStoryCards(currentUser); playerTurn++; if (playerTurn > 3) { playerTurn = 0; } buttonPushed = false; /*QUEST START */ if (doThisOnce) { playerTurn--; doThisOnce = false; } /*QUEST END */ } if (Tournaments.getCardsSubmitted() == true) { Tournaments.Tournament(gameUsers, StoryCard.GetComponent <Tournament>()); Destroy(GameObject.FindGameObjectWithTag("TournamentSubmit").gameObject); Destroy(GameObject.FindGameObjectWithTag("Stage").gameObject); starts += 1; startTournament += 1; logger.info("GameManager.cs :: Player" + startTournament + " has submitted their Cards."); if (startTournament == totalUsers) { startTournament = 0; } togglePlayerCanvas(startTournament); if (starts == endTournament) { string winner = Tournaments.endTournament(); if (winner != "") { logger.info("GameManager.cs :: " + winner + " has won the Tournament.."); int shields = gameUsers.findByUserName(winner).GetComponent <User> ().getShields(); int bonus = StoryCard.GetComponent <Tournament> ().getBonusShields(); gameUsers.findByUserName(winner).GetComponent <User> ().setShields(shields + bonus + totalUsers); starts = 0; } } Tournaments.setCardsSubmitted(false); } }
public void populateDeck() { List <string> RList1 = new List <string>() { "Sword", "Saxon Knight", "Battle-ax", "Dagger", "Dragon", "Sir Lancelot", "Lance", "Boar", "Horse", "Test of Valor", "Boar", "Mordred", "Black Knight", "Horse", "Amour", "Sword", "Robber Knight", "Battle-ax", "Thieves" }; List <string> RList2 = new List <string>() { "Horse", "Boar", "Sword", "Saxon Knight", "Horse", "Dagger", "King Pellinore", "Dagger", "Sir Percival", "Giant", "Amour", "Dagger", "Robber Knight", "Sword", "Evil Knight", "Thieves", "Sword" }; List <string> RList3 = new List <string>() { "Queen Iseult", "Saxon Knight", "Sword", "Merlin", "Giant", "Thieves", "Mordred", "Horse", "Saxons", "Amour", "Dagger", "Lance", "Robber Knight", "Battle-ax", "Evil Knight", "Thieves", "Sword" }; List <string> RList4 = new List <string>() { "Battle-ax", "Battle-ax", "Queen Guinevere", "Sword", "Saxon Knight", "Test of Temptation", "Green Knight", "Saxons", "Horse", "Amour", "Amour", "Lance", "Robber Knight", "Battle-ax", "Sword" }; List <string> RList5 = new List <string>() { "Mordred", "King Arthur", "Lance", "Saxons", "Test of Temptation", "Sword", "Saxon Knight", "Green Knight", "Mordred", "Dagger", "Evil Knight", "Sword", "Evil Knight", "Thieves", "Sword" }; List <string> RList6 = new List <string>() { "Sir Gawain", "Excalibur", "Amour", "Horse", "Test of Morgan Le Fey", "Black Knight", "Sword", "Saxon Knight", "Battle-ax", "Horse", "Saxons", "Robber Knight", "Thieves" }; List <string> RList7 = new List <string>() { "Sir Galahad", "Horse", "Excalibur", "Boar", "Test of Morgan Le Fey", "Robber Knight", "Horse", "Amour", "Sword", "Saxon Knight", "Saxons", "Sword", "Battle-ax", "Evil Knight", "Thieves" }; List <string> RList8 = new List <string>() { "Sir Tristan", "Test of Valor", "Lance", "Evil Knight", "Thieves", "Test of the Questing Beast", "Test of the Questing Beast", "Sword", "Saxon Knight", "Lance", "Black Knight", "Horse", "Amour", "Robber Knight" }; logger.info("AdventureDeck.cs :: Populating Deck with cards."); int ranStart = 0; while (RList1.Count != 0 && RList2.Count != 0 && RList3.Count != 0 && RList4.Count != 0 && RList5.Count != 0 && RList6.Count != 0 && RList7.Count != 0 && RList8.Count != 0) { ranStart = Random.Range(1, 8); if (ranStart == 1) { if (RList1.Count >= 1) { int Ran = Random.Range(0, RList1.Count); // Debug.Log (RList1[Ran]); adventureDeck.Add(RList1[Ran]); RList1.RemoveAt(Ran); } else { ranStart = 2; } } if (ranStart == 2) { if (RList2.Count >= 1) { int Ran = Random.Range(0, RList2.Count); // Debug.Log (RList2[Ran]); adventureDeck.Add(RList2[Ran]); RList2.RemoveAt(Ran); } else { ranStart = 3; } } if (ranStart == 3) { if (RList3.Count >= 1) { int Ran = Random.Range(0, RList3.Count); adventureDeck.Add(RList3[Ran]); RList3.RemoveAt(Ran); } else { ranStart = 4; } } if (ranStart == 4) { if (RList4.Count >= 1) { int Ran = Random.Range(0, RList4.Count); adventureDeck.Add(RList4[Ran]); RList4.RemoveAt(Ran); } else { ranStart = 5; } } if (ranStart == 5) { if (RList1.Count >= 1) { int Ran = Random.Range(0, RList5.Count); adventureDeck.Add(RList5[Ran]); RList5.RemoveAt(Ran); } else { ranStart = 6; } } if (ranStart == 6) { if (RList6.Count >= 1) { int Ran = Random.Range(0, RList6.Count); adventureDeck.Add(RList6[Ran]); RList6.RemoveAt(Ran); } else { ranStart = 7; } } if (ranStart == 7) { if (RList7.Count >= 1) { int Ran = Random.Range(0, RList7.Count); adventureDeck.Add(RList7[Ran]); RList7.RemoveAt(Ran); } else { ranStart = 8; } } if (ranStart == 8) { if (RList8.Count >= 1) { int Ran = Random.Range(0, RList8.Count); adventureDeck.Add(RList8[Ran]); RList8.RemoveAt(Ran); } else { break; } } /* * adventureDeck.Add("Saxon Knight", 8); * adventureDeck.Add("Sir Gawain", 1); * adventureDeck.Add("Test of Temptation", 2); * adventureDeck.Add("Sir Percival", 1); * adventureDeck.Add("Test of the Questing Beast", 2); * adventureDeck.Add("Sir Lancelot", 1); * adventureDeck.Add("Sir Tristan", 1); * adventureDeck.Add("Lance", 6); * adventureDeck.Add("Merlin", 1); * adventureDeck.Add("Test of Morgan Le Fey", 2); * adventureDeck.Add("Dagger", 6); * adventureDeck.Add("Sir Galahad", 1); * adventureDeck.Add ("Amour", 8); * adventureDeck.Add("Mordred", 4); * adventureDeck.Add("Horse", 11); * adventureDeck.Add("King Arthur", 1); * adventureDeck.Add("Thieves", 8); * adventureDeck.Add("Boar", 4); * adventureDeck.Add("Sword", 16); * adventureDeck.Add("Robber Knight", 7); * adventureDeck.Add("Green Knight", 2); * adventureDeck.Add("Giant", 2); * adventureDeck.Add("Queen Guinevere", 1); * adventureDeck.Add("Test of Valor", 2); * adventureDeck.Add("Queen Iseult", 1); * adventureDeck.Add("King Pellinore", 1); * adventureDeck.Add("Saxons", 5); * adventureDeck.Add("Excalibur", 2); * adventureDeck.Add("Dragon", 1); * adventureDeck.Add("Evil Knight", 6); * adventureDeck.Add("Battle-ax", 8); * adventureDeck.Add("Black Knight", 3); */ } logger.test("AdventureDeck.cs :: Adventure advDeck has been created. with sizes of " + getSizeOfDeck()); }
public void handleStoryCards(User currentUser) { if (StoryCard.GetComponent <Event> () != null) { Event evnt = StoryCard.GetComponent <Event> (); if (evnt.getName() == "King's Recognition") { logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); logger.test("GameManager.cs :: Event :: Running King's Recognition..."); Events.Kings_Recoginition(currentUser, gameUsers); logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); } else if (evnt.getName() == "Queen's Favor") { logger.test("GameManager.cs :: Event :: Running Queen's Favor."); PickUpAdventureCardsTest(Events.Queens_Favor(gameUsers), 2); } else if (evnt.getName() == "Court Called to Camelot") { logger.info("GameManager.cs :: Player " + playerTurn + " Base Attack. " + currentUser.getbaseAttack()); logger.info("GameManager.cs :: Running Court Called to Camelot."); Events.Court_Called_To_Camelot(gameUsers); logger.info("GameManager.cs :: Player " + playerTurn + " Base Attack. " + currentUser.getbaseAttack()); } else if (evnt.getName() == "Pox") { logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); logger.test("GameManager.cs :: Running Pox."); Events.Pox(currentUser, gameUsers); logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); } else if (evnt.getName() == "Plague") { logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); logger.test("GameManager.cs :: Running Plague."); Events.Plague(currentUser); logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); } else if (evnt.getName() == "Chivalrous Deed") { logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); logger.test("GameManager.cs :: Running Chivalrous Deed."); Events.Chivalrous_Deed(currentUser, gameUsers); logger.info("GameManager.cs :: Player " + playerTurn + " number of shields. " + currentUser.getShields()); } else if (evnt.getName() == "Prosperity Throughout the Realm") { logger.test("GameManager.cs :: Running Prosperity Throughout the Realm."); PickUpAdventureCardsTest(Events.Prosperity_Throughout_The_Realm(gameUsers), 2); } else if (evnt.getName() == "King's Call to Arms") { logger.test("GameManager.cs :: Running King's Call to Arms. (IN PROGRESS)"); } } else if (StoryCard.GetComponent <Quest> () != null) { Quest quest = StoryCard.GetComponent <Quest> (); //Debug.Log ("Players turn = " + playerTurn); //Quests.Setup(gameUsers.findByUserName ("Player" + playerTurn).gameObject); questInPlay = true; //keepPlaying = true; stageInt = 0; logger.test("GameManager.cs :: Quest Name: " + quest.getName()); } else if (StoryCard.GetComponent <Tournament> () != null) { Tournament tournament = StoryCard.GetComponent <Tournament> (); logger.test("GameManager.cs :: Tournament Name: " + tournament.getName()); Debug.Log("GameManager.cs :: Running Tournament : " + tournament.getName()); // for (int n = 0; n < totalUsers; n++) { // if (Input.GetKeyDown ("y")) { // // n++; // } else if (Input.GetKeyDown ("n")) { // n++; // } // } // Tournaments.gameObject.GetComponent <TournamentManager> ().beginTournament(currentUser.gameObject); // Tournaments.gameObject.GetComponent<TournamentManager> ().beginTournament(gameUsers); // if (TournamentManager.gameObject.GetComponent<TournamentManager> ().getTieBreaker () == true) { // // } } }