Exemple #1
0
    private void CheckIfGameHasStarted()
    {
        bool touchedScreen     = (MobileInputs.Instance.IsTap);
        bool gameHasNotStarted = (!_hasGameStarted);

        if (touchedScreen && gameHasNotStarted)
        {
            Camera.main.fieldOfView = 122.2f;
            _hasGameStarted         = true;
            _playerController.StartRunning();
            _glacierSpawner.IsScrolling = true;
            _cameraController.IsMoving  = true;
            GameCanvas.SetTrigger("Show");
            MenuAnim.SetTrigger("Hide");
        }

        if (_hasGameStarted && !IsDead)
        {
            //Bump up the score
            _score += (Time.deltaTime * _modifierScore);
            if (_lastScore != (int)_score)
            {
                _lastScore     = (int)_score;
                ScoreText.text = _score.ToString("0");
            }
        }
    }
 private void Update()
 {
     if (MobileInputs.Instance.Tap && !isGameStarted)
     {
         isGameStarted = true;
         controller.StartRunning();
         FindObjectOfType <CameraController>().IsMoving  = true;
         FindObjectOfType <GlacierSpawner>().IsScrolling = true;
         //GameCanvas.SetTrigger("Show");
         MenuAnim.SetTrigger("Hide");
     }
     if (isGameStarted && !IsDead && !isPaused)
     {
         PauseShow();
         score += (Time.deltaTime * modifierScore);
         if (lastScore != (int )score)
         {
             lastScore      = (int)score;
             scoreText.text = "Score : " + score.ToString("0");
         }
     }
 }