Ejemplo n.º 1
0
    private void Attack()
    {
        float distance = Vector3.Distance(target.transform.position, transform.position);

        Vector3 dir = (target.transform.position - transform.position);

        float direction = Vector3.Dot(dir, transform.forward);

        if (distance < 3)
        {
            if (direction > 0)
            {
                PlayerHealth eh = (PlayerHealth)target.GetComponent("PlayerHealth");
                eh.AdddjustcurHealth(-10);
            }
        }
    }