Пример #1
0
    private void Update()
    {
        isOnGround = movement.IsOnGround();

        if (!DialogManager.instance.isInDialogue)
        {
            horizontalMove = Input.GetAxisRaw("Horizontal");

            if (jumpTimeStamp <= Time.time && Input.GetButton("Jump") && isOnGround)
            {
                movement.Jump();
                jumpTimeStamp = Time.time + movement.jumpCooldown;
            }

            if (punchTimeStamp <= Time.time && Input.GetButton("Fire1"))
            {
                combat.Punch();
                anim.PlayAttack();
                punchTimeStamp = Time.time + combat.punchCooldown;
            }
        }
        else
        {
            horizontalMove = 0;
        }



        // DELETE THIS
        //if (Input.GetKey(KeyCode.Q))
        //    combat.Shoot();


        anim.PlayJump(!isOnGround);
        AnimateMove();
        if (transform.position.y < -10 && stats.isAlive)
        {
            StartCoroutine(combat.Kill());
        }
    }