예제 #1
0
    void Update()
    {
        _move = Input.GetAxisRaw("Horizontal");
        if (Input.GetButtonUp("Jump"))
        {
            _jump = true;
        }
        _crawling = Input.GetKey(KeyCode.C);

        if (Input.GetKey(KeyCode.E))
        {
            _playerMovement.StartCasting();
        }
        if (Input.GetButtonDown("Fire1"))
        {
            _strikeClickTime = DateTime.Now;
            _canAttack       = true;
        }
        if (Input.GetButtonUp("Fire1"))
        {
            float holdTime = (float)(DateTime.Now - _strikeClickTime).TotalSeconds;
            if (_canAttack)
            {
                _playerMovement.StartStrike(holdTime);
            }
            _canAttack = false;
        }
        if ((DateTime.Now - _strikeClickTime).TotalSeconds >= _playerMovement.ChargeTime * 2 && _canAttack)
        {
            _playerMovement.StartStrike(_playerMovement.ChargeTime);
            _canAttack = false;
        }
    }
예제 #2
0
    // Update is called once per frame (буде відпрацьовувати з кожним кадром системи) частота виклику залежить від швидкодії пристрою (30-60 раз за сек)
    void Update()
    {
        _move = Input.GetAxisRaw("Horizontal");// return -1 if(click (A || <-)) and return 1 if(click(D || ->)
        if (Input.GetButtonUp("Jump"))
        {
            _jump = true;
        }

        _crawling = Input.GetKey(KeyCode.C);//return true if press and false if !press

        if (Input.GetKey(KeyCode.E))
        {
            _playerMovement.StartShooting();
        }

        if (Input.GetButtonUp("Fire1"))
        {
            _playerMovement.StartStrike();
        }
    }