Beispiel #1
0
    void Update()
    {
        _horizontalInput = Input.GetAxis("Horizontal");
        _verticalInput   = Input.GetAxis("Vertical");
        Vector2 input = new Vector2(_horizontalInput, _verticalInput);

        _playerMovements.Move(input);

        // Gear Up
        if (Input.GetButtonDown("GearUp"))
        {
            _playerMovements.UpGear(_speedTransitionTime);
        }
        // Gear Down
        if (Input.GetButtonDown("GearDown"))
        {
            _playerMovements.DownGear(_speedTransitionTime);
        }

        if (Input.GetButtonDown("Pause"))
        {
            _pauseState = !_pauseState;
            Pause(_pauseState);
        }


        //Dash
        if (Input.GetButton("Dash"))
        {
            float curTime = Time.time;
            AudioManager.PlaySFX("Swoosh");
            if (curTime > _timeOfLastDash + _dashCD && _energy.energy >= _dashCost + 5)
            {
                _energy.add(-_dashCost);
                _playerMovements.Dash();
                _timeOfLastDash = curTime;
            }
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            _dialogue.SetActive(false);
        }
    }
    void Update()
    {
        _horizontalInput = Input.GetAxis("Horizontal");
        _verticalInput   = Input.GetAxis("Vertical");
        Vector2 input = new Vector2(_horizontalInput, _verticalInput);

        _playerMovements.Move(input);

        // Gear Up
        if (Input.GetButtonDown("GearUp"))
        {
            _playerMovements.UpGear(_speedTransitionTime);
        }
        // Gear Down
        if (Input.GetButtonDown("GearDown"))
        {
            _playerMovements.DownGear(_speedTransitionTime);
        }

        if (Input.GetButtonDown("Pause"))
        {
            _pauseState = !_pauseState;
            Pause(_pauseState);
        }


        //Dash
        if (Input.GetButton("Dash"))
        {
            float curTime = Time.time;
            if (curTime > _timeOfLastDash + _dashCD)
            {
                _playerMovements.Dash();
                _timeOfLastDash = curTime;
            }
        }
    }