public void hooliganCaught(bool isCaught) { if (isCaught) { challenge.hooligansCaught(1); currency.addIncome(10); level.addExp(50); } else { currency.takeIncome(50); } hooligansSpawned++; Destroy(hooligan.gameObject); returnDogs(); hooliganActive = false; hud.showHoundsButton(false); eventActive = false; game.setEventActive(false); timer = 0; if (hooligansSpawned < 2) { startCountdown(Random.Range(20, 30)); } else { hooligansSpawned = 0; } }
public void dogsBought(int amount) { totalDogs += amount; if (totalDogs == 5) { dogsChecks[0].SetActive(true); currency.addIncome(20); totalChallengesFinished++; } else if (totalDogs == 10) { dogsChecks[1].SetActive(true); currency.addIncome(50); totalChallengesFinished++; } else if (totalDogs == 30) { dogsChecks[2].SetActive(true); currency.addIncome(500); totalChallengesFinished++; } }
public void spawnVisitor() { //Spawn up to a certain number of visitors for the park if (visitorCount > 0) { ranNum = Random.Range(0, character.Count); visitor = Instantiate(character[ranNum], transform); allVisitors.Add(visitor); //Place visitor at the starting position on the map visitor.transform.position = mMap.Start.Position; visitor.transform.rotation = Quaternion.identity; visitor.CurrentPosition = mMap.Start; //For each new visitor, add on the entry fee to the total income currency.addIncome(park.getEntryFee()); Invoke("spawnVisitor", 5); visitorCount -= 1; } }
void clearDebris(EnvironmentTile tile) { //Only change the tile is it is appropriate if (Input.GetMouseButtonDown(0)) { Ray screenClick = MainCamera.ScreenPointToRay(Input.mousePosition); if (tile != null) { if (!tile.IsAccessible && !tile.isPaddock) { //Remove the object on top of the tile and set it to accessible if (tile.gameObject.transform.childCount > 0) { //SHOPS if (tile.gameObject.transform.GetChild(0).GetComponent <ConcessionStand>()) { shops.Remove(tile.gameObject.transform.GetChild(0).gameObject); //Give back shop money currency.addIncome(shopCost); //Delete the object Destroy(tile.gameObject.transform.GetChild(0).gameObject); tile.IsAccessible = true; } //DECORATIONS else if (tile.gameObject.transform.GetChild(0).tag == "Decoration") { //Give back the money for destoying decorations currency.addIncome(decorationCost); //Delete the object Destroy(tile.gameObject.transform.GetChild(0).gameObject); tile.IsAccessible = true; } //DEBRIS else if (currency.sufficientFunds(5)) { //clearing debris costs money currency.takeIncome(5); //Delete the object Destroy(tile.gameObject.transform.GetChild(0).gameObject); tile.IsAccessible = true; } } } //PATHS else if (tile.isPath) { tile.isPath = false; tile.IsAccessible = true; int ran = Random.Range(0, grassColours.Count); tile.GetComponent <Renderer>().materials[1].color = grassColours[ran]; currency.addIncome(pathCost); } } else if (Physics.Raycast(screenClick, out mRaycastHits[0])) { if (mRaycastHits[0].transform.tag == "Paddock") { deletionScreen.SetActive(true); deletingObject = mRaycastHits[0].transform.gameObject; } } } }