예제 #1
0
        protected void QuestionRight()
        {
            _sfx.PlaySound("Right");
            QuestionsRight++;

            if (OnAnswerFeedback != null)
            {
                OnAnswerFeedback(true);
            }

            if (OnRightAnswer != null)
            {
                OnRightAnswer(QuestionsRight);
            }

            //if (!WaitShowFeedBack) return;

            if (_score != null)
            {
                passed = _times.Sum(x => x.Value);

                if (ScoreType == QuizScore.Score)
                {
                    _score.AddScore(QuestionScore, passed);
                }
            }
        }
        void GameEnded()
        {
            if (LockCards != null)
            {
                LockCards();
            }

            if (gameWon)
            {
                if (_sfxController != null)
                {
                    _sfxController.PlaySound(victorySfx);
                }

                _scoreController.AddScore((int)tempScore, _timeController.TimeSinceGameStart);
                //CallAction(idVictory);
            }
            else
            {
                if (_sfxController != null)
                {
                    _sfxController.PlaySound(gameOverSfx);
                }

                //CallAction(idDefeat);
                _scoreController.AddScore(0, _timeController.TimeSinceGameStart);
            }

            if (_registerController != null)
            {
                _registerController.AddRegisterValue("MemoryWon", gameWon.ToString(), false);
                _registerController.AddRegisterValue("MemoryScore", tempScore.ToString(), false);
            }
        }
예제 #3
0
        private void TimeOut()
        {
            CallAction(TimeCall);
            _sfx.PlaySound("Lose");
            datas = new List <int>();

            EndGame();
        }
예제 #4
0
        private void GameEndAnimation()
        {
            for (int i = 0; i < CharController.Length; i++)
            {
                if (CharController[i] != null)
                {
                    CharController[i].SetBool("FaseEnd", false);
                }
            }

            if (_sfx != null)
            {
                _sfx.PlaySound("GameEnd");
            }
        }
예제 #5
0
        protected override void OnUpdate()
        {
            if (hasCounted || !_controller.IsGameStarted || !_controller.IsGameRunning || !_bootstrap.IsAppRunning)
            {
                return;
            }

            var time = UnityEngine.Time.realtimeSinceStartup - _timeflow;

            for (int i = 1, n = Counter.Length; i <= n; i++)
            {
                if (time <= i && time > i - 1)
                {
                    _image.color  = Color.white;
                    _image.sprite = Counter[i - 1];

                    break;
                }
                _image.color = new Color(0, 0, 0, 0);
            }

            if (time >= Counter.Length)
            {
                _sfx.PlaySound("CounterEnd");
                hasCounted = true;
            }
        }
예제 #6
0
 public void TakeHit()
 {
     health -= 1;
     if (health <= 0)
     {
         SFXController.PlaySound("explosion");
         Destroy(gameObject);
         Instantiate(explosion, transform.position, transform.rotation);
         //parentScript.AlienDied();
         this.transform.parent.GetComponent <AliensController>().AlienDied(scoreValue);
     }
 }
        IEnumerator TakePictureRoutine(bool count)
        {
            if (count)
            {
                yield return(new WaitForSeconds(CounterTime));
            }

            yield return(0);

            if (_sfx != null)
            {
                _sfx.PlaySound("Snapshot");
            }

            Texture2D picture = new Texture2D(WebCam.width, WebCam.height);

            if (TakeFromWebCam)
            {
                picture.SetPixels(WebCam.GetPixels(0, 0, (int)WebCam.width, (int)WebCam.height));
                picture.Apply();
            }

            StopWebCam();

            if (string.IsNullOrEmpty(RegisterName))
            {
                if (TakeFromWebCam)
                {
                    _io.Save(picture);
                }

                if (TakeFromScreen)
                {
                    _io.SaveFromScreen();
                }
            }
            else
            {
                var reg = _bootstrap.GetModel(ModelTypes.Register) as RegistrationData;

                if (TakeFromWebCam)
                {
                    _io.Save(picture, reg.GetActualRegistry(RegisterName));
                }
                if (TakeFromScreen)
                {
                    _io.SaveFromScreen(reg.GetActualRegistry(RegisterName));
                }
            }

            StartWebCam();
        }
예제 #8
0
 IEnumerator ShootingRoutine()
 {
     while (true)
     {
         if (Input.GetButton("Fire1") ^ Input.GetMouseButtonDown(0) ^ Input.GetKeyDown("space"))
         {
             SFXController.PlaySound("laser");
             Instantiate(bullet, gameObject.transform.position, Quaternion.identity);
             yield return(new WaitForSeconds(1f / shootSpeed));
         }
         yield return(new WaitForSeconds(0));
     }
 }
        IEnumerator PlayFootsteps()
        {
            while (true)
            {
                if (isMoving && _vrCharacterController.IsGameRunning)
                {
                    stepsTimer += Time.deltaTime;

                    if (stepsTimer >= 0.7f)
                    {
                        stepsTimer = 0f;
                        _sfxController.PlaySound("Footsteps");
                    }
                }

                yield return(null);
            }
        }
예제 #10
0
 public static void PlayExplosion()
 {
     Instance.PlaySound(Instance.Explosion);
 }
예제 #11
0
 protected void QuestionRight()
 {
     _sfx.PlaySound("Right");
     right = true;
     OnReceiveAnswer(true);
 }
예제 #12
0
 public void PlaySound(string sound)
 {
     _sfx.PlaySound(sound);
 }