Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Collider-Based visibility scheme option #1231

Merged
merged 11 commits into from
Aug 21, 2024
17 changes: 13 additions & 4 deletions unity/Assets/Scripts/AgentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ public void Initialize(ServerAction action) {
action.alwaysReturnVisibleRange;
}

//deprecation check for visibilityScheme
if (action.visibilityScheme != VisibilityScheme.Distance.ToString()) {
throw new ArgumentException(
$"Invalid visibilityScheme {action.visibilityScheme}. Must be 'Distance'."
);
}

//if multi agent requested, add duplicates of primary agent now
addAgents(action);
this.agents[0].m_Camera.depth = 9999;
Expand Down Expand Up @@ -2628,7 +2635,7 @@ public class ServerAction {
// default time for objects to wait before returning actionFinished() if an action put them in motion
public float TimeToWaitForObjectsToComeToRest = 10.0f;
public float scale;
public string visibilityScheme = VisibilityScheme.Collider.ToString();
public string visibilityScheme = VisibilityScheme.Distance.ToString();
public bool fastActionEmit = true;

// this allows us to chain the dispatch between two separate
Expand Down Expand Up @@ -2678,7 +2685,7 @@ public SimObjType ReceptableSimObjType() {
}

public static VisibilityScheme GetVisibilitySchemeFromString(string visibilityScheme) {
VisibilityScheme result = VisibilityScheme.Collider;
VisibilityScheme result = VisibilityScheme.Distance;
try {
result = (VisibilityScheme)Enum.Parse(typeof(VisibilityScheme), visibilityScheme, true);
}
Expand All @@ -2687,7 +2694,9 @@ public static VisibilityScheme GetVisibilitySchemeFromString(string visibilitySc
catch (ArgumentException ex) {
#pragma warning restore 0168
Debug.LogError(
"Error parsing visibilityScheme: '" + visibilityScheme + "' defaulting to Collider"
"Error parsing visibilityScheme: '"
+ visibilityScheme
+ "' defaulting to Distance Based"
);
}

Expand Down Expand Up @@ -2788,7 +2797,7 @@ public enum ServerActionErrorCode {
}

public enum VisibilityScheme {
Collider,
Collider, //deprecated, scheme is now Distance based only
Distance
}

Expand Down
Loading
Loading