// Always called a specific time
    void Update()
    {
        SetAttackType();

        if (isGrounded && Input.GetAxis("Jump") > 0)
        {
            isGrounded = false;
            anim.SetBool("isGrounded", isGrounded);
            rb.AddForce(new Vector2(0, jumpHeight));
            playerSounds.StartCoroutine("JumpAudio");
        }

        //player shoot
        if (Input.GetAxisRaw("Fire1") == 1)
        {
            isAttack = true;
            if (arcaneActive)
            {
                StartCoroutine("ArcaneAttack");
            }
            else if (iceActive)
            {
                StartCoroutine("IceAttack");
            }
            else if (fireActive)
            {
                StartCoroutine("FireAttack");
            }
        }
        //Debug.Log(transform.position.x);
    }
Пример #2
0
    public void takeDamage(float damage)
    {
        if (!isInvulnerable)
        {
            if (damage <= 0)
            {
                return;
            }

            currentHealth -= damage;
            Debug.Log(currentHealth);


            if (currentHealth <= 0)
            {
                playerSounds.StartCoroutine("DeathAudio");
                PM.DisablePlayer();
                killPlayer();
            }
        }
    }