// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { SceneController.GotoMainScene(); } GameController.State gameState = GameController.instance.state; if (gameState == GameController.State.INPUT_NAME || gameState == GameController.State.COUNT_DOWN || gameState == GameController.State.GAME_OVER) { return; } if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { MobileInputControl(); } else { // assume anything else is Desktop at the moment DesktopInputControl(); } }
private void StateChanged(GameController.State state) { if (state == GameController.State.START) { PlayIntro(); } if (state == GameController.State.ARGUE) { MainGameLoop(); } if (state == GameController.State.CHOICE) { RoundStart(); } if (state == GameController.State.GAMEOVER) { GameOver(); } if (state == GameController.State.WIN) { WinMusic(); } }
private void StateChanged(GameController.State state) { if (state != GameController.State.CHOICE) { goLeft.SetActive(false); goRight.SetActive(false); } }
private void Update() { switch (ControllerState) { case GameController.State.Enter: if (step == 0) { p.PaddleStatus = Paddle.Status.Enabled; if (countdown == null) { countdown = CountDown.New(); countdown.Begin( () => { canContinue = true; } ); } step++; } if (step == 1) { if (canContinue) { step = 0; levelTimer.SetStartOffset(); ControllerState = GameController.State.Execute; } } return; case GameController.State.Execute: if (step == 0) { p.PaddleState = Paddle.State.Serve; step++; return; } if (step == 1) { levelTimer.PrintTime(); return; } return; case GameController.State.Exit: return; default: return; } }
private void StateChanged(GameController.State state) { if (state != GameController.State.START) { gameObject.SetActive(false); } else { gameObject.SetActive(true); } }
private void StateChanged(GameController.State state) { if (state == GameController.State.START) { } else if (state == GameController.State.ARGUE) { spawnInterval = 0.5f; SetActive(true); } else if (state == GameController.State.CHOICE) { SetActive(false); } }
private void StateChanged(GameController.State state) { if (state == GameController.State.START) { Init(); } else if (state == GameController.State.ARGUE) { StartNewRound(); SetActive(true); } else if (state == GameController.State.CHOICE) { SetActive(false); } }
private void StateChanged(GameController.State state) { if (state == GameController.State.START) { } else if (state == GameController.State.ARGUE) { SetActive(true); isInSyn = false; hasScored = false; DisplayPicks(); } else if (state == GameController.State.CHOICE) { SetActive(false); } }
private void StateChanged(GameController.State state) { if (state == GameController.State.START) { //turn off ui bg.SetActive(false); gameovertxt.SetActive(false); goRetry.SetActive(false); goQuit.SetActive(false); } else if (state == GameController.State.GAMEOVER) { bg.SetActive(true); gameovertxt.SetActive(true); goRetry.SetActive(true); goQuit.SetActive(true); } }
private IEnumerator PlayTutorialVideo(GameController.State curState, string tutorialName, bool loop) { this._TutorialPlaying = true; if (curState == GameController.State.Introduction) { this.ShowSkipButton(); } this._MoviePlayer.Target = this.MovieImage; if (tutorialName.Contains("STT_Tut1")) { yield return(this._MoviePlayer.Play("Videos/Tutorial/" + tutorialName, loop, false)); } yield return(this._MoviePlayer.Play("Videos/Tutorial/" + tutorialName, loop, false)); if (this._MoviePlayer.Width / this._MoviePlayer.Height >= 1.7f) { this.MovieImage.rectTransform.sizeDelta = new Vector2(1282f, 722f); } else { this.MovieImage.rectTransform.sizeDelta = new Vector2(962f, 722f); } this.MovieImage.enabled = true; if (!loop) { while (this._MoviePlayer.IsPlaying) { if (this._CurrentState != curState || (curState == GameController.State.Introduction && this._PlayerController.GetButtonDown("UISubmit"))) { this._MoviePlayer.Stop(); this._MoviePlayer.Unload(); this.HideSkipButton(); yield break; } yield return(null); } this.HideSkipButton(); this.MovieImage.enabled = false; this._TutorialPlaying = false; this._MoviePlayer.Stop(); this._MoviePlayer.Unload(); } yield break; }
private void StateChanged(GameController.State state) { Debug.Log("Gameover state changed " + state); if (state == GameController.State.START) { //turn off ui bg.SetActive(false); gameovertxt.SetActive(false); goRetry.SetActive(false); goQuit.SetActive(false); } else if (state == GameController.State.WIN) { bg.SetActive(true); gameovertxt.SetActive(true); goRetry.SetActive(true); goQuit.SetActive(true); } }
private void StateChanged(GameController.State state) { // if( state == GameController.State.START ){ // startImg.enabled = true; // StartCoroutine( FadeImage( true, startImg ) ); // } else if( state == GameController.State.ARGUE ){ // startImg.enabled = true; // StartCoroutine( FadeImage( true, startImg ) ); // } else if( state == GameController.State.CHOICE ){ // startImg.enabled = true; // StartCoroutine( FadeImage( true, startImg ) ); // } else if( state == GameController.State.WIN ){ // startImg.enabled = true; // StartCoroutine( FadeImage( true, startImg ) ); // } else if( state == GameController.State.GAMEOVER ){ // } goFade.SetActive(true); StartCoroutine(FadeImage(true, startImg)); }
private void Start() { ControllerState = GameController.State.Enter; score = Score.New(); if (!scoreboardModelView) { scoreboardModelView = ScoreboardModelView.Instance; } scoreboardModelView.Reset(); if (!levelTimer) { levelTimer = GameObject.FindObjectOfType <LevelTimer>(); } levelTimer.Reset(); CollectableNotifier.RaisedOnCollectableCollected += HandleOnCollectableNotifierNotify; }
private void OnStateChange(GameController.State state) { switch (state) { case GameController.State.Start: startButton.gameObject.SetActive(true); finalText.SetActive(false); break; case GameController.State.Game: startButton.gameObject.SetActive(false); break; case GameController.State.End: finalText.SetActive(true); StartCoroutine(WaitForTouch(() => { gameController.CurrentState = GameController.State.Start; })); break; default: break; } }
protected override IEnumerator StartState(GameController.State state) { yield return(base.StartState(state)); switch (state) { case GameController.State.Introduction: { RichPresenceManager.SetRichPresence("UYW_RP_ExtraExtra"); this.InputContainer.SetActive(true); this.RevealContainer.SetActive(false); this.MainCamera.transform.position = new Vector3(-4.99f, -2.75f, 0f); this.MainCamera.orthographicSize = 2.15f; this._ActiveContent = (Singleton <ContentManager> .Instance.FindRandomContent(ContentManager.GameType.ExtraExtra) as ContentManager.ExtraExtraContent); //BEGIN MODIFICATION Sprite contentSprite; if (this._ActiveContent.ID > 999) { byte[] data = System.IO.File.ReadAllBytes(Application.persistentDataPath + "/NewContent/ee" + this._ActiveContent.ID); Texture2D texture2D = new Texture2D(2, 2); texture2D.LoadImage(data); contentSprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), new Vector2(0f, 0f), 100f); } else { contentSprite = Resources.Load <Sprite>("Content/ExtraExtra/" + this._ActiveContent.ID + "/image"); } if (contentSprite.bounds.extents.x > contentSprite.bounds.extents.y) { this._ActiveSize = this.Landscape; } //END MODIFICATION else { this._ActiveSize = this.Portrait; } for (int i = 0; i < this._ActiveSize.Images.Length; i++) { //BEGIN MODIFICATION this._ActiveSize.Images[i].sprite = contentSprite; this._ActiveSize.Images[i].preserveAspect = true; } Vector2 curSize = this._ActiveSize.InputContainer.GetComponent <RectTransform>().sizeDelta; Vector2 imgSize = this._ActiveSize.Images[0].rectTransform.sizeDelta; if (this._ActiveContent.ID > 999) { if (contentSprite.bounds.extents.x > contentSprite.bounds.extents.y) { float margin = Mathf.Abs(curSize.x - imgSize.x); this._ActiveSize.InputContainer.GetComponent <RectTransform>().sizeDelta = new Vector2(imgSize.x + margin, imgSize.y + margin); } else { float margin = Mathf.Abs(curSize.y - imgSize.y); this._ActiveSize.InputContainer.GetComponent <RectTransform>().sizeDelta = new Vector2(imgSize.x + margin, imgSize.y + margin); } } //END MODIFICATION while (Singleton <LoadingScreen> .Instance.IsShowing) { yield return(null); } if (!Singleton <GameManager> .Instance.NewPlayer || Singleton <GameManager> .Instance.IsFirstExtraExtra) { } this._ActiveSize.InputContainer.SetActive(true); this._ActiveSize.RevealContainer.SetActive(true); yield return(Yielders.Seconds(1f)); this.MainCamera.DOOrthoSize(5f, 1.5f).SetEase(Ease.InQuad); this.MainCamera.transform.DOMove(new Vector3(0f, 0f, -1f), 1.5f, false).SetEase(Ease.InQuad); base.ChangeState(GameController.State.RevealPrompt); break; } case GameController.State.RevealPrompt: if (Singleton <GameManager> .Instance.FamilyMode) { base.SetHouseAnswers(this._ActiveContent.FamilyModeHouseAnswers); } else { base.SetHouseAnswers(this._ActiveContent.HouseAnswers); } base.ChangeState(GameController.State.InputCheck); break; case GameController.State.RevealAnswers: { yield return(Singleton <AudioManager> .Instance.PlayVoiceOverAndWait("12.X", Singleton <GameManager> .Instance.GetAnswerRevealClips())); this.InputContainer.SetActive(false); this.RevealContainer.SetActive(true); this.VotingPaper.SetActive(false); this.NewspaperBase.transform.localScale = Vector3.zero; Singleton <AudioManager> .Instance.PlayMusic("EE_Theme", 1f, true); this.NewspaperBase.SetActive(true); GameController.Answer[] inputArray = this._UserInput[this._CurrentRound].ToArray(); foreach (GameController.Answer inputPair in inputArray) { yield return(this.ShowNewspaper(inputPair.Value, 5.25f)); yield return(base.ResolveInput(inputPair.User.ID)); } base.ChangeState(GameController.State.VotingCheck); break; } case GameController.State.VotingCheck: this.NewspaperBase.SetActive(false); this.VotingPaper.SetActive(true); break; case GameController.State.RevealResults: { yield return(Singleton <AudioManager> .Instance.PlayVoiceOverAndWait("36.X", Singleton <GameManager> .Instance.GetVoteRevealVO())); this.NewspaperBase.SetActive(true); this.VotingPaper.SetActive(false); List <GameController.Answer> orderedAnswers = base.CalculateVoteOrderedInput(); foreach (GameController.Answer inputPair2 in orderedAnswers) { yield return(this.ShowNewspaper(inputPair2.Value, 1f)); yield return(base.ResolveVote(inputPair2.User.ID)); } base.ChangeState(GameController.State.PostResults); break; } case GameController.State.EndOfGame: this.NewspaperBase.SetActive(false); break; } yield break; }
private IEnumerator PlayMovie(GameController.State curState, ContentManager.SubTheTitleContent subTheTitleContent, string moviePath, string promptText, bool fadeMusic = true, bool holdBleep = true) { this.MovieImage.gameObject.SetActive(true); this.ScreenshotImage.gameObject.SetActive(false); this.InputText.gameObject.SetActive(false); if (this._MoviePlayer != null) { this._MoviePlayer.Stop(); } this._MoviePlayer.Target = this.MovieImage; yield return(this._MoviePlayer.Play(moviePath, false, false)); float aspectRatio = this._MoviePlayer.Width / this._MoviePlayer.Height; if (this._ActiveContent.ID < 999) { if (aspectRatio >= 1.7f) { this.MovieImage.rectTransform.sizeDelta = new Vector2(1282f, 722f); } else { this.MovieImage.rectTransform.sizeDelta = new Vector2(962f, 722f); } } if (fadeMusic) { Singleton <AudioManager> .Instance.SetMusicVolume(0.25f); } this.MovieImage.enabled = true; while (!this._MoviePlayer.IsPlaying) { yield return(null); } float timeElapsed = 0f; this.InputText.text = promptText; UnityEngine.Debug.Log("[STT] Start : " + subTheTitleContent.Start); while ((double)timeElapsed <= subTheTitleContent.Start) { timeElapsed += Time.deltaTime; if (curState != this._CurrentState) { this.InputText.gameObject.SetActive(false); this._MoviePlayer.Stop(); yield break; } yield return(null); } this.InputText.gameObject.SetActive(true); while ((double)timeElapsed <= subTheTitleContent.End && this._MoviePlayer.IsPlaying) { timeElapsed += Time.deltaTime; if (curState != this._CurrentState) { this.InputText.gameObject.SetActive(false); this._MoviePlayer.Stop(); yield break; } yield return(null); } this.InputText.text = string.Empty; this.InputText.gameObject.SetActive(false); while (this._MoviePlayer.IsPlaying) { if (curState != this._CurrentState) { this.InputText.gameObject.SetActive(false); this._MoviePlayer.Stop(); yield break; } yield return(null); } this._MoviePlayer.Stop(); this._MoviePlayer.Unload(); yield return(this._MoviePlayer.Play(SubTheTitleController.BleepMoviePath, false, false)); while (this._MoviePlayer.IsPlaying) { if (curState != this._CurrentState) { this.InputText.gameObject.SetActive(false); this._MoviePlayer.Stop(); yield break; } yield return(null); } yield return(Yielders.Seconds(0.5f)); this._MoviePlayer.Stop(); if (!holdBleep) { this._MoviePlayer.Unload(); this.MovieImage.enabled = false; } if (fadeMusic) { Singleton <AudioManager> .Instance.SetMusicVolume(1f); } yield break; }
protected override IEnumerator StartState(GameController.State state) { yield return(base.StartState(state)); switch (state) { case GameController.State.Introduction: RichPresenceManager.SetRichPresence("UYW_RP_SubTheTitle"); this.InputText.gameObject.SetActive(false); this.MovieImage.enabled = false; this._ActiveContent = (Singleton <ContentManager> .Instance.FindRandomContent(ContentManager.GameType.SubTheTitle) as ContentManager.SubTheTitleContent); //BEGIN MODIFICATION if (this._ActiveContent.ID > 999) { moviePath = Application.persistentDataPath + "/NewContent/stt" + this._ActiveContent.ID.ToString() + ".mp4"; } else { moviePath = string.Concat(new object[] { "Content/SubTheTitle/", this._ActiveContent.ID, "/clip", (Singleton <GameManager> .Instance.CurrentLanguage != GameManager.LanguageSettings.French) ? string.Empty : "_FR" }); } //END MODIFICATION if (this._ActiveContent.Dimensions != Vector2.zero) { this.InputText.rectTransform.sizeDelta = this._ActiveContent.Dimensions; } this.InputText.transform.localPosition = this._ActiveContent.Position; while (Singleton <LoadingScreen> .Instance.IsShowing) { yield return(null); } if (Singleton <GameManager> .Instance.CurrentMode != GameManager.GameMode.Debug) { if (Singleton <GameManager> .Instance.IsFirstSubTheTitle) { Singleton <AudioManager> .Instance.SetMusicVolume(0f); yield return(this.PlayTutorialVideo(GameController.State.Introduction, "STT_Tut1" + ((Singleton <GameManager> .Instance.CurrentLanguage == GameManager.LanguageSettings.French) ? "_FR" : ""), false)); Singleton <AudioManager> .Instance.SetMusicVolume(1f); } this._MoviePlayer.Target = this.MovieImage; yield return(this._MoviePlayer.Play(SubTheTitleController.CountdownMoviePath, false, false)); this.MovieImage.enabled = true; while (this._MoviePlayer.IsPlaying) { yield return(null); } } base.ChangeState(GameController.State.RevealPrompt); break; case GameController.State.RevealPrompt: { if (Singleton <GameManager> .Instance.FamilyMode) { base.SetHouseAnswers(this._ActiveContent.FamilyModeHouseAnswers); } else { base.SetHouseAnswers(this._ActiveContent.HouseAnswers); } Singleton <AudioManager> .Instance.FadeOutMusic(0f, 0f); UnityEngine.Debug.Log("Loading Prompt"); UnityEngine.Debug.Log(this._ActiveContent.ID); this.ShadowBackdrop.DOFade(0.58f, 0.5f); string promptText = "[Insert subtitle here.]"; if (Singleton <GameManager> .Instance.CurrentLanguage == GameManager.LanguageSettings.French) { promptText = "[Insérer un sous-titre ici.]"; } yield return(this.PlayMovie(GameController.State.RevealPrompt, this._ActiveContent, moviePath, promptText, false, true)); //MODIFIED base.ChangeState(GameController.State.InputCheck); break; } case GameController.State.WaitForInput: { string promptText2 = "[Insert subtitle here.]"; if (Singleton <GameManager> .Instance.CurrentLanguage == GameManager.LanguageSettings.French) { promptText2 = "[Insérer un sous-titre ici.]"; } yield return(this.PlayMovie(GameController.State.WaitForInput, this._ActiveContent, moviePath, promptText2, false, true)); this.ShadowBackdrop.DOFade(0f, 0.5f); Singleton <AudioManager> .Instance.PlayMusic("STT_Theme", 1f, true); base.StartCoroutine(this.PlayTutorialVideo(GameController.State.WaitForInput, "STT_Tut2" + ((Singleton <GameManager> .Instance.CurrentLanguage == GameManager.LanguageSettings.French) ? "_FR" : ""), true)); break; } case GameController.State.RevealAnswers: { Singleton <AudioManager> .Instance.StopMusic(); this.ShadowBackdrop.DOFade(0.58f, 0.5f); yield return(Singleton <AudioManager> .Instance.PlayVoiceOverAndWait("12.X", Singleton <GameManager> .Instance.GetAnswerRevealClips())); GameController.Answer[] inputArray = this._UserInput[this._CurrentRound].ToArray(); foreach (GameController.Answer inputPair in inputArray) { yield return(this.PlayMovie(GameController.State.RevealAnswers, this._ActiveContent, moviePath, inputPair.Value, true, true)); //MODIFIED yield return(base.ResolveInput(inputPair.User.ID)); } this.ShadowBackdrop.DOFade(0f, 0.5f); base.ChangeState(GameController.State.VotingCheck); break; } case GameController.State.WaitForVoting: if (Singleton <GameManager> .Instance.IsFirstSubTheTitle && Singleton <GameManager> .Instance.HouseAnswers) { Singleton <AudioManager> .Instance.StopMusic(); yield return(this.PlayTutorialVideo(GameController.State.WaitForVoting, "STT_Tut3" + ((Singleton <GameManager> .Instance.CurrentLanguage == GameManager.LanguageSettings.French) ? "_FR" : ""), false)); this._TutorialPlaying = false; } Singleton <AudioManager> .Instance.PlayMusic("STT_Theme", 1f, true); if (this._CurrentState != GameController.State.WaitForVoting) { yield break; } yield return(this._MoviePlayer.Play(SubTheTitleController.LobbyMoviePath, true, false)); this.MovieImage.enabled = true; break; case GameController.State.RevealResults: { this.ShadowBackdrop.DOFade(0.58f, 0.5f); yield return(Singleton <AudioManager> .Instance.PlayVoiceOverAndWait("36.X", Singleton <GameManager> .Instance.GetVoteRevealVO())); this.StopTutorialVideo(); List <GameController.Answer> orderedAnswers = base.CalculateVoteOrderedInput(); foreach (GameController.Answer inputPair2 in orderedAnswers) { yield return(this.ShowResult(this._ActiveContent.ID.ToString(), inputPair2.Value)); yield return(base.ResolveVote(inputPair2.User.ID)); } List <GameController.Answer> .Enumerator enumerator = default(List <GameController.Answer> .Enumerator); this.ShadowBackdrop.DOFade(0f, 0.5f); base.ChangeState(GameController.State.PostResults); break; } } yield break; yield break; }
// Update is called once per frame void Update() { GameController.State currentState = GameController.Instance.CurrentState; // scoreText.text = "Score: " + GameController.Instance.CurrentPoint.ToString() + "\n" + Input.compass.magneticHeading.ToString(); scoreText.text = "MyScore: " + GameController.Instance.CurrentPoint.ToString() + "\n" + "OtherScore: " + GameController.Instance.OtherPoint.ToString(); if (prevState == GameController.State.Waiting && currentState == GameController.State.CountDown) { startDateTime = DateTime.Now; } if (currentState == GameController.State.Waiting) { messageText.gameObject.SetActive(true); int point = (int)(DateTime.Now - startDateTime).TotalSeconds % 3 + 1; string message = "Waiting"; for (int i = 0; i < point; ++i) { message += "."; } messageText.text = message; } else if (currentState == GameController.State.CountDown) { messageText.gameObject.SetActive(true); int remainCount = countdown - (int)(DateTime.Now - startDateTime).TotalSeconds; messageText.text = remainCount.ToString(); if (remainCount == 0) { messageText.text = "Start!!"; } else if (remainCount < 0) { startDateTime = DateTime.Now; messageText.gameObject.SetActive(false); GameController.Instance.ClearTime(); GameController.Instance.ChangeState(GameController.State.Playing); GameController.Instance.RandomAppearObject(); } } else if (currentState == GameController.State.Playing) { int remainSecond = limitTimeSecond - (int)(DateTime.Now - startDateTime).TotalSeconds; timeLimitBar.size = (float)((float)remainSecond / (float)limitTimeSecond); if (remainSecond <= 0) { startDateTime = DateTime.Now; GameController.Instance.ChangeState(GameController.State.Timeup); } } else if (currentState == GameController.State.Timeup) { timeLimitBar.size = 0f; messageText.gameObject.SetActive(true); int timerSecond = (int)(DateTime.Now - startDateTime).TotalSeconds; messageText.text = "Timeup!!!!"; if (timerSecond > 3) { messageText.gameObject.SetActive(false); GameController.Instance.ChangeState(GameController.State.Finish); } } else if (currentState == GameController.State.Finish) { messageText.gameObject.SetActive(true); string mes = "Result\n" + "MyScore: " + GameController.Instance.CurrentPoint.ToString() + "\n" + "OtherScore: " + GameController.Instance.OtherPoint.ToString() + "\n"; if (GameController.Instance.CurrentPoint > GameController.Instance.OtherPoint) { mes += "WIN"; } else if (GameController.Instance.CurrentPoint < GameController.Instance.OtherPoint) { mes += "LOSE"; } else { mes += "DRAW"; } messageText.text = mes; } prevState = currentState; }