Exemplo 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 < 4)
        {
            if (direction > 0)
            {
                EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
                eh.AdddjustcurHealth(-30);
            }
        }
    }