public void ContinueOrRestart() { if (electionWon) { ElectionScreen.SetActive(false); GameOnScreen.SetActive(true); GameOnObjects.SetActive(true); pt.currentElectionNumber++; pt.AlterPercentApproval(UnityEngine.Random.Range(-10, 2), PoliticsParty.Balance); pt.AlterPercentApproval(UnityEngine.Random.Range(-10, 2), PoliticsParty.Peacenik); pt.AlterPercentApproval(UnityEngine.Random.Range(-10, 2), PoliticsParty.Warhawk); pt.PreviousElectionResult = pt.ElectionResult; } else { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } }
void Help() { if (Input.GetKeyDown(KeyCode.F1)) { if (helpPressed) { helpPressed = false; HelpScreen.SetActive(false); GameOnScreen.SetActive(true); } else { helpPressed = true; HelpScreen.SetActive(true); GameOnScreen.SetActive(false); } } }
public void SetElectionScreen() { ElectionScreen.SetActive(true); GameOnObjects.SetActive(false); GameOnScreen.SetActive(false); ElectionResult.text = Math.Round(pt.ElectionResult, 2).ToString() + "%"; electionSwing = pt.ElectionResult - pt.PreviousElectionResult; ElectionSwing.text = Math.Round(electionSwing, 2).ToString() + "%"; ElectionNumber.text = pt.currentElectionNumber.ToString(); if (pt.ElectionResult >= 50) { ElectionText.text = "You survive to rule for another election cycle"; electionWon = true; } else { ElectionText.text = "You lost your supporter base and will not be re-elected. You lasted for: " + pt.currentElectionNumber.ToString() + " elections"; electionWon = false; } SetContinueOrRestart(); }