コード例 #1
0
        private void OnEnable()
        {
            m_Comp = (GridSensorComponent2D)target;
            Undo.undoRedoPerformed += OnUndoRedo;

            m_BoundsHandle = new BoxBoundsHandle();
            m_BoundsHandle.SetColor(Color.white);
        }
コード例 #2
0
        protected virtual void OnEnable()
        {
            if (BoxBoundsHandle == null)
            {
                BoxBoundsHandle = new BoxBoundsHandle();
            }

            CollectSerializedProperties();
        }
コード例 #3
0
        private void OnEnable()
        {
#if UNITY_2017_1_OR_NEWER
            placementBoundsHandle = new BoxBoundsHandle();
#else
            placementBoundsHandle = new BoxBoundsHandle(0);
#endif
            placementBoundsHandle.SetColor(Color.magenta);
        }
コード例 #4
0
 private void ResetBoxHandleIfNeeded()
 {
     if (BoxHandle == null)
     {
         BoxHandle        = new BoxBoundsHandle();
         BoxHandle.size   = size;
         BoxHandle.center = position;
     }
 }
コード例 #5
0
        public static BoxBoundsHandle InitBoxHandle()
        {
            BoxBoundsHandle handle = new BoxBoundsHandle {
                axes           = PrimitiveBoundsHandle.Axes.X | PrimitiveBoundsHandle.Axes.Y,
                handleColor    = Color.white,
                wireframeColor = Color.white
            };

            return(handle);
        }
コード例 #6
0
ファイル: AVolumeBakerInspector.cs プロジェクト: texone/SDFr
        protected virtual void OnDisable()
        {
            BoxBoundsHandle = null;
            T av = target as T;

            if (av == null)
            {
                return;
            }
            av.EditorDestroyAVolume();
        }
コード例 #7
0
 public void OnSelectItem(ReorderableList RList)
 {
     curbox = RList.index;
     boxb   = new BoxBoundsHandle()
     {
         wireframeColor = Color.white,
         size           = trig.Triggers[curbox].size,
         center         = trig.Triggers[curbox].offset + (Vector2)trig.transform.position,
         axes           = BoxBoundsHandle.Axes.X | BoxBoundsHandle.Axes.Y
     };
     SceneView.RepaintAll();
 }
    private void OnEnable()
    {
        propertyManager = new SerializedPropertyManager(serializedObject);
        boxBoundsHandle = new BoxBoundsHandle
        {
            axes = PrimitiveBoundsHandle.Axes.X | PrimitiveBoundsHandle.Axes.Y
        };

        EditMode.onEditModeStartDelegate += (editor, mode) => canEditBounds = true;
        EditMode.onEditModeEndDelegate   += editor => canEditBounds = false;

        sokobanPuzzleController = (SokobanPuzzleController)target;
    }
コード例 #9
0
 private void OnEnable()
 {
     if (!MultiSelectionHandlesDictionary.TryGetValue(Target, out _multiSelectionHandle))
     {
         var bounds = Target.Bounds;
         _multiSelectionHandle = new BoxBoundsHandle
         {
             center = bounds.center,
             axes   = PrimitiveBoundsHandle.Axes.X | PrimitiveBoundsHandle.Axes.Y,
             size   = bounds.size + Vector3.one,
             midpointHandleSizeFunction = v => HandleUtility.GetHandleSize(v) * GizmoRadius / 2
         };
         MultiSelectionHandlesDictionary.Add(Target, _multiSelectionHandle);
     }
 }
コード例 #10
0
    private void OnEnable()
    {
        bh = new BoxBoundsHandle(GUIUtility.GetControlID(FocusType.Passive))
        {
            wireframeColor = Color.black,
            handleColor    = Color.black
        };

        sp = new SphereBoundsHandle(GUIUtility.GetControlID(FocusType.Passive))
        {
            wireframeColor = Handles.yAxisColor,
            handleColor    = Handles.yAxisColor,
            axes           = PrimitiveBoundsHandle.Axes.X | PrimitiveBoundsHandle.Axes.Z
        };

        bs           = (BoundScript)target;
        Tools.hidden = true;
    }
コード例 #11
0
        private void OnEnable()
        {
            allowRotation = serializedObject.FindProperty("AllowRotation");
            repeatMode    = serializedObject.FindProperty("RepeatMode");
            overrideAutomaticTileBounds = serializedObject.FindProperty("OverrideAutomaticTileBounds");
            tileBoundsOverride          = serializedObject.FindProperty("TileBoundsOverride");
            entrance = serializedObject.FindProperty("Entrance");
            exit     = serializedObject.FindProperty("Exit");


#if UNITY_2017_1_OR_NEWER
            overrideBoundsHandle = new BoxBoundsHandle();
#else
            overrideBoundsHandle = new BoxBoundsHandle(0);
#endif

            overrideBoundsHandle.SetColor(Color.red);
        }
