private void AddTracer(GameObject gameObject, StringList logs) { var parent = gameObject.transform.parent; if (parent == null) { logs.Add($"E: Parent of {gameObject.name} is null!"); return; } var grandParent = parent.parent; if (grandParent == null) { logs.Add($"E: Grandparent of {gameObject.name} and parent of {grandParent.gameObject.name} is null!"); return; } var playerObjectName = grandParent.gameObject.name; var username = GetName(grandParent, logs); if (playerObjectName.StartsWith("VRCPlayer[Local]")) { logs.Add($"Found local user: {username}"); PlayerMarker.Player = gameObject; return; } var color = (Color)ConfigWatcher.TracerConfig.blockedColor; if (gameObject.name != "avatar_invisible(Clone)") { logs.Add($"Found remote user: {username}"); color = GetColor(grandParent, logs); } else { logs.Add($"Found blocked user: {username}"); } var child = new GameObject($"Tracer #{TracerToUser.Count}"); child.transform.parent = gameObject.transform; child.transform.localPosition = Vector3.zero; var tracerToUser = new TracerToUser(child) { Color = color }; }
public override void OnUpdate() { var updated = ConfigWatcher.UpdateIfDirty() || _forceUpdate; var shouldChangeMode = ShouldChangeMode(); _forceUpdate = false; if (updated || shouldChangeMode) { TracerToUser.DestroyAllTracers(); } if (shouldChangeMode) { ChangeMode(); } if ((updated || shouldChangeMode) && _tracerMode != TracerMode.Off) { CreateTracers(); } }
public override void OnLateUpdate() { switch (_tracerMode) { case TracerMode.Follow: if (!PlayerMarker.UpdatePosition(true)) { return; } break; case TracerMode.Stick: if (!PlayerMarker.UpdatePosition(false)) { return; } break; default: return; } TracerToUser.LateUpdate(); }