private void OnGameStateHandler(GameStateMessage gameStateMessage)
        {
            if (gameStateMessage.GameState == GameState.Playing)
            {
                _CanGenerateObstacle = true;
                StartCoroutine(GenerateObstacle());
                StartCoroutine(GeneratePowerUp());
            }
            else
            {
                _CanGenerateObstacle = false;
            }

            if (gameStateMessage.GameState == GameState.GameOver)
            {
                foreach (Obstacle obstacle in _Obstacles)
                {
                    if (obstacle != null)
                    {
                        Destroy(obstacle.gameObject);
                    }
                }
                foreach (PowerUp powerUp in _PowerUps)
                {
                    if (powerUp != null)
                    {
                        Destroy(powerUp.gameObject);
                    }
                }
                _Obstacles.Clear();
                _PowerUps.Clear();
                StopAllCoroutines();
            }
        }
        private void OnGameStateHandler(GameStateMessage gameStateMessage)
        {
            if (gameStateMessage.GameState == GameState.Menu)
            {
                MenuRect.gameObject.SetActive(true);
            }
            else
            {
                MenuRect.gameObject.SetActive(false);
            }

            switch (gameStateMessage.GameState)
            {
            case GameState.Menu:
                WidgetsRect.gameObject.SetActive(false);
                break;

            case GameState.Playing:
                WidgetsRect.gameObject.SetActive(true);
                break;

            case GameState.Pause:
                PauseModal.gameObject.SetActive(true);
                break;

            case GameState.GameOver:
                WidgetsRect.gameObject.SetActive(false);
                GameOverModal.gameObject.SetActive(true);
                break;
            }
        }
 private void OnGameStateHandler(GameStateMessage gameStateMessage)
 {
     if (GameManager.CurrentGameState == GameState.Launch)
     {
         _Camera.orthographicSize = 2;
         transform.localPosition  = new Vector2(0, 0);
     }
 }
 private void OnGameStateHandler(GameStateMessage gameStateMessage)
 {
     if (gameStateMessage.GameState == GameState)
     {
         gameObject.SetActive(true);
     }
     else
     {
         gameObject.SetActive(false);
     }
 }
Example #5
0
 private void OnGameStateHandler(GameStateMessage gameStateMessage)
 {
     if (gameStateMessage.GameState.Equals(GameState))
     {
         OnStateEvent.Invoke(true);
     }
     else
     {
         OnStateEvent.Invoke(false);
     }
 }
 private void GameStateHandler(GameStateMessage gameStateMessage)
 {
     if (gameStateMessage.GameState == GameState.Launch)
     {
         GenerateStarSystem();
         transform.localPosition = new Vector3(Random.Range(-10, 30), 0, 50);
     }
     if (gameStateMessage.GameState == GameState.Menu)
     {
         Clear();
     }
 }
Example #7
0
        private void OnGameStateHander(GameStateMessage gameStateMessage)
        {
            if (gameStateMessage.GameState == GameState.Launch || gameStateMessage.GameState == GameState.Menu)
            {
                gameObject.SetActive(true);
                _Shield.IncreaseEnergy(_Shield.MaxEnergy);
                transform.position = Vector3.zero;
                transform.rotation = Quaternion.identity;
            }

            if (gameStateMessage.GameState == GameState.Launch)
            {
                transform.localRotation = Quaternion.Euler(-10, 0, 0); // ...
                LeanTween.rotateX(gameObject, 10f, 3f).setRecursive(true).setLoopPingPong();
            }
        }
        private void OnGameStateHandler(GameStateMessage gameStateMessage)
        {
            PreviousGameState = CurrentGameState;
            CurrentGameState  = gameStateMessage.GameState;

            if (gameStateMessage.GameState == GameState.Playing || gameStateMessage.GameState == GameState.Launch)
            {
                Time.timeScale = 1;
            }
            else
            {
                Time.timeScale = 0;
            }

            if (gameStateMessage.GameState == GameState.Menu)
            {
                SaveData();
            }

            if (CurrentGameState == GameState.Launch)
            {
                StartCoroutine(StartContdown());
            }
        }
Example #9
0
 private void OnGameStateHandler(GameStateMessage gameStateMessage)
 {
 }
Example #10
0
 private void OnGameStateHandler(GameStateMessage gameStateMessage)
 {
     _CanGenerateObstacle = gameStateMessage.GameState == GameState.Playing;
 }