public void ProcessTimers() { phaseTimer += Time.deltaTime; switch (currentGamePhase) { case GamePhaseEnum.INTRO: phaseThreshold = 1f; break; case GamePhaseEnum.QUOTE_INTRO: phaseThreshold = 5f; break; case GamePhaseEnum.QUOTE_REVEAL: phaseThreshold = 5f; break; case GamePhaseEnum.SCORING: phaseThreshold = 1f; break; default: phaseThreshold = Mathf.Infinity; break; } if (phaseTimer > phaseThreshold) { phaseTimer = 0f; switch (currentGamePhase) { case GamePhaseEnum.INTRO: maxRemovesAllowed = textDirector.quoteFramesList[0].removeCount; maxMovesAllowed = textDirector.quoteFramesList[0].reorderCount; maxInsertsAllowed = textDirector.quoteFramesList[0].rephraseCount; startDisplayScript.contentString = textDirector.quoteFramesList[0].startQuote; startDisplayScript.TriggerEffect(0.5f); startDisplayPortraitSprRend.sprite = textDirector.quoteFramesList[0].portraitSprite; finishedDisplayPortraitSprRend.sprite = textDirector.quoteFramesList[0].portraitSprite; SceneVariableManager.originalQuote = textDirector.quoteFramesList[0].startQuote; dialogueText.text = textDirector.quoteFramesList[0].editorDialogueText; currentGamePhase = GamePhaseEnum.QUOTE_INTRO; break; case GamePhaseEnum.QUOTE_INTRO: currentGamePhase = GamePhaseEnum.INPUT; break; } } }
private void ChangeActiveGamePhase(GamePhaseEnum gamePhase) { if (_activeGamePhase != null) { _activeGamePhase.IsVisible = false; } _activeGamePhase = _gamePhases[gamePhase]; _activeGamePhase.Init(); _activeGamePhase.IsVisible = true; }
/// <summary> /// Called by the level itself when it finishes. /// </summary> private void LevelEndedPlayerWon() { // Fugly way of selecting the next level. // Assumes levels are at the end of the _gamePhases dictionary. int nextIndex = _gamePhases.Values.ToList().IndexOf(_activeGamePhase) + 1; GamePhaseEnum nextLevel = nextIndex >= _gamePhases.Count ? GamePhaseEnum.StartScreen : _gamePhases.Keys.ToList()[nextIndex]; ChangeActiveGamePhase(nextLevel); }
/// <summary> /// Ends the current turn /// </summary> public void EndCurrentTurn() { this.TurnNumber++; if (this.CurrentPhase == GamePhaseEnum.Mulligan && this.TurnNumber >= 3) { this.TurnNumber = 1; this.CurrentPhase = GamePhaseEnum.Normal; } else { this.CurrentPlayerId = (this.CurrentPlayerId + 1) % Settings.MaxPlayerCount; } TurnManager.CurrentInstance.OnTurnStart(); }
/// <summary> /// Reveal the health cards to the player /// </summary> private void StartGame() { // Compare health cards to see who goes first var player0HealthCard = PlayerStateManager.CurrentInstance.Player0State.HealthCards.Last(); var player1HealthCard = PlayerStateManager.CurrentInstance.Player1State.HealthCards.Last(); this.CurrentPhase = GamePhaseEnum.Mulligan; this.TurnNumber = 1; this.CurrentPlayerId = player0HealthCard > player1HealthCard ? 0 : 1; if (this.isServer) { this.RpcOnStartTurn(); } else { TurnManager.CurrentInstance.Render(); } }
public void ProcessGameState() { switch (currentGamePhase) { case GamePhaseEnum.QUOTE_INTRO: startQuoteAnchor.transform.position = Vector3.Lerp(startQuoteAnchor.transform.position, onScreenDisplayQuotePos, Time.deltaTime * 5f); break; case GamePhaseEnum.INPUT: startQuoteAnchor.transform.position = Vector3.Lerp(startQuoteAnchor.transform.position, offScreenDialoguePos, Time.deltaTime * 5f); textDirector.quoteFramesList[(int)textDirector.selectedQuoteType].transform.position = Vector3.Lerp(textDirector.quoteFramesList[(int)textDirector.selectedQuoteType].transform.position, onScreenQuotePos, Time.deltaTime * 5f); dialogueAnchor.transform.position = Vector3.Lerp(dialogueAnchor.transform.position, onScreenDialoguePos, Time.deltaTime * 5f); if (!repairUIAnchor.activeSelf) { repairUIAnchor.SetActive(true); } if (textDirector.isFinishedProcessingSubmission) { currentGamePhase = GamePhaseEnum.QUOTE_REVEAL; finishedDisplayScript.contentString = textDirector.submittedString; finishedDisplayScript.TriggerEffect(0.5f); } break; case GamePhaseEnum.QUOTE_REVEAL: if (repairUIAnchor.activeSelf) { repairUIAnchor.SetActive(false); } finishedQuoteAnchor.transform.position = Vector3.Lerp(finishedQuoteAnchor.transform.position, onScreenDisplayQuotePos, Time.deltaTime * 5f); dialogueAnchor.transform.position = Vector3.Lerp(dialogueAnchor.transform.position, offScreenDialoguePos, Time.deltaTime * 5f); textDirector.quoteFramesList[(int)textDirector.selectedQuoteType].transform.position = Vector3.Lerp(textDirector.quoteFramesList[(int)textDirector.selectedQuoteType].transform.position, offScreenQuotePos, Time.deltaTime * 5f); newsButton.SetActive(true); break; default: break; } }
private void Add(GamePhaseEnum phaseType, GamePhase gamePhase) { _gamePhases.Add(phaseType, gamePhase); }
public void Add(GamePhaseEnum phaseType, GamePhase gamePhase) { _gamePhases.Add(phaseType, gamePhase); }