Example #1
0
    private void Update()
    {
        Debug.Log(_isOptionOrPlayOpen);

        if (_isOptionOrPlayOpen)
        {
            _animator.SetBool("IsSlingshoting", false);
            _myRb.velocity = Vector2.zero;
            _timerPower    = 0;
        }


        if (_playerInput == INPUTSTATE.GivingInput && _mustPlayCastSound)
        {
            _newSoundManagerScript.PlayCharge(int.Parse(gameObject.tag.Substring(gameObject.tag.Length - 1)) - 1);
            _mustPlayCastSound = false;
        }
        else if (_playerInput == INPUTSTATE.None)
        {
            _newSoundManagerScript.StopCharge(int.Parse(gameObject.tag.Substring(gameObject.tag.Length - 1)) - 1);
            _mustPlayCastSound = true;
        }

        if (_menuInformationScript == null || _menuInformationScript.GetVibrationsValue())
        {
            if (powerJauge.fillAmount > vibrationTreshold)
            {
                if (gameObject.tag == "Player1")
                {
                    _playerManagerScript.Vibration(_playerManagerScript._player, 0, 1.0f, vibrationTreshold * 0.5f);
                }
                vibrationTreshold += 0.2f;
            }
            else if (powerJauge.fillAmount == vibrationTreshold)
            {
                if (gameObject.tag == "Player1")
                {
                    _playerManagerScript.Vibration(_playerManagerScript._player, 0, 1.0f, tooMuchPowerTimerMax);
                }
            }
        }
    }