Fixed weapon debug ray

This commit is contained in:
Stedd 2024-10-05 19:38:26 +02:00
parent bee2db1354
commit 87e455827c
1 changed files with 2 additions and 1 deletions

View File

@ -27,12 +27,13 @@ namespace GameDev.CoreSystems
var position = BarrelEndPoint.position;
var forward = BarrelEndPoint.forward;
var ray = new Ray(position, forward);
Debug.DrawRay(position, forward * 10, Color.green);
if (Physics.Raycast(ray, out RaycastHit hitInfo))
{
if (hitInfo.transform.TryGetComponent(out Targetable target))
{
Debug.DrawRay(position, forward * Vector3.Distance(position, target.GetCenterPosition()),
Color.red, 0.1f);
target.Damageable.ModifyHealth(Mathf.RoundToInt(-Damage));
}
}