private void OnTriggerEnter(Collider other) { if (LayerMaskUtilities.MaskContainsLayer(enemiesMask, other.gameObject.layer)) { int enemies = Physics.OverlapSphereNonAlloc(transform.position, freezeRange, colsCache, enemiesMask); for (int i = 0; i < enemies; i++) { colsCache[i].GetComponent <IFreezeable>().GetFrozen(); } objectPooler.ReturnToThePool(transform); } }
void setEnemyLayer() { enemyLayer = LayerMaskUtilities.GetCharactersLayerExceptMyLayer(gameObject.layer); }
private void Start() { enemyLayer = LayerMaskUtilities.GetCharactersLayerExceptMyLayer(gameObject.layer); }
public SensedObjectModel FindClosestObject() { SensedObjectModel closestObject = null; var hitColliders = Physics.OverlapSphere(transform.position, BlobModel.AdjustedRadius, LayerMaskUtilities.LayerMaskIgnore()); foreach (var collider in hitColliders) { if (collider.name == name || collider.tag == "Floor") { continue; } var sensedObject = SensedObjectModel.Build(transform.position, collider); if (closestObject == null) { closestObject = sensedObject; continue; } if (sensedObject.Distance < closestObject.Distance) { closestObject = sensedObject; } } return(closestObject); }
private void Start() { objectPooler = ObjectPooler.GetInstance(); enemiesMask = LayerMaskUtilities.GetCharactersLayerExceptMyLayer(LayerMask.NameToLayer("Spider")); }