コード例 #12
0
        private void OnEnable()
        {
            spawner = target as Spawner;

            sizeProperty   = serializedObject.FindProperty("size");
            centerProperty = serializedObject.FindProperty("center");

            floorYPositionProperty = serializedObject.FindProperty("floorYPosition");
            spawnRateProperty      = serializedObject.FindProperty("spawnRate");

            shouldSpawnBossProperty = serializedObject.FindProperty("shouldSpawnBoss");
            bossSpawnChanceProperty = serializedObject.FindProperty("bossSpawnChance");
            bossPrefabProperty      = serializedObject.FindProperty("bossPrefab");
            enemyPrefabProperty     = serializedObject.FindProperty("enemyPrefab");

            shouldSpawnBoss.value = shouldSpawnBossProperty.boolValue;
            shouldSpawnBoss.valueChanged.AddListener(Repaint);
            handle = new BoxBoundsHandle();
        }
コード例 #13
0
        private void OnEnable()
        {
            spawner = target as Spawner;

            pSize   = serializedObject.FindProperty("size");
            pCentre = serializedObject.FindProperty("centre");

            pFloorYPosition = serializedObject.FindProperty("floorYPosition");
            pSpawnRate      = serializedObject.FindProperty("spawnRate");

            pShouldSpawnBoss = serializedObject.FindProperty("shouldSpawnBoss");
            pBossSpawnChance = serializedObject.FindProperty("bossSpawnChance");
            pBossPrefab      = serializedObject.FindProperty("bossPrefab");
            pEnemyPrefab     = serializedObject.FindProperty("enemyPrefab");

            shouldSpawnBoss.value = pShouldSpawnBoss.boolValue;
            shouldSpawnBoss.valueChanged.AddListener(Repaint);

            handle = new BoxBoundsHandle();
        }
コード例 #14
0
            private void DoBoxHandles(LightSponge sponge)
            {
                /*---Box Handle---*/
                Handles.color = _handlesColor;
                if (_boundsHandle == null)
                {
                    _boundsHandle = new BoxBoundsHandle();
                }
                _boundsHandle.size   = sponge.BoxBounds;
                _boundsHandle.center = sponge.transform.position;
                _boundsHandle.DrawHandle();

                if (sponge.BoxBounds != _boundsHandle.size)
                {
                    Undo.RecordObject(sponge, "Updated Light Sponge Bounds");
                    sponge.BoxBounds = _boundsHandle.size;
                }

                Handles.color = Color.white;
            }
コード例 #15
0
        // This function is called when the object becomes enabled and active
        private void OnEnable() //Like Start()
        {
            spawner = target as Spawner;

            sizeProp   = serializedObject.FindProperty("size");
            centerProp = serializedObject.FindProperty("center");

            floorYPosProp = serializedObject.FindProperty("floorYPos");
            spawnRateProp = serializedObject.FindProperty("spawnRate");

            shouldBossSpawnProp = serializedObject.FindProperty("shouldBossSpawn");
            bossSpawnChanceProp = serializedObject.FindProperty("bossSpawnChance");

            bossPrefabProp  = serializedObject.FindProperty("bossPrefab");
            enemyPrefabProp = serializedObject.FindProperty("enemyPrefab");

            shouldBossSpawn.value = shouldBossSpawnProp.boolValue; //Set up anim bool
            shouldBossSpawn.valueChanged.AddListener(Repaint);     //Fade effect

            handle = new BoxBoundsHandle();
        }
コード例 #16
0
    public void Initialize()
    {
        SelectedRenderers.Clear();
        BoxHandle = new BoxBoundsHandle {
            center = position, size = size
        };
        if (position == Vector3.zero)
        {
            MoveToCameraCenter();
        }
        else
        {
            Bounds bounds = new Bounds(BoxHandle.center, BoxHandle.size);
            if (SceneView.lastActiveSceneView)
            {
                SceneView.lastActiveSceneView.Frame(bounds);
            }
        }

        IsInitialized = true;
    }
コード例 #17
0
ファイル: AVolumeBakerInspector.cs プロジェクト: texone/SDFr
        protected virtual void OnEnable()
        {
            if (BoxBoundsHandle == null)
            {
                BoxBoundsHandle = new BoxBoundsHandle();
            }

            CollectSerializedProperties();

            //create editor AVolume
            T av = target as T;

            if (av == null)
            {
                return;
            }
            if (av.HasAVolume)
            {
                return;
            }
            av.EditorCreateAVolume();
        }
コード例 #18
0
 protected virtual void OnDisable()
 {
     BoxBoundsHandle = null;
 }
コード例 #19
0
 private void OnEnable()
 {
     //rotHandle = new RotationalDriveHandle();
     dirHandle = new DirectionalDriveBoundsHandle();
     box       = new BoxBoundsHandle();
 }
