Skip to content

Instantly share code, notes, and snippets.

@alexson
Created January 13, 2022 09:45
Show Gist options
  • Save alexson/0d37abb97e0a4c89b733a89bee41a239 to your computer and use it in GitHub Desktop.
Save alexson/0d37abb97e0a4c89b733a89bee41a239 to your computer and use it in GitHub Desktop.
#region Detection
private void OnDrawGizmos()
{
Gizmos.DrawWireSphere(bombRoot.transform.position, detectionRadius);
}
private void Update()
{
if (!exploded)
CheckOverlapping();
}
public void CheckOverlapping()
{
Collider[] colliders = Physics.OverlapSphere(bombRoot.transform.position, detectionRadius);
foreach (Collider nearbyObject in colliders)
{
if (nearbyObject.CompareTag("Player"))
{
//Debug.Log("nearbyObject.tag: " + nearbyObject.name);
PlayerBehaviour pB = nearbyObject.GetComponentInParent<PlayerBehaviour>();
pB.bombNearby = true;
}
}
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment