Skip to content

Add support for multiple colliders on the same object for VoiceOverrideTriggerZone - #27

Open
techanon wants to merge 1 commit into
Guribo:masterfrom
techanon:enhancements
Open

techanon wants to merge 1 commit into
Guribo:masterfrom
techanon:enhancements

Conversation

@techanon

Copy link
Copy Markdown

No description provided.

Comment on lines +26 to +27
private int[] playerIds = new int[82];
private int[] colliderStacks = new int[82];

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use DataList or better a DataDictionary instead of arrays, key is playerid, value is stacksize.

_allTrigger = gameObject.GetComponents<Collider>();
DisableAllTrigger();
SendCustomEventDelayedFrames(nameof(EnableAllTriggerDelayed), 1, EventTiming.LateUpdate);
SendCustomEventDelayedSeconds(nameof(TriggerStayCheck), 1f, EventTiming.LateUpdate);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the scene setup this can have a major impact on performance when many zones update all at once.

Additionally, is guaranteed that this custom loop keeps running should this script be disabled?

}
}

private void expand(ref int[] stale, int newSize)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed if DataDictionary is used

// This ensures continuity for edge cases like players entering stations while in the trigger zone.
public void TriggerStayCheck()
{
SendCustomEventDelayedSeconds(nameof(TriggerStayCheck), 5f);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe randomizing the delay can prevent a sudden lag spike accross all zones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants