public InfectionCard DrawInfectionCard() { InfectionCard tmp = InfectionCardDeck[0]; InfectionCardDeck.Remove(tmp); return(tmp); }
private void OutBreak(GameObject city, string type) { City curCity = city.GetComponent <City>(); List <GameObject> Neighbors = cityManager.GetNeighbors(city); if (curCity.OutbreakFlag == true) { return; } curCity.OutbreakFlag = true; foreach (GameObject City in Neighbors) { City neighbor = City.GetComponent <City>(); InfectionCard temp = (InfectionCard)neighbor.cityNumber; Debug.Log(neighbor.gameObject.name + " outbreak " + neighbor.OutbreakFlag); if (neighbor.GetDiseaseNumber(type) == 3) { OutBreak(neighbor.gameObject, type); } else { initializeDiseaseCubesForCity(temp); neighbor.InfectCity(type); } } curCity.OutbreakFlag = false; }
//end shareknowledge event public void InfectCityByCard(InfectionCard card) { GameObject cityObject = GameObject.Find(card.ToString()); City cityScript = cityObject.GetComponent <City>(); cityScript.InfectByCard(card); }
public InfectionCard RemoveFromBottom() { int tmp = InfectionCardDeck.Count - 1; InfectionCard bottomCard = InfectionCardDeck[tmp]; PutInDiscardPile(bottomCard); InfectionCardDeck.RemoveAt(tmp); return(bottomCard); }
public void TopCardDrawnOnInfectionDrawSimplePasses() { deck.Start(); int count = deck.getInfectionDeck().Count; InfectionCard peek = deck.getInfectionDeck().Peek(); InfectionCard drawn = deck.drawInfectionCard(); Assert.AreEqual(peek.getId(), drawn.getId()); Assert.AreEqual(count - 1, deck.getInfectionDeck().Count); }
public void infectionCardClicked(bool active, InfectionCard card) { if (active) { clickedCards.Add(card); } else { clickedCards.Remove(card); } }
public void initializeDiseaseCubesForCity(InfectionCard card) { GameObject foreground = GameObject.Find("Foreground"); float x1Offset = 5; float y1Offset = 16; float x2Offset = -10; float y2Offset = 0; GameObject city = GameObject.Find(card.ToString()); //int count = 0; //foreach (Transform child in foreground.transform) { //if(count < 48) { string test = city.name + "Blue"; //If disease cubes for a city were already initialized, then return if (GameObject.Find(test) != null) { return; } Vector3 cityPosition = city.transform.position; //For Blue Disease Cube Vector3 blueDiseaseCubePos = new Vector3(cityPosition.x + x1Offset, cityPosition.y + y2Offset, cityPosition.z); GameObject blue = Instantiate(blueDisease); blue.transform.position = blueDiseaseCubePos; blue.name = city.name + "Blue"; blue.transform.parent = GameObject.Find("Foreground").transform; //For Red Disease Cube Vector3 redDiseaseCubePos = new Vector3(cityPosition.x + x2Offset, cityPosition.y + y2Offset, cityPosition.z); GameObject red = Instantiate(redDisease); red.transform.position = redDiseaseCubePos; red.name = city.name + "Red"; red.transform.parent = GameObject.Find("Foreground").transform; //For Black Disease Cube Vector3 blackDiseaseCubePos = new Vector3(cityPosition.x + x2Offset, cityPosition.y + y1Offset, cityPosition.z); GameObject black = Instantiate(blackDisease); black.transform.position = blackDiseaseCubePos; black.name = city.name + "Black"; black.transform.parent = GameObject.Find("Foreground").transform; //For Yellow Disease Cube Vector3 yellowDiseaseCubePos = new Vector3(cityPosition.x + x1Offset, cityPosition.y + y1Offset, cityPosition.z); GameObject yellow = Instantiate(yellowDisease); yellow.transform.position = yellowDiseaseCubePos; yellow.name = city.name + "Yellow"; yellow.transform.parent = GameObject.Find("Foreground").transform; }
public void EpidemicActivate() { infectionRate++; InfectionCard card = deck.RemoveFromBottom(); for (int i = 0; i < 3; i++) { InfectCityByCard(card); initializeDiseaseCubesForCity(card); } deck.DiscardPileOnTop(); }
public IEnumerator TopCardDrawnOnInfectionDrawWithEnumeratorPasses() { InfectionDeck deck = GameObject.Find("InfectionDeck").GetComponent <InfectionDeck>(); // Use the Assert class to test conditions. // Use yield to skip a frame. yield return(null); InfectionCard peek = deck.getInfectionDeck().Peek(); InfectionCard drawn = deck.drawInfectionCard(); Assert.AreEqual(peek.getId(), drawn.getId()); }
public IEnumerator drawPhase() { List <PlayerCard> drawnCards = new List <PlayerCard>(); try { drawnCards.Add(playerDeck.Pop()); drawnCards.Add(playerDeck.Pop()); } catch (InvalidOperationException) { gameFlowManager.gameOver(Vals.GAME_OVER_CARDS); } boardUI.setPlayerDeckCount(playerDeck.Count); yield return(StartCoroutine(cardUI.playerDraw(playerManager.getCurPlayer(), drawnCards[0], drawnCards[1]))); foreach (PlayerCard drawn in drawnCards) { Debug.Log("Player draws " + drawn.getName()); if (drawn.getId() == Vals.EPIDEMIC) { // Increase Step infectionRateTrackIndex++; boardUI.advanceInfectionRateTrack(); // Infect Step InfectionCard epidemicDrawn = epidemicInfectionCards.Pop(); Location loc = epidemicDrawn.getLocation(); infectionDiscardPile.Add(epidemicDrawn); yield return(StartCoroutine(cardUI.infectionDraw(loc.getName(), loc.getColour()))); if (diseaseStatus[(int)loc.getColour()] < Vals.DISEASE_ERADICATED) { for (int j = 0; j < Vals.CUBES_PER_EPIDEMIC_INFECT; j++) { yield return(StartCoroutine(addCube(loc, loc.getColour()))); } } outbreakCitiesThisMove.Clear(); //Intensify Step Utils.ShuffleAndPlaceOnTop(infectionDiscardPile, infectionDeck); } else { if (drawn.getColour() == Vals.Colour.EVENT) { availableEventCards.Add(drawn); Debug.Log("Event drawn"); } playerManager.drawPhaseAdd(drawn); } } yield return(StartCoroutine(playerManager.checkHandLimit(playerManager.getCurPlayer()))); }
public bool containsSpecificInfectionCard(City c) { foreach (PlayerCard card in handCard) { if (card.getType() == CardType.InfectionCard) { InfectionCard aCityCard = (InfectionCard)card; if (aCityCard.getCity() == c) { return(true); } } } return(false); }
public IEnumerator infectionPhase() { for (int i = 0; i < infectionRateTrack[infectionRateTrackIndex]; i++) { InfectionCard drawn = infectionDeck.Pop(); Debug.Log("Infection: " + drawn.getName()); Location loc = drawn.getLocation(); infectionDiscardPile.Add(drawn); yield return(StartCoroutine(cardUI.infectionDraw(drawn.getName(), loc.getColour()))); if (diseaseStatus[(int)loc.getColour()] < Vals.DISEASE_ERADICATED) { yield return(StartCoroutine(addCube(loc, loc.getColour()))); } outbreakCitiesThisMove.Clear(); } }
public void initializeInfectionDeck() { aInfectionDeck.Clear(); List <GameObject> CityMap = GameObject.Find("CityHub").GetComponent <CityHub> ().CityNodeList; for (int i = 0; i < CityMap.Count; i++) { aInfectionDeck.Add(InfectionCard.get(CityMap [i])); } //Shuffling for (int i = 0; i < aInfectionDeck.Count; i++) { GameObject temp = aInfectionDeck[i]; int randomIndex = Random.Range(i, aInfectionDeck.Count); aInfectionDeck[i] = aInfectionDeck[randomIndex]; aInfectionDeck[randomIndex] = temp; } }
public IEnumerator infectCities() { for (int i = Vals.INITIAL_INFECTION_ROUNDS; i > 0; i--) { for (int j = 0; j < Vals.CARDS_PER_INITIAL_INFECTION_ROUND; j++) { InfectionCard drawn = infectionDeck.Pop(); Location loc = drawn.getLocation(); infectionDiscardPile.Add(drawn); yield return(StartCoroutine(cardUI.infectionDraw(drawn.getName(), loc.getColour()))); Debug.Log("Initial infection in " + drawn.getName()); for (int k = 0; k < i; k++) { yield return(StartCoroutine(addCube(loc, loc.getColour()))); } } } }
public void bioDirectFlightButtonClicked() { bioDriveButton.GetComponent <Button>().interactable = false; bioDirectFlightButton.GetComponent <Button>().interactable = false; bioCharterFlightButton.GetComponent <Button>().interactable = false; currentPlayer = game.getCurrentPlayer(); City currentCity = currentPlayer.getPlayerPawn().getCity(); foreach (PlayerCard card in currentPlayer.getHand()) { if (card.getType() == CardType.InfectionCard) { InfectionCard infectionCard = (InfectionCard)card; City infectionCity = infectionCard.getCity(); if (infectionCity != currentCity) { infectionCity.displayButton(); } } } moveStatus = Status.BIODIRECTFLIGHT; }
private void EndTurn(int playerID) { //Debug.Log(ActionTook); Player player = players[playerID - 1]; for (int i = 0; i < 2; i++) { PlayerCard temp = deck.DrawPlayerCard(); if (temp == PlayerCard.Epidemic) { EpidemicActivate(); } player.AddToHand(temp); } for (int j = 0; j < InfectionDrawCard[InfectionRate]; j++) { InfectionCard temp = deck.DrawInfectionCard(); deck.PutInDiscardPile(temp); //Initialize disease cube counters for city City city = GameObject.Find(temp.ToString()).GetComponent <City>(); if (city.GetDiseaseNumber(city.DiseaseType) == 3) { OutBreak(city.gameObject, city.DiseaseType); } else { initializeDiseaseCubesForCity(temp); InfectCityByCard(temp); } } //GiveNextPlayerTurn(); }
public void onBioTerroristSabotage(InfectionCard discard) { }
public void removeInfectionCardFromDiscard(InfectionCard toRemove) { infectionDiscardPile.Remove(toRemove); }
public void InfectByCard(InfectionCard card) { InfectCity(DiseaseType); }
private void InitializeEvent(byte eveCode, object content, int senderId) { if (eveCode != 99) { return; } int seed = (int)content; deck.ShuffleCardInitcialize(seed); //Assign Role int RoleCounts = 23; int role; System.Random rng = new System.Random(seed); ArrayList Roles = new ArrayList(); for (int i = 0; i < RoleCounts; i++) { Roles.Add(i); } for (int i = 0; i < PhotonNetwork.room.PlayerCount; i++) { RoleCounts--; role = rng.Next(RoleCounts); players[i].SetRole((Role)Roles[role]); Roles.RemoveAt(role); } //distribute Cards for (int i = 0; i < PhotonNetwork.room.PlayerCount; i++) { for (int j = 0; j < 5; j++) { PlayerCard temp = deck.DrawPlayerCard(); //Debug.Log(temp); players[i].AddToHand(temp); } } hand.GetCurrentHand(PhotonNetwork.player.ID); //placeRestation City Atlanta = GameObject.Find("Atlanta").GetComponent <City>(); Atlanta.SetResearchStation(PlaceResearchStation(GameObject.Find("Atlanta"), ResearchStation)); //Infect cities int count = 3; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { InfectionCard temp = deck.DrawInfectionCard(); deck.PutInDiscardPile(temp); //Initialize disease cube counters for city initializeDiseaseCubesForCity(temp); for (int z = 0; z < count; z++) { InfectCityByCard(temp); } } count -= 1; } }
public GameData(Game game) { challenge = game.getChallenge(); currentGamePhase = game.getCurrentPhase(); currentPlayerRoleKind = game.getCurrentPlayer().getRoleKind(); infectionRateIndex = game.getInfectionIndex(); outBreakRate = game.getOutbreakRate(); remainingResearch = game.getRemainingResearch(); seed = game.seed; BioTerroristVolunteer = game.BioTerroristVolunteer; currentPlayerIndex = game.currentPlayerIndex; difficulity = game.nEpidemicCard; playerCardDeck = game.getPlayerCardDeckString(); playerDiscardPile = game.getPlayerDiscardPileString(); infectionCardDeck = game.getInfectionDeckString(); infectionDiscardPile = game.getInfectionDiscardPileString(); allHandCards = game.getAllHandCards(); EpidemicCardIntList = EpidemicCard.getEpidemicCard().getIntList(); foreach (City city in game.getCities()) { CityInfo cityInfo = new CityInfo(city); CityInfoList.Add(cityInfo); } foreach (KeyValuePair <Color, Disease> entry in game.getDiseases()) { diseaseInfoList.Add(new DiseaseInfo(entry.Value)); } foreach (Player player in game.getPlayers()) { PlayerCardList playerHand = new PlayerCardList(); mobileHospitalActivated.Add(player.getMobileHospitalActivated()); if (player.getRoleKind() == RoleKind.ContingencyPlanner && player.getEventCardOnTopOfRoleCard() != null) { eventCardOnTopOfRoleCard = player.getEventCardOnTopOfRoleCard().getName(); } if (player.getRoleKind() == RoleKind.FieldOperative) { FOcubes = player.getAllCubes(); } hasCommercialTravelBanInfrontOfPlayer.Add(player.hasEventCardInFront()); //CommercialTravelBanTurn.Add (player.getCommercialTravelBanTurn()); roleKindList.Add(player.getRoleKind()); foreach (PlayerCard pc in player.getHand()) { if (pc.getType().Equals(CardType.CityCard)) { CityCard cityCard = (CityCard)pc; playerHand.playerHand.Add(cityCard.getName()); //Debug.Log ("City Card: " + cityCard.getName()); } else if (pc.getType().Equals(CardType.EventCard)) { EventCard eventCard = (EventCard)pc; playerHand.playerHand.Add(eventCard.getName()); //Debug.Log ("Event Card: " + eventCard.getEventKind()); } else { InfectionCard infectionCard = (InfectionCard)pc; playerHand.playerHand.Add((infectionCard.getName())); //Debug.Log ("Event Card: " + infectionCard.getName()); } } playerCardList.Add(playerHand); } }
public void PutInDiscardPile(InfectionCard card) { InfectionDiscardPile.Add(card); }
void Start() { //PhotonNetwork.OnEventCall += this.OnEventHandler; //PhotonNetwork.EventCallback(0,null,1); PhotonNetwork.OnEventCall += this.testCityhandler; PhotonNetwork.OnEventCall += this.DistributeCardEvent; PhotonNetwork.OnEventCall += this.ShuffleCardEvent; PhotonNetwork.OnEventCall += this.InitializeEvent; PhotonNetwork.OnEventCall += this.DirectFlightEvent; PhotonNetwork.OnEventCall += this.DriveEvent; PhotonNetwork.OnEventCall += this.ShareKnowledgeEvent; PhotonNetwork.OnEventCall += this.ShareKnowledgeRequestEvent; PhotonNetwork.OnEventCall += this.GiveTurnEvent; PhotonNetwork.OnEventCall += this.TreatDiseaseEvent; PhotonNetwork.OnEventCall += this.EndTurnEvent; PhotonNetwork.OnEventCall += this.ResearchStationEvent; PhotonNetwork.OnEventCall += this.NewShareKnowledgeRequestEvent; PhotonNetwork.OnEventCall += this.PlayerDiscardEvent; InfectionCard tmp = deck.DrawInfectionCard(); initializeDiseaseCubesForCity(tmp); InfectCityByCard(tmp); int PlayerNumber = PhotonNetwork.player.ID; switch (PlayerNumber) { case 1: currentPlayer = player1; break; case 2: currentPlayer = player2; break; case 3: currentPlayer = player3; break; default: gameObject.SetActive(false); return; } players[0] = player1; players[1] = player2; players[2] = player3; if (PhotonNetwork.isMasterClient) { //GiveNextPlayerTurn(); GivePlayerTurn(1); RaiseEventOptions opt = new RaiseEventOptions { Receivers = ReceiverGroup.All }; System.Random rnd = new System.Random(); int seed = rnd.Next(); PhotonNetwork.RaiseEvent((byte)99, seed, true, opt); //deck.ShufflePlayerCard (seed); //PhotonNetwork.RaiseEvent ((byte) 101, null, true, opt); } int playerinroom = PhotonNetwork.room.PlayerCount; RectTransform rect = PlayerButtons.GetComponent <RectTransform> (); Debug.Log(playerinroom); while (playerinroom < 4) { rect.GetChild(playerinroom++).gameObject.SetActive(false); //Debug.Log (rect.GetChild (playerinroom).gameObject.name); } }
// Update is called once per frame void Update() { me = game.FindPlayer(PhotonNetwork.player); currentPlayer = game.getCurrentPlayer(); currentCity = currentPlayer.getPlayerPawn().getCity(); me = game.FindPlayer(PhotonNetwork.player); currentPlayer = game.getCurrentPlayer(); if (game.getChallenge() == Challenge.BioTerroist || game.getChallenge() == Challenge.BioTerroistAndVirulentStrain) { bioTerrorist = game.getBioTerrorist(); bioPawn = bioTerrorist.getPawn(); if (me.getRoleKind() == RoleKind.BioTerrorist) { bioTerroristPanel.gameObject.SetActive(true); bioMovePanel.gameObject.SetActive(true); me.getPlayerPawn().gameObject.SetActive(true); } else { basicOperationPanel.gameObject.SetActive(true); movePanel.gameObject.SetActive(true); if (bioTerrorist.getIsSpotted()) { bioPawn.gameObject.SetActive(true); if (currentPlayer == me) { if (!Added) { bioPawn.gameObject.GetComponent <Button> ().onClick.AddListener(() => capture()); Added = true; } } else { bioPawn.gameObject.GetComponent <Button>().onClick.RemoveAllListeners(); Added = false; } } else { bioPawn.gameObject.SetActive(false); } } if (bioTerrorist.getIsCaptured()) { //Debug.Log("Captured bioterrorist"); bioPawn.gameObject.SetActive(true); bioPawn.transform.GetChild(0).gameObject.SetActive(true); } else { bioPawn.transform.GetChild(0).gameObject.SetActive(false); } } else { basicOperationPanel.gameObject.SetActive(true); movePanel.gameObject.SetActive(true); } if (me.getRoleKind() == RoleKind.BioTerrorist && (me == currentPlayer) && (game.getCurrentPhase() == GamePhase.PlayerTakeTurn)) { BioTerrorist bio = game.getBioTerrorist(); if (((me.getRemainingAction() > 0) || !(bio.getBioTerroristExtraDriveUsed())) && !bio.getIsCaptured()) { moveButton.GetComponent <Button>().interactable = true; } else { moveButton.GetComponent <Button>().interactable = false; } if (me.getRemainingAction() > 0) { drawButton.GetComponent <Button>().interactable = true; if (!bio.getIsCaptured()) { infectButton.GetComponent <Button>().interactable = true; if (currentCity.getHasResearch()) { foreach (PlayerCard card in currentPlayer.getHand()) { if (card.getType() == CardType.InfectionCard) { InfectionCard cityCard = (InfectionCard)card; if (cityCard.getColor() == currentCity.getColor()) { sabotageButton.GetComponent <Button>().interactable = true; } } } } escapeButton.GetComponent <Button>().interactable = false; } else if (bio.getIsCaptured()) { infectButton.GetComponent <Button>().interactable = false; sabotageButton.GetComponent <Button>().interactable = false; if (currentPlayer.containsInfectionCard()) { escapeButton.GetComponent <Button>().interactable = true; } else { escapeButton.GetComponent <Button>().interactable = false; } } } else { drawButton.GetComponent <Button>().interactable = false; infectButton.GetComponent <Button>().interactable = false; sabotageButton.GetComponent <Button>().interactable = false; escapeButton.GetComponent <Button>().interactable = false; } passButton.GetComponent <Button>().interactable = true; } else { resetAll(); } }
public void dummyInitialize() { CityCard.initialize(CityNodeList); InfectionCard.initialize(CityNodeList); EpidemicCard.initialize(3); }