How would one go on making a "directional hitbox"

What I mean is in games like Yakuza and Bully, there are 2 types of hit reactions. One for a front hit and one from the back. Is it possible to replicate something like that in Unity?

Use code to determine from which direction it came from.

Unity - Scripting API: Transform.InverseTransformDirection (unity3d.com)

Just have the thing hitting the player have a direction then compare it to the direction of the player.

Adding and Subtracting Vectors - GameDev Prep Course - YouTube

the subtraction part may be useful. Basically, enemy location - player location = direction from enemy to player

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AttackUniversal : MonoBehaviour
{
public LayerMask collisionLayer;
public float radius = 1f;
public float damage = 2f;

public bool is_Player, is_Enemy;

public GameObject hit_FX;

void Update()
{
DetectCollision();
}

void DetectCollision() {

Collider[ ] hit = Physics.OverlapSphere(transform.position, radius, collisionLayer);

if(hit.Length > 0) {

print("We Hit the " + hit[0].gameObject.name);

gameObject.SetActive(false);
}
}
}

How would I apply the direction in this script? Where would I put it?

I would use a dot product between the receiver and the input hit direction, using the local axis of the receiver.

I looked at what dot is, and it definitely looks like what I need. Thanks!