//end shareknowledge event public void InfectCityByCard(InfectionCard card) { GameObject cityObject = GameObject.Find(card.ToString()); City cityScript = cityObject.GetComponent <City>(); cityScript.InfectByCard(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; }
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(); }