public override void Init(TutState tutState) { if (!isInitialized) { isInitialized = true; cancelLetterReveal = false; TutorialCanvas.tutorialInProgress = true; InputController.canPressButtons = false; InputController.canSpawnTowers = false; tutCanvas.currTutorialIndex++; SetupCtaText(); tutCanvas.portraitController.SetPortrait(tutCanvas.currTutorial.portraitIndex); // Animate the tutorial panel if (tutCanvas.currTutorial.transition == TransitionType.SLIDE_IN) { SlideIn(); } else if (tutCanvas.currTutorial.transition == TransitionType.BLINK) { Blink(); } EventManager.Tutorials.onTutStateInit?.Invoke(tutState); EventManager.Tutorials.onTutorialStart?.Invoke(tutCanvas.currTutorial); Util.poolManager.DespawnAllitemHighlights(); EventManager.Tutorials.onHighlightItem?.Invoke(tutCanvas.currTutorial.highlightedItem); Debug.Log("Highlight item"); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.M) && ts == TutState.MPrompted) { ts = TutState.MapToggled; } }
public override void OnTutStateInit(TutState tutState) { if (tutState != this.tutState) { isInitialized = false; } }
public override void Begin() { curState = TutState.FirstToggles; option1toggles = new bool[] { true, false, true, true }; option2toggles = new bool[] { false, false, true, true }; option3toggles = new bool[] { true, true, true, true }; base.Begin(); }
private void Update() { if (!GameManager.Instance.gameStates.IsGameState()) { return; } tutState = charStates[tutState].OnUpdate(tutState); }
public IntermediateTask3() : base() { trigger = MainTrigger; responseSteps.Add(Handler); curState = TutState.FirstToggles; option1toggles = new bool[] { true, false, true, true }; option2toggles = new bool[] { false, false, true, true }; option3toggles = new bool[] { true, true, true, true }; }
public void TutUnclick() { if (!tutIsUnclicked) { Time.timeScale = 0; InfoText.GetComponent <Text> ().text = "Unclick inside the red circle to get more points!"; InfoText.SetActive(true); curTutState = TutState.TUT_UNCLICK; source.Pause(); } }
public void TutClick() { if (!tutIsClicked) { Time.timeScale = 0; InfoText.GetComponent <Text> ().text = "Click and hold on triangle to jump"; InfoText.SetActive(true); curTutState = TutState.TUT_CLICK; source.Pause(); } }
public override void Init(TutState tutState) { if (!isInitialized) { isInitialized = true; InputController.canPressButtons = true; InputController.canSpawnTowers = true; EventManager.Tutorials.onTutStateInit?.Invoke(tutState); } }
void CheckToggles() { bool[] currentoptiontoggles; if (controller.setting1.option1.isOn) { currentoptiontoggles = option1toggles; } else if (controller.setting1.option2.isOn) { currentoptiontoggles = option2toggles; } else { currentoptiontoggles = option3toggles; } currentoptiontoggles[0] = controller.toggle1.isOn; currentoptiontoggles[1] = controller.toggle2.isOn; currentoptiontoggles[2] = controller.toggle3.isOn; currentoptiontoggles[3] = controller.toggle4.isOn; //tutorial messages if (controller.intermediateTutorialHelper2 != null) { if (curState == TutState.FirstToggles && numTogglesOn(0) == 0) { controller.intermediateTutorialHelper2.RedHintOne.SetActive(false); controller.intermediateTutorialHelper2.RedHintTwo.SetActive(true); curState = TutState.SecondToggles; } else if ((currentoptiontoggles == option2toggles && numTogglesOn(1) == 0) || (currentoptiontoggles == option3toggles && numTogglesOn(2) == 0)) { if (curState == TutState.SecondToggles) { controller.intermediateTutorialHelper2.RedHintThree.SetActive(false); controller.intermediateTutorialHelper2.RedHintFour.SetActive(true); curState = TutState.FinalToggles; } else if (curState == TutState.FinalToggles) { controller.intermediateTutorialHelper2.RedHintFour.SetActive(false); controller.intermediateTutorialHelper2.RedHintFive.SetActive(true); } } } }
public override void BeginProcedure(ProcedureController cont) { base.BeginProcedure(cont); tut = controller.Controls.advancedTutorialHelper2; usermode = true; tutWait = true; current = 0; power = 0; SetupSystems(); ResetUI(); ContextSwitched(); controller.Controls.SubscribeToAllControls(Handler); tut.preamble.OnceSequenceFinished += PreambleFinished; curState = TutState.Preamble; tut.preamble.Begin(); }
IEnumerator RightBeforeTutorialGen() { uiController.FadeIntroText(); yield return(new WaitForSeconds(1f)); fuelLeft.Value = 0.5f; StartCoroutine(thruster.ThrusterSputsOut()); yield return(new WaitForSeconds(3.25f)); // Oh no! we've run out of fuel! uiController.ShowTutorialFuelText(); tutorialTextEvent.Raise(); yield return(new WaitForSeconds(2.8f)); // And we are going to run out of oxygen! oxygenLeft.Value = 32.5f; uiController.ShowTutorialOxygenText(); tutorialTextEvent.Raise(); yield return(new WaitForSeconds(2.8f)); uiController.ShowTutorialWeMustGetBackToOurHomePlanetText(); tutorialTextEvent.Raise(); yield return(new WaitForSeconds(2.8f)); uiController.ShowTutorialPressMToToggleMapText(); tutorialTextEvent.Raise(); ts = TutState.MPrompted; //yield return new WaitForSeconds(2.8f); // Press 'M' to view the map yield return(new WaitUntil(() => ts == TutState.MapToggled)); Debug.Log("ayy baybayboobe"); tutorialPartOneFinishedEvent.Raise(); // start tutorial level ... // }
public override TutState OnUpdate(TutState tutState) { Init(tutState); if (tutCanvas.hasTutorials) { tutCanvas.initTutPanelLocalPos = tutCanvas.tutPanel.localPosition; tutCanvas.tutPanel.localPosition += new Vector3(0, tutCanvas.slideInOffset, 0); tutState = TutState.LETTER_REVEAL; } else if (tutCanvas.canvas.enabled) { //tutCanvas.canvas.enabled = false; tutCanvas.tutPanel.gameObject.SetActive(false); } return(tutState); }
public override void Init(TutState tutState) { if (!isInitialized) { isInitialized = true; StopCoroutine(GameManager.Instance.util.RevealCharacters(null, 0, null)); tutCanvas.tutText.text = tutCanvas.currTutorial.text; tutCanvas.tutText.ForceMeshUpdate(); InputController.canPressButtons = false; InputController.canSpawnTowers = true; EventManager.Tutorials.onTutStateInit?.Invoke(tutState); var animatedWords = tutCanvas.currTutorial.animatedWords; foreach (AnimatedWord word in animatedWords) { EventManager.Tutorials.onAnimateText?.Invoke(word.word, word.speed, word.amplitude); } } }
public void PreambleFinished() { tut.preamble.OnceSequenceFinished -= PreambleFinished; curState = TutState.ExplainMeter1; tut.ExplainMeter1a.SetActive(true); tut.ExplainMeter1a.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainMeter2a.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainMeter3.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainMeter1b.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainMeter2b.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainSetting1a.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainSetting1b.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainSetting2a.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainSetting2b.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainSetting2c.GetComponentInChildren <Button>(true).onClick.AddListener(ExplainButtonClicked); tut.ExplainMeter1c.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainSetting1c.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); tut.ExplainEnding.GetComponentInChildren <Button>().onClick.AddListener(ExplainButtonClicked); }
public override void Init(TutState tutState) { if (!isInitialized) { isInitialized = true; TutorialCanvas.tutorialInProgress = false; InputController.canPressButtons = true; InputController.canSpawnTowers = true; var seq = LeanTween.sequence(); seq.append(LeanTween.moveLocalY(tutCanvas.tutPanel.gameObject, tutCanvas.initTutPanelLocalPos.y + tutCanvas.slideInOffset, 0.25f).setEaseOutCubic()); seq.append(() => { EventManager.Tutorials.onTutorialEnd?.Invoke(tutCanvas.currTutorial); tutCanvas.hasTutorials = false; }); tutCanvas.HideSkipButton(); EventManager.Tutorials.onTutStateInit?.Invoke(tutState); } }
public void OnGameOver() { GamePlayObjects.SetActive(false); if (!isTutorial) { ArrangeGameOverDialog(); // unlock next level if possible int lockedFrom = PlayerPrefs.GetInt("locked from"); if (StateManager.GetLevel() == lockedFrom - 1) { // Unlock next level PlayerPrefs.SetInt("locked from", StateManager.GetLevel() + 2); } print(PlayerPrefs.GetInt("locked from")); } else { TutOverDialog.SetActive(true); source.volume = 0.3f; curTutState = TutState.END; } }
public void SetWaitingTapState() { tutState = TutState.WAITING_TAP; }
public virtual void Init(TutState tutState) { }
public abstract TutState OnUpdate(TutState tutState);
public abstract void OnTutStateInit(TutState tutState);
void Handler(BaseControl control) { if (usermode && !tutWait) { //tutorial stuff if (curState == TutState.WaitForToggle2 && control == controller.Controls.toggle2) { tutWait = true; tut.Toggle2Hinta.SetActive(false); tut.ExplainMeter1b.SetActive(true); curState = TutState.ExplainMeter1b; } if (curState == TutState.ExplainSetting2c && control == controller.Controls.setting2) { tut.ExplainSetting2c.GetComponentInChildren <Button>(true).gameObject.SetActive(true); } if (curState == TutState.WaitForToggle1 && control == controller.Controls.toggle1) { tutWait = true; tut.Toggle1Hinta.SetActive(false); tut.RedLightHint.SetActive(false); tut.YellowLightHint.SetActive(true); curState = TutState.YellowLight; } if (curState == TutState.WaitForSetting1 && control == controller.Controls.setting1) { tut.Setting1Hint.SetActive(false); tut.Setting2Hint.SetActive(true); curState = TutState.WaitForSetting2; } if (curState == TutState.WaitForSetting2 && control == controller.Controls.setting2) { tut.Setting2Hint.SetActive(false); tut.Toggle1Hintb.SetActive(true); curState = TutState.WaitForToggle1b; } if (curState == TutState.WaitForToggle1b && control == controller.Controls.toggle1) { tut.Toggle1Hintb.SetActive(false); tut.ExplainEnding.SetActive(true); curState = TutState.ExplainEnding; } //main logic if (control == controller.Controls.setting1 || control == controller.Controls.setting2 || control == controller.Controls.toggle2) { ContextSwitched(); } else if (control == controller.Controls.toggle1) { PowerSystem system = GetCurrentSystem(); system.on = !system.on; if (system.on) { controller.Controls.yellowLight.Lit = true; controller.Controls.redLight.Lit = false; } else { controller.Controls.redLight.Lit = true; controller.Controls.yellowLight.Lit = false; controller.Controls.greenLight.Lit = false; system.ResetTimer(); } } //light up buttons if (control == controller.Controls.button1) { int ii = 0; bool found = false; for (ii = 0; ii < level1systems.Count && !found; ++ii) { if (level1systems[ii].on && level1systems[ii].WarmedUp) { found = true; } } if (found) { controller.Controls.setting1.option1.isOn = true; switch (--ii) { case 0: controller.Controls.setting2.option1.isOn = true; break; case 1: controller.Controls.setting2.option2.isOn = true; break; case 2: controller.Controls.setting2.option3.isOn = true; break; } ContextSwitched(); } } else if (control == controller.Controls.button2) { int ii = 0; bool found = false; for (ii = 0; ii < level2systems.Count && !found; ++ii) { if (level2systems[ii].on && level2systems[ii].WarmedUp) { found = true; } } if (found) { controller.Controls.setting1.option2.isOn = true; switch (--ii) { case 0: controller.Controls.setting2.option1.isOn = true; break; case 1: controller.Controls.setting2.option2.isOn = true; break; case 2: controller.Controls.setting2.option3.isOn = true; break; } ContextSwitched(); } } else if (control == controller.Controls.button3) { int ii = 0; bool found = false; for (ii = 0; ii < level1systems.Count && !found; ++ii) { if (level3systems[ii].on && level3systems[ii].WarmedUp) { found = true; } } if (found) { controller.Controls.setting1.option3.isOn = true; switch (--ii) { case 0: controller.Controls.setting2.option1.isOn = true; break; case 1: controller.Controls.setting2.option2.isOn = true; break; case 2: controller.Controls.setting2.option3.isOn = true; break; } ContextSwitched(); } } } }
public override void RunUpdate() { //update all system timers and the current current = 0; power = startingPower; PowerSystem curSys = GetCurrentSystem(); bool level1enabled = false; foreach (PowerSystem sys in level1systems) { if (sys.on) { bool notWarm = false; if (!sys.WarmedUp) { notWarm = true; sys.warmUpTimer -= Time.deltaTime; } if (sys.WarmedUp) { level1enabled = true; current += sys.runningCurrent; if (notWarm && sys == curSys) { controller.Controls.greenLight.Lit = true; controller.Controls.yellowLight.Lit = false; controller.Controls.redLight.Lit = false; //tutorial if (curState == TutState.YellowLight) { tut.YellowLightHint.SetActive(false); tut.GreenLightHint.SetActive(true); tut.ExplainMeter1c.SetActive(true); curState = TutState.ExplainMeter1c; } } } else { current += sys.initialCurrent; } power -= sys.power; } } bool level2enabled = false; foreach (PowerSystem sys in level2systems) { if (sys.on) { bool notWarm = false; if (!sys.WarmedUp) { notWarm = true; sys.warmUpTimer -= Time.deltaTime; } if (sys.WarmedUp) { level2enabled = true; current += sys.runningCurrent; if (notWarm && sys == curSys) { controller.Controls.greenLight.Lit = true; controller.Controls.yellowLight.Lit = false; controller.Controls.redLight.Lit = false; //tutorial if (curState == TutState.YellowLight) { tut.YellowLightHint.SetActive(false); tut.GreenLightHint.SetActive(true); tut.ExplainMeter1c.SetActive(true); curState = TutState.ExplainMeter1c; } } } else { current += sys.initialCurrent; } power -= sys.power; } } bool level3enabled = false; foreach (PowerSystem sys in level3systems) { if (sys.on) { bool notWarm = false; if (!sys.WarmedUp) { notWarm = true; sys.warmUpTimer -= Time.deltaTime; } if (sys.WarmedUp) { level3enabled = true; current += sys.runningCurrent; if (notWarm && sys == curSys) { controller.Controls.greenLight.Lit = true; controller.Controls.yellowLight.Lit = false; controller.Controls.redLight.Lit = false; //tutorial if (curState == TutState.YellowLight) { tut.YellowLightHint.SetActive(false); tut.GreenLightHint.SetActive(true); tut.ExplainMeter1c.SetActive(true); curState = TutState.ExplainMeter1c; } } } else { current += sys.initialCurrent; } power -= sys.power; } } //update UI for current if (controller.Controls.toggle2.isOn) { controller.Controls.meter1.Value = (power < 0 ? 0 : power); } else { controller.Controls.meter1.Value = current; } if (level1enabled) { controller.Controls.button1.ToggleButton(true); } else { controller.Controls.button1.ToggleButton(false); } if (level2enabled) { controller.Controls.button2.ToggleButton(true); } else { controller.Controls.button2.ToggleButton(false); } if (level3enabled) { controller.Controls.button3.ToggleButton(true); } else { controller.Controls.button3.ToggleButton(false); } if (current > currentLimit || power < 0) // failed { ResetUI(); EndProcedure(false); } else if (level1enabled && level2enabled && level3enabled) // success { ResetUI(); EndProcedure(true); } }
public void ExplainButtonClicked() { switch (curState) { case TutState.ExplainMeter1: tut.ExplainMeter1a.SetActive(false); tut.ExplainMeter2a.SetActive(true); curState = TutState.ExplainMeter2; break; case TutState.ExplainMeter2: tut.ExplainMeter2a.SetActive(false); tut.ExplainMeter3.SetActive(true); curState = TutState.ExplainMeter3; break; case TutState.ExplainMeter3: tut.ExplainMeter3.SetActive(false); tut.Toggle2Hinta.SetActive(true); tutWait = false; curState = TutState.WaitForToggle2; break; case TutState.ExplainMeter1b: tut.ExplainMeter1b.SetActive(false); tut.ExplainMeter2b.SetActive(true); curState = TutState.ExplainMeter2b; break; case TutState.ExplainMeter2b: tut.ExplainMeter2b.SetActive(false); tut.ExplainSetting1a.SetActive(true); curState = TutState.ExplainSetting1; break; case TutState.ExplainSetting1: tut.ExplainSetting1a.SetActive(false); tut.ExplainSetting1b.SetActive(true); curState = TutState.ExplainSetting1b; break; case TutState.ExplainSetting1b: tut.ExplainSetting1b.SetActive(false); tut.ExplainSetting2a.SetActive(true); curState = TutState.ExplainSetting2; break; case TutState.ExplainSetting2: tut.ExplainSetting2a.SetActive(false); tut.ExplainSetting2b.SetActive(true); curState = TutState.ExplainSetting2b; break; case TutState.ExplainSetting2b: tut.ExplainSetting2b.SetActive(false); tut.ExplainSetting2c.SetActive(true); tut.Toggle2Hintb.SetActive(true); curState = TutState.ExplainSetting2c; tutWait = false; break; case TutState.ExplainSetting2c: tut.ExplainSetting2c.GetComponentInChildren <Button>().gameObject.SetActive(false); tut.ExplainSetting2c.SetActive(false); tut.Toggle2Hintb.SetActive(false); tut.Toggle1Hinta.SetActive(true); tut.RedLightHint.SetActive(true); curState = TutState.WaitForToggle1; break; case TutState.ExplainMeter1c: tut.ExplainMeter1c.SetActive(false); tut.GreenLightHint.SetActive(false); tut.ExplainSetting1c.SetActive(true); curState = TutState.ExplainSetting1c; break; case TutState.ExplainSetting1c: tut.ExplainSetting1c.SetActive(false); tut.Setting1Hint.SetActive(true); curState = TutState.WaitForSetting1; tutWait = false; break; case TutState.ExplainEnding: tut.ExplainEnding.SetActive(false); break; } }
void Update() { if (isTutorial) { switch (curTutState) { case TutState.NONE: if (Input.GetMouseButtonDown(0)) { if (ball.IsOnTriangle()) { tutIsClicked = true; } else { print("NONE DOWN"); // Activate gameover dialog with appropriate message TutFailDialog.SetActive(true); source.volume = 0.3f; Time.timeScale = 0f; curTutState = TutState.END; } } else if (Input.GetMouseButtonUp(0)) { // Activate gameover dialog with appropriate message if (!ball.IsInsideRedCircleInQuarterNote()) { TutFailDialog.transform.GetChild(0).GetComponent <Text> ().text = "Unclick only inside the red circle!"; TutFailDialog.SetActive(true); Time.timeScale = 0f; source.volume = 0.3f; curTutState = TutState.END; } else { tutIsUnclicked = true; } } break; case TutState.TUT_CLICK: if (Input.GetMouseButtonDown(0)) { Time.timeScale = 1f; InfoText.SetActive(false); curTutState = TutState.NONE; source.UnPause(); } break; case TutState.TUT_UNCLICK: if (Input.GetMouseButtonUp(0)) { Time.timeScale = 1f; InfoText.SetActive(false); curTutState = TutState.NONE; source.UnPause(); } break; case TutState.BEGIN: if (Input.GetMouseButtonDown(0) && currentGameState == GameState.PLAYING) { TutFailDialog.transform.GetChild(0).GetComponent <Text> ().text = "Wait for the instruction to click!"; TutFailDialog.SetActive(true); Time.timeScale = 0; curTutState = TutState.END; source.volume = 0.3f; } break; } } if (currentGameState == GameManager.GameState.START) { if (Input.GetMouseButtonDown(0)) { SetGameState(GameManager.GameState.PLAYING); Time.timeScale = 1; } } }
public void SetEndTutState() { tutState = TutState.END; }
public void SetNoneState() { tutState = TutState.NONE; }
public void SetLetterRevealState() { tutState = TutState.LETTER_REVEAL; }
public override TutState OnUpdate(TutState tutState) { Init(tutState); return(tutState); }
public void SetWaitingButtonTapState() { tutState = TutState.WAITING_BUTTON_TAP; }