protected override void SetActive(ActiveSetting activeSetting) { var vehicle = activeSetting.Vehicle; var active = activeSetting.Active; vehicle.SetActive(active); if (active) { if (_isPredictMode) { NotifyVehicleActive(vehicle); } else { var selfEntity = PlayerContext.flagSelfEntity; if (selfEntity.IsOnVehicle() && vehicle == VehicleContext.GetEntityWithEntityKey(selfEntity.controlledVehicle.EntityKey)) { NotifyVehicleActive(vehicle); } } vehicle.SetLodLevel(activeSetting.LowLod); } }
protected virtual void SetActive(ActiveSetting activeSetting) { var vehicle = activeSetting.Vehicle; var active = activeSetting.Active; vehicle.SetActive(active); if (active) { NotifyVehicleActive(vehicle); } }
//Window void OnGUI() { gameObject = (GameObject)EditorGUILayout.ObjectField(gameObject, typeof(GameObject), true); gameObjectIsNull = (gameObject == null); if (gameObjectIsNull) { GUILayout.Label("Requires a game object to search", EditorStyles.boldLabel); } addToSelection = EditorGUILayout.Toggle("Add To Current Selection", addToSelection); GUILayout.Label("Care about", EditorStyles.boldLabel); if (gameObjectIsNull) { //comment for debugging //GUI.enabled = false; } ToggleLeft("Name", ref careAboutName); if (careAboutName) { nameSetting = (NameSetting)EditorGUILayout.EnumPopup(nameSetting); if (nameSetting == NameSetting.Contains) { nameContains = EditorGUILayout.TextField(nameContains); } } ToggleLeft("Tag", ref careAboutTag); ToggleLeft("Layer", ref careAboutLayer); ToggleLeft("Position", ref careAboutPosition); if (careAboutPosition) { positionGlobalSetting = (GlobalSetting)EditorGUILayout.EnumPopup(positionGlobalSetting); positionSetting = (Vector3Setting)EditorGUILayout.EnumPopup(positionSetting); if (positionSetting == Vector3Setting.Within) { Vector3Field("+ or - of GameObject on each axis", ref positionWithin); } else if (positionSetting == Vector3Setting.Between) { Vector3Field("Starting Value", ref positionBetween[0]); Vector3Field("Ending Value", ref positionBetween[1]); } } ToggleLeft("Rotation", ref careAboutRotation); if (careAboutRotation) { rotationSetting = (Vector3Setting)EditorGUILayout.EnumPopup(rotationSetting); if (rotationSetting == Vector3Setting.Within) { Vector3Field("+ or - of GameObject on each axis", ref rotationWithin); } else if (rotationSetting == Vector3Setting.Between) { Vector3Field("Starting Value", ref rotationBetween[0]); Vector3Field("Ending Value", ref rotationBetween[1]); } } ToggleLeft("Scale", ref careAboutScale); if (careAboutScale) { scaleGlobalSetting = (GlobalSetting)EditorGUILayout.EnumPopup(scaleGlobalSetting); scaleSetting = (Vector3Setting)EditorGUILayout.EnumPopup(scaleSetting); if (scaleSetting == Vector3Setting.Within) { Vector3Field("+ or - of GameObject on each axis", ref scaleWithin); } else if (scaleSetting == Vector3Setting.Between) { Vector3Field("Starting Value", ref scaleBetween[0]); Vector3Field("Ending Value", ref scaleBetween[1]); } } ToggleLeft("Active", ref careAboutActive); if (careAboutActive) { activeSetting = (ActiveSetting)EditorGUILayout.EnumPopup(activeSetting); activeBoolSetting = (BoolSetting)EditorGUILayout.EnumPopup(activeBoolSetting); } ToggleLeft("Components", ref careAboutComponents); if (careAboutComponents) { componentSetting = (ComponentSetting)EditorGUILayout.EnumPopup(componentSetting); ToggleLeft("Allow inherited components", ref allowInheritedComponents); ToggleLeft("Care about values", ref careAboutComponentValues); } if (GUILayout.Button("Search")) { Select(Filter(GetAllGameObjects())); //UnityEditor.Selection.gameObjects } }
protected void SetActiveDelay(ActiveSetting activeSetting) { _activeWaitingQueue.Enqueue(activeSetting); }