public void OnEnable() { var railcam2DCore = (Railcam2DCore)target; if (target == null) { return; } _rails = Utilities.GetRailsFromChildren(railcam2DCore.gameObject, true); }
public void OnEnable() { var railManager = (RailManager)target; if (target == null) { return; } _rails = Utilities.GetRailsFromChildren(railManager.gameObject, true); }
public void OnEnable() { var triggerManager = (TriggerManager)target; if (target == null) { return; } _triggers = Utilities.GetTriggersFromChildren(triggerManager.gameObject, true); _rails = Utilities.GetRailsFromChildren(triggerManager.gameObject, true); }
public override void OnInspectorGUI() { var railcam2DCore = (Railcam2DCore)target; if (target == null) { return; } _rails = Utilities.GetRailsFromChildren(railcam2DCore.gameObject, true); _currentStartOnRailDropDownIndex = GetStartOnRailDropDownIndex(railcam2DCore); DrawMainEditor(railcam2DCore); }
public void OnSceneGUI() { var railManager = (RailManager)target; if (target == null) { return; } _rails = Utilities.GetRailsFromChildren(railManager.gameObject, true); var handleSize = HandleUtility.GetHandleSize(Vector3.zero) * 0.2f; var snapValue = EditorPrefs.GetFloat(EditorPreferences.SnapKey, EditorPreferences.SnapValue); var snapSize = new Vector3(snapValue, snapValue, snapValue); // Allows node removal var nodeRemovalActive = false; if (Event.current.shift) { nodeRemovalActive = true; } // Allows new nodes to be snapped to grid when added var snapActive = false; if (Event.current.control) { snapActive = true; } // Draw rails for (int i = 0; i < _rails.Count; i++) { var rail = _rails[i]; if (rail.Nodes.Count < 2) { continue; } GUIUtilities.DrawRailOnScene(rail, handleSize, snapSize, snapActive, nodeRemovalActive, true); } // Sync editor values with scene if rail is displayed in editor if (_currentRailIndex != -1) { Repaint(); } }
public void OnSceneGUI() { var railcam2DCore = (Railcam2DCore)target; if (target == null) { return; } var handleSize = HandleUtility.GetHandleSize(Vector3.zero) * 0.2f; var snapValue = EditorPrefs.GetFloat(EditorPreferences.SnapKey, EditorPreferences.SnapValue); var snapSize = new Vector3(snapValue, snapValue, snapValue); // If no Rail Manager component on game object, draw uneditable rails if (railcam2DCore.GetComponent <RailManager>() == null) { _rails = Utilities.GetRailsFromChildren(railcam2DCore.gameObject, true); for (int i = 0; i < _rails.Count; i++) { var rail = _rails[i]; if (rail.Nodes.Count < 2) { continue; } GUIUtilities.DrawRailOnScene(rail, handleSize, snapSize); } } // If no Trigger Manager component on game object, draw uneditable triggers if (railcam2DCore.GetComponent <TriggerManager>() == null) { _triggers = Utilities.GetTriggersFromChildren(railcam2DCore.gameObject, true); for (int i = 0; i < _triggers.Count; i++) { var currentTrigger = _triggers[i]; GUIUtilities.DrawTriggerOnScene(currentTrigger, handleSize, snapSize); } } }
public override void OnInspectorGUI() { var triggerManager = (TriggerManager)target; if (target == null) { return; } _triggers = Utilities.GetTriggersFromChildren(triggerManager.gameObject, true); _rails = Utilities.GetRailsFromChildren(triggerManager.gameObject, true); // Prevents index out of range exceptions if the adding of a trigger is undone // while its values are displayed in the editor if (_currentTriggerIndex >= _triggers.Count) { _currentTriggerIndex = -1; } // Occurs when values have been changed that are represented visually on the Scene View if (_repaintScene) { SceneView.RepaintAll(); _repaintScene = false; } // Editor Layout EditorGUILayout.Space(); AddNewTriggerButton(triggerManager); ListTriggerButtons(); EditorGUILayout.Space(); EditorGUILayout.Space(); InitializeMainEditor(triggerManager); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); }
/// <summary>Sets a list of all Rail components attached to this object's children with a node count higher than 1.</summary> private void SetRails() { _rails = Utilities.GetRailsFromChildren(gameObject, false); }