示例#1
0
    void Update()
    {
        //------------------Debug Input----------------------------
        if (Input.GetKeyDown(KeyCode.Space))
        {
            _shootCannonScript.Shoot();
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            RaycastHit hitInfo;
            GameObject blub = _dragandDropScript.ReturnClickedObject(out hitInfo);
            Debug.Log(blub);
        }

        if (Input.GetKeyDown(KeyCode.K))
        {
            _playerControllerScript.PlayerHealth -= 1;
        }

        //---------------------End------------------------------------


        //-----------------Player Inputs------------------------------
        if (_ingameButtonManagerScript.GameIsPaused == false)
        {
            //mouse button down
            if (Input.GetMouseButtonDown(0) && !_disableDragAndDrop)
            {
                _dragandDropScript.ClickDragAndDropButton();
            }
            //mouse button up
            if (Input.GetMouseButtonUp(0))
            {
                _dragandDropScript.ReleaseDragAndDropButton();
            }
        }


        //----------------------End-------------------------------



        //Player correct
        if (_calculateScript.TargetResult == _calculateScript.ListOfOperands.Sum())
        {
            ResultIsCorrect();
        }

        //Game Over
        if (_playerControllerScript.PlayerHealth <= 0)
        {
            if (_playIfOnce)
            {
                _ingameButtonManagerScript.GameOver();
                _playIfOnce = false;
            }
        }

        //Player victorious
        if (_enemyControllerScript.PlayerVictorious == true)
        {
        }

        //load too much
        if (_calculateScript.ListOfOperands.Count() == 2 && _calculateScript.ListOfOperands.Sum() > _calculateScript.TargetResult)
        {
            if (_playSoundOnce)
            {
                SoundController.RandomizeSfx(.95f, 1.05f, _audioSourceCalculate, _loadTooMuch);
                _playSoundOnce = false;
            }

            ResultIsWrong();
        }

        //load too little
        if (_calculateScript.ListOfOperands.Count() == 2 && _calculateScript.ListOfOperands.Sum() < _calculateScript.TargetResult)
        {
            if (_playSoundOnce)
            {
                SoundController.RandomizeSfx(.95f, 1.05f, _audioSourceCalculate, _loadTooLittle);
                _playSoundOnce = false;
            }

            ResultIsWrong();
        }
    }