public IEnumerator FourMoreYears() { // if the player reaches the end of the timeline, Drumpf gives himself four more years and resets the timeline m_playerInputAllowed = false; AudioManager.instance.PlaySound(AudioManager.SoundType.Reelection); yield return(new WaitForSeconds(0.75f)); AudioManager.instance.PlaySound(AudioManager.SoundType.Character_VocalizePositive); Tweet thisT = new Tweet(); thisT.m_body = "FOUR MORE YEARS!!!"; thisT.m_date = GetDate(m_turnNumber); m_currentTweet = thisT; m_currentTweet.m_id = GameManager.instance.newID; GameObject newTweetOBJ = (GameObject)Instantiate(m_tweetOBJ, m_tweetPanel); newTweetOBJ.transform.localScale = Vector3.one; newTweetOBJ.transform.localEulerAngles = Vector3.zero; newTweetOBJ.transform.localPosition = Vector3.zero; newTweetOBJ.transform.SetAsFirstSibling(); TweetUI t = newTweetOBJ.GetComponent <TweetUI> (); t.Tweet(m_currentTweet, m_tweetPortraitStates[5]); m_tweets.Add(t); m_tweetList.Add(m_currentTweet.m_id, m_currentTweet); m_currentTweet = null; yield return(new WaitForSeconds(1.0f)); m_previousTermTurns += m_maxTurns; m_turnNumber = -1; m_playerInputAllowed = true; yield return(true); }
private IEnumerator NextRoundTimer() { // remove the 'no tweets' text if (m_tweetHeader.m_text.gameObject.activeSelf) { m_tweetHeader.m_text.gameObject.SetActive(false); } // refresh current tweets with updated favs & retweet numbers foreach (TweetUI tUI in m_tweets) { Tweet thisTweet = m_tweetList[tUI.m_ID]; tUI.Tweet(thisTweet, tUI.m_portrait.texture); } yield return(new WaitForSeconds(1.0f)); // phone raises up m_phoneState = PhoneState.Up; m_phone.clip = m_phone.GetClip("Phone_Raise01"); m_phone.Play(); AudioManager.instance.PlaySound(AudioManager.SoundType.Phone_Raise); yield return(new WaitForSeconds(1.0f)); // m_clickReceivers [1].gameObject.SetActive (true); // m_clickReceivers [0].gameObject.SetActive (false); m_currentTweet.m_id = GameManager.instance.newID; // new tweet appears GameObject newTweetOBJ = (GameObject)Instantiate(m_tweetOBJ, m_tweetPanel); newTweetOBJ.transform.localScale = Vector3.one; newTweetOBJ.transform.localEulerAngles = Vector3.zero; newTweetOBJ.transform.localPosition = Vector3.zero; newTweetOBJ.transform.SetAsFirstSibling(); AudioManager.instance.PlaySound(AudioManager.SoundType.Tweet_Sent); TweetUI t = newTweetOBJ.GetComponent <TweetUI> (); // get face state Texture tex = m_tweetPortraitStates[0]; switch (CharacterController.instance.currentFaceState) { case CharacterController.FaceState.Uncertain: tex = m_tweetPortraitStates[1]; break; case CharacterController.FaceState.Distraught: tex = m_tweetPortraitStates[2]; break; case CharacterController.FaceState.Anger: tex = m_tweetPortraitStates[3]; break; case CharacterController.FaceState.Fear: tex = m_tweetPortraitStates[4]; break; } t.Tweet(m_currentTweet, tex); m_tweets.Add(t); m_tweetList.Add(m_currentTweet.m_id, m_currentTweet); m_currentTweet = null; // play audio cue if (UnityEngine.Random.Range(0.0f, 1.0f) > 0.8f) { yield return(new WaitForSeconds(0.5f)); if (m_currentNoun.m_random) { AudioManager.instance.PlaySound(AudioManager.SoundType.Character_VocalizeRandom); } else if (m_currentVerb.m_affinities [0].m_quality == Word.WordQuality.Positive) { AudioManager.instance.PlaySound(AudioManager.SoundType.Character_VocalizePositive); } else if (m_currentVerb.m_affinities [0].m_quality == Word.WordQuality.Negative) { AudioManager.instance.PlaySound(AudioManager.SoundType.Character_VocalizeNegative); } } // int incAmount = 15; int incAmount = 20; int amt = 0; for (int i = 0; i < m_currentNoun.m_affinities.Length; i++) { Word.Affinity af = m_currentNoun.m_affinities [i]; Word.Affinity vAf = m_currentVerb.m_affinities [0]; bool specificResponse = false; // uncomment and fix if specific responses are needed // if (m_currentVerb.m_specificResponses.Length > 0) { // // foreach (Word.SpecificResponse s in m_currentVerb.m_specificResponses) { // // if (s.m_noun == m_currentNoun) { // Debug.Log ("SPECIFIC RESPONSE"); // if (s.m_quality == Word.WordQuality.Negative) { // // amt = incAmount*-1; // } else if (s.m_quality == Word.WordQuality.Positive) { // amt = incAmount; // } // specificResponse = true; // break; // } // } // // } if (!specificResponse) { if (af.m_quality == Word.WordQuality.Negative && vAf.m_quality == Word.WordQuality.Negative) { amt = incAmount; } else if (af.m_quality == Word.WordQuality.Positive && vAf.m_quality == Word.WordQuality.Negative) { amt = incAmount * -1; } else if (af.m_quality == Word.WordQuality.Negative && vAf.m_quality == Word.WordQuality.Positive) { amt = incAmount * -1; } else if (af.m_quality == Word.WordQuality.Positive && vAf.m_quality == Word.WordQuality.Positive) { amt = incAmount; } else if (af.m_quality == Word.WordQuality.Positive) { amt = incAmount; } else if (af.m_quality == Word.WordQuality.Negative) { amt = incAmount * -1; } } if (amt != 0) { yield return(new WaitForSeconds(1.0f)); // update stat values foreach (Stat thisStat in m_stats) { if (thisStat.m_category == af.m_category) { thisStat.UpdateValue(amt); switch (thisStat.m_category) { case Word.WordCategory.Captialism: if (amt > 0) { AudioManager.instance.PlaySound(AudioManager.SoundType.Capitalism_Increase); thisStat.ui.SetArrow(StatUI.ArrowType.Increase); } else { AudioManager.instance.PlaySound(AudioManager.SoundType.Capitalism_Decrease); thisStat.ui.SetArrow(StatUI.ArrowType.Decrease); } break; case Word.WordCategory.Law: if (amt > 0) { AudioManager.instance.PlaySound(AudioManager.SoundType.Law_Increase); thisStat.ui.SetArrow(StatUI.ArrowType.Increase); } else { AudioManager.instance.PlaySound(AudioManager.SoundType.Law_Decrease); thisStat.ui.SetArrow(StatUI.ArrowType.Decrease); } break; case Word.WordCategory.Democracy: if (amt > 0) { AudioManager.instance.PlaySound(AudioManager.SoundType.Democracy_Increase); thisStat.ui.SetArrow(StatUI.ArrowType.Increase); } else { AudioManager.instance.PlaySound(AudioManager.SoundType.Democracy_Decrease); thisStat.ui.SetArrow(StatUI.ArrowType.Decrease); } break; case Word.WordCategory.Culture: if (amt > 0) { AudioManager.instance.PlaySound(AudioManager.SoundType.Culture_Increase); thisStat.ui.SetArrow(StatUI.ArrowType.Increase); } else { AudioManager.instance.PlaySound(AudioManager.SoundType.Culture_Decrease); thisStat.ui.SetArrow(StatUI.ArrowType.Decrease); } break; } // if (amt > 0) { // // thisStat.ui.SetColor (Color.green); // // } else if (amt < 0) { // // thisStat.ui.SetColor (Color.red); // } // if (amt != 0) { // if (amt == 0 || amt == 100) { // // thisStat.ui.SetColor (Color.red); // // } else { // thisStat.ui.SetBorderColor (Color.red); // } // } if (thisStat.currentScore == 0 || thisStat.currentScore == thisStat.maxScore) { foreach (Stat s in m_stats) { // if (s != thisStat) { thisStat.ui.SetColor(Color.white); // } } thisStat.ui.SetColor(Color.red); GameOver(thisStat); yield break; } else if (amt != 0 && m_gameState != GameState.GameOver) { thisStat.ui.SetBorderColor(Color.red); } break; } } } } yield return(new WaitForSeconds(1.0f)); // reset stat colors back to white foreach (Stat thisStat in m_stats) { thisStat.ui.SetColor(Color.white); } // check if at end of timeline, four more years if so // if (m_turnNumber+1 == m_maxTurns) { // // yield return StartCoroutine (FourMoreYears ()); // } m_playerInputAllowed = true; m_waitingForNextTurn = true; if (!m_helpTapIconPhoneShown) { m_tapIcon.gameObject.SetActive(true); m_tapIcon.Play("Help_TapIcon01"); } yield return(true); }