Пример #1
0
    private void Update()
    {
        // Checking for Attack Input
        if (Input.GetMouseButtonDown(0) && !attacking)
        {
            MeleeAttack();
        }

        if (Input.GetMouseButtonDown(1))
        {
            if (!startingThrow)
            {
                //TryRangeAttack();
                anim.SetBool("ThrowStart", true);
                startingThrow  = true;
                pState.canMove = false;
            }
        }

        if (Input.GetKeyDown(KeyCode.Space) && !anim.GetBool("Ultimate"))
        {
            if (ultimateTimer <= 0f)
            {
                anim.SetBool("Ultimate", true);
                pState.canMove = false;
            }
        }

        // Updating the GUI
        UpdatePlayerGUIElements();

        // Getting Attack Input
        if (checkingForNextAttack)
        {
            if (Input.GetMouseButtonDown(0))
            {
                Debug.Log("Next Attack Successful");
                attackSuccessful = true;
            }
        }

        // Updating the Player Sprite
        if (pState.StateClear())
        {
            UpdatePlayerSprite();
        }

        // Updating the Attacking Timer
        UpdateAttackTimers();

        // Updating the Player State
        pState.UpdateState();

        // Updating ultimate timer
        if (ultimateTimer > 0f)
        {
            ultimateTimer -= Time.deltaTime;
        }

        // Updating attacking
        if (swinging)
        {
            TryMeleeAttack();
        }
    }