private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.game) { NewPizza(); } }
private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.game) { StartCoroutine(StartTimer()); } }
//method is responsible for reloading the game form thus resetting the game public static void ResetGame() { curState = Constants.GameState.Game; GameForm.Dispose(); GameForm = new GameScreen(); GameForm.StartGame(); GameForm.Show(); }
private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.game) { _source.clip = _gameMusic; _source.Play(); } }
private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.end) { } else if (state == Constants.GameState.cancelStart) { _playersToppingPool = new List <ToppingIcon>(Toppings); } }
void Update() { movesText.text = "Moves: " + noOfMoves; scoreText.text = "Score: " + score; if (noOfMoves == 0) { panel.SetActive(true); score = 0; noOfMoves = 10; } if (boardState == Constants.GameState.None) { if (Input.GetMouseButtonDown(0)) { var mouseHit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if (mouseHit.collider != null) { firstHit = mouseHit.collider.gameObject; firstHit.GetComponent <SpriteRenderer>().color = Constants.tileSelected; boardState = Constants.GameState.SelectionStarted; } } } else if (boardState == Constants.GameState.SelectionStarted) { if (Input.GetMouseButtonDown(0)) { var mouseHit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if (firstHit != null && mouseHit.collider != null) { secondHit = mouseHit.collider.gameObject; secondHit.GetComponent <SpriteRenderer>().color = Constants.tileSelected; boardState = Constants.GameState.Swapping; } } } else if (boardState == Constants.GameState.Swapping) { SwapAndMatch(firstHit, secondHit); firstHit.GetComponent <SpriteRenderer>().color = Constants.tileDeselected; secondHit.GetComponent <SpriteRenderer>().color = Constants.tileDeselected; firstHit = null; secondHit = null; boardState = Constants.GameState.None; } MatchOnStart(); }
private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.howTo) { _canvasGroup.DOFade(1f, 0.5f).SetEase(Ease.OutCirc); } else if (state == Constants.GameState.menu) { _canvasGroup.DOFade(0f, 0.5f).SetEase(Ease.OutCirc); } }
private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.starting) { SpawnPlayers(); } else if (state == Constants.GameState.menu) { ClearPlayers(); } }
private void SetGameState(Constants.GameState state) { if (_gameState != state) { _gameState = state; if (OnGameStateChanged != null) { OnGameStateChanged(_gameState); } } }
private void Start() { Camera = Camera.main; _player = GetComponent<PlayerStats>(); _gameState = Constants.GameState.WaitingInput; _cursor = new GameObject {name = "Cursor"}; _cursor.AddComponent<SpriteRenderer>(); _cursor.GetComponent<SpriteRenderer>().sprite = CursorSprite; SetActiveGem(null); BoardLogic = GameObject.FindGameObjectWithTag("Board").GetComponent<BoardLogic>(); BoardLogic.InitBoard(this, 6, 8); }
private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.starting) { StartCoroutine(StartMenuTimer()); _cancelText.SetActive(true); } else if (state == Constants.GameState.cancelStart) { StopAllCoroutines(); _readyText.text = Constants.MENU_READY_PLAYERS; _cancelText.SetActive(false); } }
private void HandleGameStateChanged(Constants.GameState state) { if (state == Constants.GameState.end) { //set scores _numPizzasMade.text = PizzaManager.SharedInstance.GetNumPizzas().ToString(); _averageQuality.text = PizzaManager.SharedInstance.GetAverageScore().ToString() + _qualitySuffix; _bestPizza.text = PizzaManager.SharedInstance.GetHighScore().ToString() + _qualitySuffix; _worstPizza.text = PizzaManager.SharedInstance.GetLowScore().ToString() + _qualitySuffix; _ranking.text = PizzaManager.SharedInstance.GetRanking(); _canvasGroup.DOFade(1f, 0.5f).SetEase(Ease.OutCirc); } }
public void SetAnimationState(float time) { _stateAnimationCounter = time; _gameState = Constants.GameState.Animation; }
private void UpdateGameState() { switch (_gameState){ case Constants.GameState.WaitingInput: break; case Constants.GameState.Animation: _stateAnimationCounter -= Time.deltaTime; if (_stateAnimationCounter <= 0){ _stateAnimationCounter = 0; _gameState = Constants.GameState.WaitingInput; } break; } }
// Use this for initialization private void Start() { _gameState = Constants.GameState.menu; Init(); }