void PlayTutorial() { WaveInfo waveInfo = new WaveInfo { minNumberOfBoxes = 1, maxNumberOfBoxes = 2, minNumberOfDecals = 1, maxNumberOfDecals = 2, spawnAfterSeconds = 0.0f, canSpawnGarbage = false, canSpawnCrossedLabel = false }; StartCoroutine(Coroutines.Chain( Coroutines.Wait(2.0f), tutorialCanvas.DisplayText("Hello!", 3.0f), Coroutines.Wait(1.0f), tutorialCanvas.DisplayText("Welcome to \"Rooster Express, Inc.\" We hope that you enjoy this job as much as we enjoy having you here!", 5.5f), Coroutines.Wait(1.0f), tutorialCanvas.DisplayText("Your job here will consist in picking up packages from that place over there and putting them in these conveyor belts...", 5.5f), Coroutines.Wait(1.0f), tutorialCanvas.DisplayText("But you have to make sure they go in the right conveyor, or some clients won't receive their packages in time.", 5.5f), Coroutines.Wait(1.0f), Coroutines.Join( tutorialCanvas.DisplayText("Look, let's try it...", 2.0f), Coroutines.Wrap(() => spawner.SpawnBoxes(waveInfo))), Coroutines.Wait(2.5f), Coroutines.Wrap(() => CreateTutorialBoxSpawnAndDeliver(waveInfo)) )); }
private void CreateTutorialBoxSpawnAndDeliver(WaveInfo waveInfo) { StartCoroutine(Coroutines.Chain( _CreateTutorialBoxSpawnAndDeliver(waveInfo), Coroutines.Wrap(() => { if (!gm.playerCompletedFirstTaskSuccessful) { gm.playerCompletedFirstTask = false; StartCoroutine(Coroutines.Chain( Coroutines.Join( Coroutines.Wait(2.0f), tutorialCanvas.DisplayText("... Ok, let's try again.", 2.0f), Coroutines.Wrap(() => spawner.SpawnBoxes(waveInfo))), Coroutines.Wait(3.0f), Coroutines.Wrap(() => CreateTutorialBoxSpawnAndDeliver(waveInfo)) )); return; } else { StartCoroutine(Coroutines.Chain( tutorialCanvas.DisplayText("Good job!", 2.0f), Coroutines.Wrap(() => CreateTutorialDifferentDisplayGarbage()) )); } }))); }
public IEnumerator DisplayCommand(string text) { return(Coroutines.Chain( Coroutines.Join( Coroutines.Wrap(() => commandtext.text = text), Coroutines.FadeAlpha01(commandtext, textFadeTime) ))); }
public void PlayAgain() { StartCoroutine( Coroutines.Chain( Coroutines.Join( Coroutines.FadeVolume(bgMusic, 1.0f, 0.0f), Coroutines.FadeAlpha01(fadePanel, 1.0f)), Coroutines.Wrap(() => SceneManager.LoadScene("MapScene")))); }
IEnumerator CoroutineEndOk() { return(Coroutines.Chain( Coroutines.Join( Coroutines.Wrap(() => spawner.SpawnBoxes(500, 0.01f)), DisplayText("You think you are good at your job? Let's see how you handle THIS...", 4.0f)), Coroutines.Wait(2.0f), DisplayText("... Oh, wait, your turn is over. Don't worry, someone else will pick this up. See you tomorrow...", 6.0f), Coroutines.Wait(1.0f), Coroutines.Wrap(() => statisticsCanvas.gameObject.SetActive(true)))); }
public void TurnRed(Light threadmillLight) { // GLOBAL LIGHTS if (globalLightsCoroutine != null) { StopCoroutine(globalLightsCoroutine); } List <IEnumerator> fadeToRedCoroutines = new List <IEnumerator>(); List <IEnumerator> fadeBackFromRedCoroutines = new List <IEnumerator>(); fadeToRedCoroutines.Add( Coroutines.FadeColor(directionalLight, 0.5f, directionalLight.color, Color.red)); fadeBackFromRedCoroutines.Add( Coroutines.FadeColor(directionalLight, 0.5f, Color.red, GetDefaultColor(directionalLight))); for (int i = 0; i < pointLights.Length; i++) { fadeToRedCoroutines.Add( Coroutines.FadeColor(pointLights[i], 0.5f, pointLights[i].color, Color.red)); fadeBackFromRedCoroutines.Add( Coroutines.FadeColor(pointLights[i], 0.5f, Color.red, GetDefaultColor(pointLights[i]))); } globalLightsCoroutine = CoroutineSingleton.Instance.StartCoroutine(Coroutines.Chain( Coroutines.Join(fadeToRedCoroutines.ToArray()), Coroutines.Wait(1.0f), Coroutines.Join(fadeBackFromRedCoroutines.ToArray()))); // TREADMILL LIGHT if (treadmillLightsCoroutine.ContainsKey(threadmillLight) && treadmillLightsCoroutine[threadmillLight] != null) { StopCoroutine(treadmillLightsCoroutine[threadmillLight]); } Renderer r = threadmillLight.transform.parent.GetComponent <Renderer>(); treadmillLightsCoroutine[threadmillLight] = StartCoroutine(Coroutines.Chain( Coroutines.Join( Coroutines.FadeColor(threadmillLight, 0.5f, threadmillLight.color, Color.red), // Coroutines.FadeColor(r.material, "_Color", 0.5f, Color.white, new Color(255, 89, 89) / 255.0f), Coroutines.FadeColor(r.material, "_EmissionColor", 0.5f, Color.black, Color.red)), Coroutines.Wait(1.0f), Coroutines.Join( Coroutines.FadeColor(threadmillLight, 0.5f, Color.red, GetDefaultColor(threadmillLight)), // Coroutines.FadeColor(r.material, "_Color", 0.5f, new Color(255, 89, 89) / 255.0f, Color.white), Coroutines.FadeColor(r.material, "_EmissionColor", 0.5f, Color.red, Color.black)))); }
public IEnumerator DisplayText(string text, float length) { return(Coroutines.Chain( Coroutines.Join( Coroutines.Wrap(() => screen.Talk()), Coroutines.Wrap(() => tutorialText.text = text), Coroutines.FadeAlpha01(tutorialText, textFadeTime) ), Coroutines.Wait(length), Coroutines.Join( Coroutines.FadeAlpha10(tutorialText, textFadeTime), Coroutines.Wrap(() => screen.Relaxed())) )); }
IEnumerator DisplayText(string text, float length) { return(Coroutines.Chain( Coroutines.Join( Coroutines.Wrap(() => bossScreen.Talk()), Coroutines.Wrap(() => bossText.text = text), Coroutines.FadeAlpha01(bossText, 0.5f) ), Coroutines.Wait(length), Coroutines.Join( Coroutines.FadeAlpha10(bossText, 0.5f), Coroutines.Wrap(() => bossScreen.Relaxed())) )); }
private IEnumerator _CreateTutorialBoxSpawnAndDeliver(WaveInfo waveInfo) { return(Coroutines.Chain( Coroutines.IfCondition( x => !gm.playerGrabbedFirstBox, Coroutines.Chain( tutorialCanvas.DisplayCommand("Pick up that box to continue [LeftMouseClick or the \"A\" button]."), Coroutines.WaitFor(x => gm.playerGrabbedFirstBox), Coroutines.Join( tutorialCanvas.HideCommand(), tutorialCanvas.DisplayText("Good job!", 3.0f)))), Coroutines.IfCondition( x => !gm.playerInspectedFirstBox, Coroutines.Chain( tutorialCanvas.DisplayText("As you know, out city is distributed in districts. Each one of these conveyors...", 4.0f), tutorialCanvas.DisplayText("... delivers to a specific district. The district info can be found in the package labels.", 5.0f), tutorialCanvas.DisplayText("Now please, pay attention to the box.", 2.0f), tutorialCanvas.DisplayCommand( "Inspect the box to continue [RightMouseClick or the \"B\" button]."), Coroutines.WaitFor(x => gm.playerInspectedFirstBox || gm.playerCompletedFirstTask), Coroutines.IfCondition( x => !gm.playerCompletedFirstTask, Coroutines.Join( Coroutines.Chain( tutorialCanvas.HideCommand(), tutorialCanvas.DisplayCommand("Zoom in / out [MouseScrollWheel or the Left/right triggers].")), Coroutines.Chain( tutorialCanvas.DisplayText("Good job!", 2.0f), tutorialCanvas.DisplayText("But be careful, because sometimes the packages are redirected and have to go through another district.", 5.0f)))))), Coroutines.IfCondition( x => !gm.playerCompletedFirstTask, Coroutines.Chain( Coroutines.Wait(0.5f), tutorialCanvas.DisplayCommand("Drop it in the correct conveyor"), Coroutines.WaitFor(x => gm.playerCompletedFirstTask), tutorialCanvas.HideCommand())))); }
public void TurnGreen(Light threadmillLight) { Renderer r = threadmillLight.transform.parent.GetComponent <Renderer>(); if (treadmillLightsCoroutine.ContainsKey(threadmillLight) && treadmillLightsCoroutine[threadmillLight] != null) { StopCoroutine(treadmillLightsCoroutine[threadmillLight]); } treadmillLightsCoroutine[threadmillLight] = StartCoroutine(Coroutines.Chain( Coroutines.Join( Coroutines.FadeColor(threadmillLight, 0.5f, threadmillLight.color, Color.green), // Coroutines.FadeColor(r.material, "_Color", 0.5f, Color.white, new Color(255, 89, 89) / 255.0f), Coroutines.FadeColor(r.material, "_EmissionColor", 0.5f, r.material.GetColor("_EmissionColor"), Color.green)), Coroutines.Wait(1.0f), Coroutines.Join( Coroutines.FadeColor(threadmillLight, 0.5f, Color.green, GetDefaultColor(threadmillLight)), // Coroutines.FadeColor(r.material, "_Color", 0.5f, new Color(255, 89, 89) / 255.0f, Color.white), Coroutines.FadeColor(r.material, "_EmissionColor", 0.5f, Color.green, Color.black)))); }
private void CreateTutorialDifferentDisplayGarbage() { gm.playerCompletedFirstTask = true; WaveInfo waveInfo = new WaveInfo { minNumberOfBoxes = 1, maxNumberOfBoxes = 2, minNumberOfDecals = 1, maxNumberOfDecals = 2, spawnAfterSeconds = 0.0f, canSpawnGarbage = false, canSpawnCrossedLabel = false, districtCode = "B" }; WaveInfo garbage = new WaveInfo { minNumberOfBoxes = 1, maxNumberOfBoxes = 2, minNumberOfDecals = 1, maxNumberOfDecals = 2, spawnAfterSeconds = 0.0f, canSpawnGarbage = true, canSpawnCrossedLabel = false, districtCode = "E" }; StartCoroutine(Coroutines.Chain( Coroutines.Wrap(() => spawner.SpawnBoxes(waveInfo)), _CreateTutorialDifferentDisplayGarbage(), Coroutines.Wrap(() => { if (!gm.playerCompletedSecondTaskSuccessful) { gm.playerCompletedSecondtask = false; StartCoroutine(Coroutines.Chain( Coroutines.Wait(2.0f), tutorialCanvas.DisplayText("... Ok, let's try again.", 2.0f), Coroutines.Wait(1.0f), Coroutines.Wrap(() => CreateTutorialDifferentDisplayGarbage()) )); return; } else { StartCoroutine(Coroutines.Chain( Coroutines.Join( Coroutines.Wrap(() => spawner.SpawnBoxes(garbage)), tutorialCanvas.DisplayText("Good job!", 3.5f)), tutorialCanvas.DisplayText("Now...", 3.0f), tutorialCanvas.DisplayText("... How did that got here? Please, get rid of any goods you find that are not properly labeled.", 5.0f), Coroutines.WaitFor(x => gm.playerCompletedThirdTask), Coroutines.IfCondition( x => !gm.playerCompletedThirdTaskSuccessful, tutorialCanvas.DisplayText("Oh god...", 2.0f)), tutorialCanvas.DisplayText("Congratulations! You've passed the trial period with great results.", 4.0f), tutorialCanvas.DisplayText("And because of that, we are going to heat the things up a little bit.", 4.0f), tutorialCanvas.DisplayText("Oh, and by the way - I don't like messes. So keep this place in order or you are fired.", 5.0f), Coroutines.Wrap(() => EndTutorial()))); } }))); }
public IEnumerator HideCommand() { return(Coroutines.Join( Coroutines.FadeAlpha10(commandtext, textFadeTime) )); }