コード例 #20
0
    public void BuildGUI(Rect rect, int index, bool isActive, bool isFocused)
    {
        SerializedProperty element = list.serializedProperty.GetArrayElementAtIndex(index);

        rect.y += 2f;

        Rect labelRect = rect;

        labelRect.width  = 90f;
        labelRect.height = EditorGUIUtility.singleLineHeight;

        Rect propRect = rect;

        propRect.x     += labelRect.width;
        propRect.width  = EditorGUIUtility.currentViewWidth - 65f - labelRect.width;
        propRect.height = EditorGUIUtility.singleLineHeight;

        EditorGUI.BeginChangeCheck();

        #region Name Field
        EditorGUI.LabelField(labelRect, "Name", GUIStyle.none);
        EditorGUI.PropertyField(propRect, element.FindPropertyRelative("name"), GUIContent.none);
        #endregion

        #region Layermask Field
        labelRect.y += EditorGUIUtility.singleLineHeight;
        propRect.y  += EditorGUIUtility.singleLineHeight;
        EditorGUI.LabelField(labelRect, "LayerMask", GUIStyle.none);
        EditorGUI.PropertyField(propRect, element.FindPropertyRelative("layerMask"), GUIContent.none);
        #endregion

        #region Offset Field
        labelRect.y += EditorGUIUtility.singleLineHeight;
        propRect.y  += EditorGUIUtility.singleLineHeight;
        EditorGUI.LabelField(labelRect, "Offset", GUIStyle.none);
        EditorGUI.PropertyField(propRect, element.FindPropertyRelative("offset"), GUIContent.none);
        #endregion

        #region Size Field
        labelRect.y += EditorGUIUtility.singleLineHeight;
        propRect.y  += EditorGUIUtility.singleLineHeight;
        EditorGUI.LabelField(labelRect, "Size", GUIStyle.none);
        EditorGUI.PropertyField(propRect, element.FindPropertyRelative("size"), GUIContent.none);
        #endregion

        #region Draw Gizmos Field
        labelRect.y += EditorGUIUtility.singleLineHeight;
        propRect.y  += EditorGUIUtility.singleLineHeight;
        EditorGUI.LabelField(labelRect, "Draw Gizmo", GUIStyle.none);
        EditorGUI.PropertyField(propRect, element.FindPropertyRelative("DrawGizmo"), GUIContent.none);
        #endregion

        if (EditorGUI.EndChangeCheck())
        {
            boxb = new BoxBoundsHandle()
            {
                wireframeColor = Color.white,
                size           = trig.Triggers[curbox].size,
                center         = trig.Triggers[curbox].offset + (Vector2)trig.transform.position,
                axes           = BoxBoundsHandle.Axes.X | BoxBoundsHandle.Axes.Y
            };
            boxb.DrawHandle();
        }
    }
コード例 #21
0
 void OnEnable()
 {
     bbh = new BoxBoundsHandle();
 }
コード例 #22
0
 private void OnEnable()
 {
     m_BoundsHandle = new BoxBoundsHandle();
     m_BoundsHandle.SetColor(Color.white);
 }
コード例 #23
0
        public override void OnSceneGUI()
        {
            if (!action.debug.Value)
            {
                return;
            }

            var color = Handles.color;

            Handles.color = action.debugColor.Value;

            EditorGUI.BeginChangeCheck();

            action.InitShapeCenter();

            var transform = action.cachedTransform;

            var newCenter = Handles.PositionHandle(action.center, transform != null ? transform.rotation : Quaternion.identity);

            Handles.matrix = Matrix4x4.TRS(action.center, transform != null ? transform.rotation : Quaternion.identity, Vector3.one);

            switch (action.shape)
            {
            case FindOverlaps.Shape.Box:

                if (boxBoundsHandle == null)
                {
                    boxBoundsHandle = new BoxBoundsHandle();
                }

                boxBoundsHandle.center = Vector3.zero;
                boxBoundsHandle.size   = action.box.Value;

                EditorGUI.BeginChangeCheck();
                boxBoundsHandle.DrawHandle();
                if (EditorGUI.EndChangeCheck())
                {
                    action.box.Value = boxBoundsHandle.size;
                }

                break;

            case FindOverlaps.Shape.Sphere:

                action.radius.Value = Handles.RadiusHandle(Quaternion.identity, Vector3.zero, action.radius.Value);

                break;

            case FindOverlaps.Shape.Capsule:

                if (capsuleBoundsHandle == null)
                {
                    capsuleBoundsHandle = new CapsuleBoundsHandle();
                }

                capsuleBoundsHandle.center     = Vector3.zero;
                capsuleBoundsHandle.height     = action.height.Value;
                capsuleBoundsHandle.radius     = action.radius.Value;
                capsuleBoundsHandle.heightAxis = CapsuleBoundsHandle.HeightAxis.Y;

                EditorGUI.BeginChangeCheck();
                capsuleBoundsHandle.DrawHandle();
                if (EditorGUI.EndChangeCheck())
                {
                    action.radius.Value = capsuleBoundsHandle.radius;
                    action.height.Value = capsuleBoundsHandle.height;
                }

                break;
            }

            Handles.color = color;

            if (EditorGUI.EndChangeCheck())
            {
                action.offset.Value = transform == null ?
                                      newCenter : transform.InverseTransformPoint(newCenter);

                GUI.changed = true;
            }
        }
コード例 #24
0
 public BoundsHandler(SceneHandlerAttribute attribute) : base(attribute)
 {
     BAttribute   = attribute as BoundsHandlerAttribute;
     BoundsHandle = new BoxBoundsHandle();
 }