public void SelectPreviousMenu() { MainMenuStates PreviousMenuState = MainMenuStates.EmptyState; switch (_CurrentMainMenuState) { case MainMenuStates.StartGameState: PreviousMenuState = MainMenuStates.EmptyState; break; case MainMenuStates.OptionsState: PreviousMenuState = MainMenuStates.StartGameState; break; case MainMenuStates.ExitGameState: PreviousMenuState = MainMenuStates.StartGameState; break; case MainMenuStates.PlayersSelectionState: PreviousMenuState = MainMenuStates.StartGameState; break; case MainMenuStates.SelectGameTypeState: PreviousMenuState = MainMenuStates.PlayersSelectionState; break; case MainMenuStates.EmptyState: PreviousMenuState = MainMenuStates.EmptyState; break; } _SelectMenu(PreviousMenuState); }
public override MainMenuStates Tick() { MainMenuStates aux = this._nextState; this._nextState = MainMenuStates.Null; return(aux); }
private void Start() { currentState = MainMenuStates.TitleScreen; // Execute Title Screen ChangeStateAndExecute(currentState); }
public void AttachAllObjectsToParent() { center.gameObject.transform.parent = parentForMovement; top.gameObject.transform.parent = parentForMovement; bot.gameObject.transform.parent = parentForMovement; start.gameObject.transform.parent = parentForMovement; mystate = MainMenuStates.moveEverythingDown; }
private void SwitchToNewState(MainMenuStates nextState) { CurentState?.ExitState(); CurentState = _availableStates[nextState]; CurentState?.EnterState(); OnStateChanged?.Invoke(CurentState); }
void EnableObjects(MainMenuStates p_futureState) { //Desativa o gerenciador de estado anterior panelsList [(int)currentState].SetActive (false); statesGOList [(int)currentState].SetActive (false); currentState = p_futureState; //Ativa o proximo gerenciador de estado panelsList [(int)currentState].SetActive (true); statesGOList [(int)currentState].SetActive (true); }
new void Awake() { // Used to get the reference to the player base.Awake(); currentMenu = menu; currentState = MainMenuStates.menu; // Disable all other CanvasGroups disableMenu(characterSelect); disableMenu(customize); disableMenu(options); }
private MenuState _GetMenuStateByType(MainMenuStates SearchType) { MenuState SearchMenuState = null; foreach (MenuState FetchMenuState in MenuStatesList) { if (FetchMenuState.Type == SearchType) { SearchMenuState = FetchMenuState; } } return(SearchMenuState); }
public void ChangeStateAndExecute(MainMenuStates newState) { currentState = newState; switch (currentState) { case MainMenuStates.TitleScreen: DisplayTitleScreen(); break; case MainMenuStates.MinigameSelection: DisplaySelectionScreen(); break; } }
private void SwitchState(MainMenuStates state) { switch (state) { case MainMenuStates.MainMenu: _mainMenu.SetActive(true); _settingsMenu.SetActive(false); break; case MainMenuStates.SettingsMenu: _mainMenu.SetActive(false); _settingsMenu.SetActive(true); break; } }
void OnGUI() { if (MainMenuState == MainMenuStates.MainMenu) { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), mainmenu); if (GUI.Button(new Rect(416f / 1024 * Screen.width, 460f / 768 * Screen.height, 310f / 1024 * Screen.width, 214f / 768 * Screen.height), play)) { MainMenuState = MainMenuStates.Story; StartCoroutine("show2"); } } else { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), story); } }
// Private Functions private void _SelectMenu(MainMenuStates SelectedType) { MenuState NewSelectedMenuState = _GetMenuStateByType(SelectedType); if (NewSelectedMenuState != null) { MenuState CurrentSelectedMenuState = _GetMenuStateByType(_CurrentMainMenuState); if (CurrentSelectedMenuState != null) { CurrentSelectedMenuState.ShowMenuPanel(false); } NewSelectedMenuState.ShowMenuPanel(true); _PreviousMainMenuState = _CurrentMainMenuState; _CurrentMainMenuState = SelectedType; } }
private void Update() { if (CurentState == null) { CurentState = _availableStates.Values.First(); CurentState.EnterState(); } MainMenuStates nextState = CurentState.Tick(); Debug.Log(CurentState); PreviousState = CurentState; if (nextState != MainMenuStates.Null && _availableStates[nextState]?.GetType() != CurentState?.GetType()) { SwitchToNewState(nextState); } }
//Altera o estado atual public void ChangeToState (MainMenuStates p_futureState) { if (currentState == p_futureState) return; EnableObjects (p_futureState); }
public void AttachAllObjectsToParentPart2() { diamond.gameObject.transform.parent = parentForMovement; mystate = MainMenuStates.moveEverythingDown2; }
// Use this for initialization void Start() { MainMenuState = MainMenuStates.MainMenu; story = story1; }
public void Update() { if (mystate == MainMenuStates.titlecenter) { center.color = new Color(center.color.r, center.color.g, center.color.b, center.color.a + (Time.deltaTime / 3)); if (center.color.a >= 1) { mystate = MainMenuStates.top; } } else if (mystate == MainMenuStates.top) { if (delay <= 0.5f) { delay += Time.deltaTime; } else { top.fillAmount += Time.deltaTime * 2.5f; if (top.fillAmount >= 0.99f) { top.fillAmount = 1; delay = 0; mystate = MainMenuStates.bot; } } } else if (mystate == MainMenuStates.bot) { if (delay <= 0.5f) { delay += Time.deltaTime; } else { bot.fillAmount += Time.deltaTime * 2.5f; if (bot.fillAmount >= 0.99f) { bot.fillAmount = 1; delay = 0; mystate = MainMenuStates.waitingForStart; } } } else if (mystate == MainMenuStates.waitingForStart) { if (delay <= 0.5f) { delay += Time.deltaTime; } else { blink += Time.deltaTime; if (blink > 1.0f) { blink = 0; if (start.color.a > 0) { Color temp = new Color(1, 1, 1, 0); start.color = temp; } else { Color temp = new Color(1, 1, 1, 1); start.color = temp; } } } if (InputManager.IsStartPressed) { AttachAllObjectsToParent(); AudioManager._AUDIOMANAGER.playSound("PointCollect3"); } } else if (mystate == MainMenuStates.moveEverythingDown) { accelMovement += Time.deltaTime * 125; parentForMovement.localPosition = new Vector3(parentForMovement.localPosition.x, parentForMovement.localPosition.y - (Time.deltaTime * 50 * accelMovement), parentForMovement.localPosition.z); if (parentForMovement.localPosition.y <= -1000) { mystate = MainMenuStates.bringinCorners; delay = 1000; } } else if (mystate == MainMenuStates.bringinCorners) { delay -= Time.deltaTime * 1000; if (delay <= 0) { delay = 0; mystate = MainMenuStates.playersAbleToJoin; diamond.SetActive(true); foreach (CornerSlide corner in corners) { corner.FadeIn(); corner.gameObject.SetActive(true); } } } else if (mystate == MainMenuStates.playersAbleToJoin) { //If player one presses A, turn on green sprite upper left. upperLeftCorner.sprite = lit; //Player presses start to go to next screen. if (InputManager.IsP1GreenDown) { corners [0].Corner(); GameManager._GAMEMANAGER.SetPlayerJoined(1, true); } if (InputManager.IsP2GreenDown) { corners [1].Corner(); GameManager._GAMEMANAGER.SetPlayerJoined(2, true); } if (InputManager.IsP3GreenDown) { corners [2].Corner(); GameManager._GAMEMANAGER.SetPlayerJoined(3, true); } if (InputManager.IsP4GreenDown) { corners [3].Corner(); GameManager._GAMEMANAGER.SetPlayerJoined(4, true); } if (InputManager.IsP1RedDown) { corners [0].Center(); GameManager._GAMEMANAGER.SetPlayerJoined(1, false); } if (InputManager.IsP2RedDown) { corners [1].Center(); GameManager._GAMEMANAGER.SetPlayerJoined(2, false); } if (InputManager.IsP3RedDown) { corners [2].Center(); GameManager._GAMEMANAGER.SetPlayerJoined(3, false); } if (InputManager.IsP4RedDown) { corners [3].Center(); GameManager._GAMEMANAGER.SetPlayerJoined(4, false); } if (InputManager.IsStartPressed) { AttachAllObjectsToParentPart2(); AudioManager._AUDIOMANAGER.playSound("UISelect"); } accelMovement = 0; } else if (mystate == MainMenuStates.moveEverythingDown2) { accelMovement += Time.deltaTime * 125; parentForMovement.localPosition = new Vector3(parentForMovement.localPosition.x, parentForMovement.localPosition.y - (Time.deltaTime * 50 * accelMovement), parentForMovement.localPosition.z); if (parentForMovement.localPosition.y <= -2000) { mystate = MainMenuStates.roundNum; roundSelecter.SetActive(true); } } else if (mystate == MainMenuStates.roundNum) { if (roundsSelected == false) { ActivateRounds(); } if (InputManager.IsP1BlueDown || InputManager.IsP2BlueDown || InputManager.IsP3BlueDown || InputManager.IsP4BlueDown) { DecreaseRound(); AudioManager._AUDIOMANAGER.playSound("PointCollect1"); } if (InputManager.IsCancelPressed) { IncreaseRound(); AudioManager._AUDIOMANAGER.playSound("PointCollect1"); } //if they press left, decrease //If they press a or start move to next step. int numrounds is the final selection if (InputManager.IsStartPressed) { mystate = MainMenuStates.tutorial; AudioManager._AUDIOMANAGER.playSound("UISelect"); currrentTut = 1; delay = 0; } if (InputManager.IsSubmitPressed) { mystate = MainMenuStates.tutorial; AudioManager._AUDIOMANAGER.playSound("UISelect"); currrentTut = 1; delay = 0; } } else if (mystate == MainMenuStates.tutorial) { tutorial.SetActive(true); //Press a to start match if (delay < 1) { delay += Time.deltaTime * 2; if (delay >= 1) { delay = 1; } tutorialScreens [currrentTut - 1].color = new Color(1, 1, 1, delay); } else { if (InputManager.IsSubmitPressed) { NextTutorialScreen(); } } } }
// Public Functions public void SelectMenu(MainMenuStates SelectedType) { _SelectMenu(SelectedType); }
/// <summary> /// Sets currentState with a MainMenuState /// </summary> public static void setCurrentState(MainMenuStates state) { currentState = state; }
public virtual void ChangeState(MainMenuStates nextState) { this._nextState = nextState; }
public BaseState(GameObject canvas) { _canvasObject = canvas; _nextState = MainMenuStates.Null; }