private void OnEnable() { m_Comp = (GridSensorComponent2D)target; Undo.undoRedoPerformed += OnUndoRedo; m_BoundsHandle = new BoxBoundsHandle(); m_BoundsHandle.SetColor(Color.white); }
protected virtual void OnEnable() { if (BoxBoundsHandle == null) { BoxBoundsHandle = new BoxBoundsHandle(); } CollectSerializedProperties(); }
private void OnEnable() { #if UNITY_2017_1_OR_NEWER placementBoundsHandle = new BoxBoundsHandle(); #else placementBoundsHandle = new BoxBoundsHandle(0); #endif placementBoundsHandle.SetColor(Color.magenta); }
private void ResetBoxHandleIfNeeded() { if (BoxHandle == null) { BoxHandle = new BoxBoundsHandle(); BoxHandle.size = size; BoxHandle.center = position; } }
public static BoxBoundsHandle InitBoxHandle() { BoxBoundsHandle handle = new BoxBoundsHandle { axes = PrimitiveBoundsHandle.Axes.X | PrimitiveBoundsHandle.Axes.Y, handleColor = Color.white, wireframeColor = Color.white }; return(handle); }
protected virtual void OnDisable() { BoxBoundsHandle = null; T av = target as T; if (av == null) { return; } av.EditorDestroyAVolume(); }
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; }
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); } }
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; }
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); }
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(); }
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(); }
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; }
// 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(); }
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; }
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(); }
protected virtual void OnDisable() { BoxBoundsHandle = null; }
private void OnEnable() { //rotHandle = new RotationalDriveHandle(); dirHandle = new DirectionalDriveBoundsHandle(); box = new BoxBoundsHandle(); }
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(); } }
void OnEnable() { bbh = new BoxBoundsHandle(); }
private void OnEnable() { m_BoundsHandle = new BoxBoundsHandle(); m_BoundsHandle.SetColor(Color.white); }
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; } }
public BoundsHandler(SceneHandlerAttribute attribute) : base(attribute) { BAttribute = attribute as BoundsHandlerAttribute; BoundsHandle = new BoxBoundsHandle(); }