Fixed weapon debug ray
This commit is contained in:
parent
bee2db1354
commit
87e455827c
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue