Example #1
0
        public void OnSceneGUI()
        {
            var currentTrigger = (Trigger)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);

            // Draw editable trigger
            if (currentTrigger.gameObject.transform.parent != null &&
                currentTrigger.gameObject.GetComponentInParent <TriggerManager>() != null)
            {
                GUIUtilities.DrawTriggerOnScene(currentTrigger, handleSize, snapSize, true);
            }
            // Draw uneditable trigger
            else
            {
                GUIUtilities.DrawTriggerOnScene(currentTrigger, handleSize, snapSize);
            }
        }
Example #2
0
        public void OnSceneGUI()
        {
            var triggerManager = (TriggerManager)target;

            if (target == null)
            {
                return;
            }

            _triggers = Utilities.GetTriggersFromChildren(triggerManager.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);

            // Draw Triggers
            for (int i = 0; i < _triggers.Count; i++)
            {
                var trigger = _triggers[i];
                GUIUtilities.DrawTriggerOnScene(trigger, handleSize, snapSize, true);
            }

            // Sync editor values with scene if trigger is displayed
            if (_currentTriggerIndex != -1)
            {
                Repaint();
            }
        }
Example #3
0
        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);
                }
            }
        }