void Start() { EndGameOverlay = GameObject.Find("CanvasEndGame"); if (EndGameOverlay != null) { EndGameOverlay.SetActive(false); } StartGameOverlay = GameObject.Find("CanvasStartGame"); if (StartGameOverlay != null) { StartGameOverlay.SetActive(true); } GamePlayOverlay = GameObject.Find("CanvasGamePlay"); if (GamePlayOverlay != null) { GamePlayOverlay.SetActive(false); } GameBackingOverlay = GameObject.Find("GameBackingLayer"); if (GameBackingOverlay != null) { GameBackingOverlay.SetActive(true); } _playfieldState = ePlayfieldState.waitingToStart; if (GamePlayOverlay != null) { GamePlayOverlay.SetActive(true); } if (GameplayManager._gameDifficulty == GameplayManager.eGameDifficulty.easy) { PlayFieldEasy.SetActive(true); PlayFieldHard.SetActive(false); //PlayFieldExpert.SetActive (false); } else if (GameplayManager._gameDifficulty == GameplayManager.eGameDifficulty.hard) { PlayFieldEasy.SetActive(false); PlayFieldHard.SetActive(true); //PlayFieldExpert.SetActive (false); } else if (GameplayManager._gameDifficulty == GameplayManager.eGameDifficulty.expert) { PlayFieldEasy.SetActive(false); PlayFieldHard.SetActive(false); //PlayFieldExpert.SetActive (true); } }
void Update() { switch (_playfieldState) { case ePlayfieldState.init: break; case ePlayfieldState.waitingToStart: SetCircularLoadAmount(1.0f); break; case ePlayfieldState.gameplay: //get timing value from gameplay manager //float remainingTime = GameCommon.getGameplayManagerClass ().GetPuzzleTimeLeft (); float remainingTime = GameplayManager.Instance.GetPuzzleTimeLeft(); SetCircularLoadAmount(remainingTime); break; case ePlayfieldState.displayResults: { _playfieldState = ePlayfieldState.showingResults; } break; case ePlayfieldState.showingResults: { _elaspedTime += Time.deltaTime; if (_elaspedTime > _puzzleResultsTime) { //start next puzzle - call gameplay manager Debug.Log("_playfieldState : StartNextPuzzle"); //GameCommon.getGameplayManagerClass().StartNextPuzzle(); GameplayManager.Instance.StartNextPuzzle(); _playfieldState = ePlayfieldState.gameplay; _elaspedTime = 0.0f; } } break; } }
//GUI //this gets called by the GUI button "Ready" public void StartMatch() { //remove canvas if (StartGameOverlay != null) StartGameOverlay.SetActive(false); if (GamePlayOverlay != null) GamePlayOverlay.SetActive(true); _playfieldState = ePlayfieldState.gameplay; GameCommon.getGameplayManagerClass()._gameDifficulty = GameplayManager.eGameDifficulty.hard; GameCommon.getGameplayManagerClass().StartGame(); }
//GUI //this gets called by the GUI button "Ready" public void StartMatch() { //remove canvas if (StartGameOverlay != null) { StartGameOverlay.SetActive(false); } if (GamePlayOverlay != null) { GamePlayOverlay.SetActive(true); } _playfieldState = ePlayfieldState.gameplay; GameplayManager.Instance.StartGame(); }
//only for last puzzle - wait and trigger next puzzle public void SetPuzzleResults(int score, int level) { _playfieldState = ePlayfieldState.displayResults; SetOverlayScoreAndLevel(score, level); }
void Update() { switch (_playfieldState) { case ePlayfieldState.init: break; case ePlayfieldState.waitingToStart: SetCircularLoadAmount(1.0f); break; case ePlayfieldState.gameplay: //get timing value from gameplay manager float remainingTime = GameCommon.getGameplayManagerClass().GetPuzzleTimeLeft(); SetCircularLoadAmount(remainingTime); break; case ePlayfieldState.displayResults: { _playfieldState = ePlayfieldState.showingResults; } break; case ePlayfieldState.showingResults: { _elaspedTime += Time.deltaTime; if(_elaspedTime > _puzzleResultsTime) { //start next puzzle - call gameplay manager Debug.Log ("_playfieldState : StartNextPuzzle"); GameCommon.getGameplayManagerClass().StartNextPuzzle(); _playfieldState = ePlayfieldState.gameplay; _elaspedTime = 0.0f; } } break; } }
void Start() { EndGameOverlay = GameObject.Find("CanvasEndGame"); if (EndGameOverlay != null) { EndGameOverlay.SetActive(false); } StartGameOverlay = GameObject.Find("CanvasStartGame"); if (StartGameOverlay != null) { StartGameOverlay.SetActive(true); } GamePlayOverlay = GameObject.Find("CanvasGamePlay"); if (GamePlayOverlay != null) { GamePlayOverlay.SetActive(false); } GameBackingOverlay = GameObject.Find("GameBackingLayer"); if (GameBackingOverlay != null) { GameBackingOverlay.SetActive(true); } _playfieldState = ePlayfieldState.waitingToStart; }
//only for last puzzle - wait and trigger next puzzle public void SetPuzzleResults(int score, int level) { _playfieldState = ePlayfieldState.displayResults; SetOverlayPostGameValues(score, level); }