-
-
Save alexson/0d37abb97e0a4c89b733a89bee41a239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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