/// <summary> /// /// </summary> void Fire() { Ray r = new Ray(transform.position, transform.forward); if (Physics.Raycast(r, out RayHit, DistanceCheck, DetectLayers, QueryTriggerInteraction.Ignore)) { OnHit(); } else { if (gunPickup != null) { gunPickup.FocusThis(false); gunPickup = null; } } }
/// <summary> /// /// </summary> void OnHit() { bl_GunPickUp gp = RayHit.transform.GetComponent <bl_GunPickUp>(); if (gp != null) { if (gunPickup != null && gunPickup != gp) { gunPickup.FocusThis(false); } gunPickup = gp; gunPickup.FocusThis(true); } else { if (gunPickup != null) { gunPickup.FocusThis(false); gunPickup = null; } } }