public void removeCubes(Location loc, Vals.Colour colour) { while (removeCube(loc, colour)) { } ; }
public bool checkOutbreak(Vals.Colour colour) { if (diseaseCubes[(int)colour] == Vals.OUTBREAK_THRESHOLD) { return(true); } return(false); }
public IEnumerator infectionDraw(string name, Vals.Colour colour) { infectionCard.SetActive(true); yield return(new WaitForSeconds(0.3f)); yield return(StartCoroutine(moveAndFlipCard(infectionCard.transform, mapCentre, infectionCardFaces[(int)colour], new Vector3(1, 1, 1)))); infectionCardTitle.text = name; yield return(new WaitForSeconds(Vals.GENERIC_WAIT_TIME)); yield return(StartCoroutine(moveAndShrinkCard(infectionCard.transform, infectionDiscardCentre))); resetPosition(infectionCard, infectionDeck.transform, infectionCardBack, infectionCardTitle); yield break; }
public void treatAction(Location loc, Vals.Colour colour) { bool removeAll = role.treatAction(); if (removeAll || board.isDiseaseCured(colour)) { Debug.Log("clear to remove all"); board.removeCubes(loc, colour); } else { Debug.Log("remove single cube"); board.removeCube(loc, colour); } playerManager.incrementCompletedActions(); }
public IEnumerator cure(int numberOfCardsRequired, Player player, Vals.Colour colourToDiscard) { List <PlayerCard> discarded = new List <PlayerCard>(); yield return(StartCoroutine(overlayUI.requestSelectableFromPlayer(player.getHand(), discarded, Vals.SELECTABLE_PLAYER_CARD, numberOfCardsRequired, colourToDiscard))); diseaseStatus[(int)colourToDiscard] = Vals.DISEASE_CURED; boardUI.diseaseCured(colourToDiscard); if (diseaseCubeSupply[(int)colourToDiscard] == Vals.INITIAL_DISEASE_CUBE_COUNT) { eradicateDisease(colourToDiscard); } playerManager.discardCards(player, discarded); playerManager.updateHand(player); playerManager.incrementCompletedActions(); checkCureVictoryCondition(); }
public bool removeCube(Location loc, Vals.Colour colour) { if (loc.removeCube()) { diseaseCubeSupply[(int)colour]++; if (diseaseStatus[(int)colour] == Vals.DISEASE_CURED && diseaseCubeSupply[(int)colour] == Vals.INITIAL_DISEASE_CUBE_COUNT) { eradicateDisease(colour); } Debug.Log("Removing cube in " + loc.getName()); boardUI.setCubeCount(colour, diseaseCubeSupply[(int)colour]); boardUI.removeCube(loc, colour); return(true); } Debug.Log("no cubes to remove"); return(false); }
public IEnumerator addCube(Location loc, Vals.Colour colour) { GameObject diseaseCube = Instantiate(cubePrefabs[(int)colour], new Vector3(10, 10, 0), Quaternion.identity); diseaseCube.transform.SetParent(loc.transform); float width = exampleLocation.GetComponent <SpriteRenderer>().sprite.bounds.size.x *.35f; Transform[] cubes = loc.transform.GetComponentsInChildren <Transform>(); float space = 2 * width / cubes.Length; float pos = space * (cubes.Length - 1) / 2f; for (int i = 1; i < cubes.Length; i++) { cubes[i].transform.position = new Vector3(loc.transform.position.x - pos, loc.transform.position.y - width, 0); pos -= space; } yield return(new WaitForSeconds(.3f)); }
public IEnumerator outbreakOccurs(Location loc, Vals.Colour cubeColour) { if (!outbreakCitiesThisMove.Contains(loc)) { outbreakCount++; Debug.Log("Outbreak #" + outbreakCount + " in " + loc.getName()); boardUI.increaseOutbreakCounter(outbreakCount); if (outbreakCount == Vals.OUTBREAK_COUNT_LIMIT) { gameFlowManager.gameOver(Vals.GAME_OVER_OUTBREAKS); yield break; } outbreakCitiesThisMove.Add(loc); foreach (Location neighbour in loc.getNeighbours()) { yield return(StartCoroutine(addCube(neighbour, cubeColour))); Debug.Log("Request to add cube in " + neighbour.getName()); } } yield break; }
public IEnumerator addCube(Location loc, Vals.Colour colour) { if (loc.qSpecialistHere()) { yield break; } foreach (Location neighbour in loc.getNeighbours()) { if (neighbour.qSpecialistHere()) { yield break; } } if (loc.checkOutbreak(colour)) { yield return(StartCoroutine(outbreakOccurs(loc, colour))); Debug.Log("Outbreak identified - cube not added"); } else { loc.addCube(colour); Debug.Log("Adding cube in " + loc.getName()); diseaseCubeSupply[(int)colour]--; boardUI.setCubeCount(colour, diseaseCubeSupply[(int)colour]); if (diseaseCubeSupply[(int)colour] == 0) { Debug.Log("out of " + colour); gameFlowManager.gameOver(Vals.GAME_OVER_CUBES); } yield return(StartCoroutine(boardUI.addCube(loc, colour))); } yield break; }
public void diseaseEradicated(Vals.Colour colour) { cureTokens[(int)colour].GetComponent <SpriteRenderer>().sprite = eradicatedSprites[(int)colour]; }
public void setCubeCount(Vals.Colour colour, int count) { cubeReserveText[(int)colour].text = count + ""; }
public void removeCube(Location loc, Vals.Colour colour) { Destroy(loc.transform.GetChild(0).gameObject); }
private void eradicateDisease(Vals.Colour colour) { diseaseStatus[(int)colour] = Vals.DISEASE_ERADICATED; boardUI.diseaseEradicated(colour); }
public bool isDiseaseCured(Vals.Colour colour) { Debug.Log("checking disease " + (int)colour); return(diseaseStatus[(int)colour] > 0 ? true : false); }
public void setPlayerSelectedCube(Vals.Colour colour) { playerSelectedCube = colour; }
public void addCube(Vals.Colour colour) { diseaseCubes[(int)colour]++; }