void Start() { gameOverScript = GameObject.Find("GameOver").GetComponent <GameOverCode>(); kingScript = GameObject.FindGameObjectWithTag("Player").GetComponent <RedKing>(); adState = 0; appID = "ca-app-pub-3934768444739338~3058468135"; rewardedID = "ca-app-pub-3934768444739338/6806141454"; // TEST ID : "ca-app-pub-3940256099942544/5224354917"; // Gerçek ID: ca-app-pub-3934768444739338/6806141454 rewardedAd = RewardBasedVideoAd.Instance; MobileAds.Initialize(appID); isAdLoaded = false; RequestRewardedAd(); }
public void Win(GameOverCode code) { CheckReason(code); completedLevel = true; win = true; string turns; if (turn <= 1) { turns = "turn."; } else { turns = "turns."; } winOrLose.SetText("You Won!"); StatsText.SetText("You made £" + profit + "K in " + turn + " " + turns + "You achieved a social rating of " + social + " and an environmental rating of " + environment + "."); // winScreen.SetActive(true); gameoverAudio.clip = winner; gameOverScreen.SetActive(true); }
public void GameOver(GameOverCode code) { CheckReason(code); lose = true; Analytics analytics = FindObjectOfType <Analytics>(); analytics.SaveStats(); winOrLose.SetText("You lost.."); string turns; if (turn <= 1) { turns = "turn."; } else { turns = "turns."; } StatsText.SetText("You made £" + profit + "K in " + turn + " " + turns + "You achieved a social rating of " + social + " and an environmental rating of " + environment + "."); // gameoverAudio.PlayOneShot(loser); gameoverAudio.clip = loser; gameOverScreen.SetActive(true); }
void CheckReason(GameOverCode code) { switch ((int)code) { // Waste = 0, //NoTurn = 1, //GotTarMoney = 2, //FailTarEco = 3, //FailTarSocial = 4, //FailSocEco = 5, //CompTurn = 6 case 0: { explanationText.SetText("You filled up too much storage with waste! Try and use more environmentally friendly disposal methods."); } break; case 1: { explanationText.SetText("You didn't meet the target with in the number of turns!"); } break; case 2: { explanationText.SetText("You reached the Target amount of money!"); } break; case 3: { explanationText.SetText("You created too much pollution! Try and choose more environmentally friendly options."); } break; case 4: { explanationText.SetText("You failed to keep up the relationship with those around you. Try to choose options that the community around favours."); } break; case 5: { explanationText.SetText("You failed to keep up social and environmental expectations! Keep an eye on those levels next time."); } break; case 6: { explanationText.SetText("You reached the goal within the number of turns!"); } break; case 7: { explanationText.SetText("You ran out of money! You couldn't keep up with factory costs."); } break; } }