public override void TakeDamage(int damage, Vector3 knockBackDirection)
    {
        base.TakeDamage(damage, knockBackDirection);
        //Instantiate(deathEffect, transform.position, transform.rotation);
        damageBlinker.Blink();
        Vector3 moveDir = Vector3.Project(knockBackDirection, movement.invertDir * keeper.outHorTangent) + Vector3.up * .2f;

        moveDir     = moveDir.normalized;
        rb.velocity = moveDir * 8f;
        movement.knockBack();
    }
Exemple #2
0
    public void TakeDamage(int damage, Vector3 knockBackDirection)
    {
        healthSystem.TakeDamage(damage);
        damageBlinker.Blink();
        if (showDebug)
        {
            Debug.Log("Current Health: " + healthSystem.currentHealth);
        }
        anim.SetTrigger("Hurt");
        Vector3 moveDir = Vector3.Project(knockBackDirection, movement.invertDir * keeper.outHorTangent) + Vector3.up * .2f;

        moveDir = moveDir.normalized;
        //rb.AddForce(moveDir * 3f, ForceMode.VelocityChange);
        rb.velocity = moveDir * 4f;
        movement.knockBack();
        if (isAlive)
        {
            hurtSound.Play();
        }
    }