void Update()
    {
        move = Input.GetAxisRaw("Horizontal");

        if (Input.GetButtonDown("Jump"))
        {
            jump = true;
        }
        else
        {
            jump = false;
        }

        crawling = Input.GetKey(KeyCode.C);

        if (Input.GetKey(KeyCode.E))
        {
            playerMovement.StartCasting();
        }

        if (!IsPointerOverUI())
        {
            if (Input.GetButtonDown("Fire1"))
            {
                strikeClickTime = DateTime.Now;
                canAtack        = true;
            }

            if (Input.GetButtonUp("Fire1"))
            {
                float holdTime = (float)(DateTime.Now - strikeClickTime).TotalSeconds;
                if (canAtack)
                {
                    playerMovement.StartSwordAtack(holdTime);
                }
                canAtack = false;
            }

            if (Input.GetButtonUp("Fire3"))
            {
                playerMovement.Blink();
            }
        }

        if ((DateTime.Now - strikeClickTime).TotalSeconds >= playerMovement.ChargeTime * 2 && canAtack)
        {
            playerMovement.StartSwordAtack(playerMovement.ChargeTime);
            canAtack = false;
        }



        playerMovement.Move(move, jump, crawling);
    }
Beispiel #2
0
 private void FixedUpdate()
 {
     _playerMovement.Move(_move, _jump, _crawling);
     _jump = false;
 }