Ruined Town Sectors fix, Dark Wood - Sectors
This commit is contained in:
@@ -7,6 +7,9 @@ namespace Beyond
|
||||
[RequireComponent(typeof(BoxCollider))]
|
||||
public class BoxVolume : StreamingAsset
|
||||
{
|
||||
// DODANE: Licznik koliderów wewn¹trz woluminu
|
||||
private int enteredCollidersCount = 0;
|
||||
|
||||
protected override void Draw()
|
||||
{
|
||||
if (collider == null)
|
||||
@@ -49,9 +52,13 @@ namespace Beyond
|
||||
|
||||
protected override void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (collisionLayer == 1 << other.gameObject.layer)
|
||||
// Sprawdzenie warunków kolizji
|
||||
if (collisionLayer == 1 << other.gameObject.layer && tagMask.IsInTagMask(other.tag))
|
||||
{
|
||||
if (tagMask.IsInTagMask(other.tag))
|
||||
enteredCollidersCount++;
|
||||
|
||||
// Aktywacja nastêpuje tylko przy pierwszym wejœciu (licznik = 1)
|
||||
if (enteredCollidersCount == 1)
|
||||
{
|
||||
CancelDeactivationCoroutine();
|
||||
SetActive(true);
|
||||
@@ -61,13 +68,20 @@ namespace Beyond
|
||||
|
||||
protected override void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (collisionLayer == 1 << other.gameObject.layer)
|
||||
// Sprawdzenie warunków kolizji
|
||||
if (collisionLayer == 1 << other.gameObject.layer && tagMask.IsInTagMask(other.tag))
|
||||
{
|
||||
if (tagMask.IsInTagMask(other.tag))
|
||||
enteredCollidersCount--;
|
||||
|
||||
// Zabezpieczenie na wypadek b³êdu fizyki
|
||||
if (enteredCollidersCount < 0) enteredCollidersCount = 0;
|
||||
|
||||
// Dezaktywacja nastêpuje tylko, gdy ostatni obiekt opuœci wolumin (licznik = 0)
|
||||
if (enteredCollidersCount == 0)
|
||||
{
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user