rayShootPos = playerObject.transform.position - transform.position;
hitShoot = Physics2D.Raycast(transform.position, rayShootPos, shootDistance);
if (hitShoot.collider != null)
{
Debug.Log(hitShoot.collider.gameObject.name);
if (hitShoot.collider.gameObject.name == "Player")
{
Debug.Log("Player Dead!");
needToShoot = true;
}
else
{
needToShoot = false;
}
}
else
{
needToShoot = false;
}