public PuzzleGrid(PuzzleConfig puzzleConfig, InteractionMode interactionMode) { InitializeComponent(); // Centralize handling of all clicks in the puzzle grid. AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(OnPuzzleButtonClick)); _puzzleConfig = puzzleConfig; _interactionMode = interactionMode; SetupGridStructure(); ConfigureGame(); }
public TriggerTileConfiguration(Vector2 location, string eventName, InteractionMode interactionMode) { Location = location; EventName = eventName; InteractionMode = interactionMode; }
//------------------------------Game Mode Updates------------------------------ private void GameMode_NormalUpdate() { //Set variables interactionMode = InteractionMode.Nothing; HoverOver hoverOver = HoverManager.main.getHoverOver(); List <RTSGameObject> allSelectedUnits = SelectedManager.main.GetSelectedObjects(); //Is their any selected RTSGameObjects if (SelectedManager.main.GetSelectedObjectsCount() > 0) { RTSGameObject firstSelectedObject = SelectedManager.main.GetFirstSelectedObject(); //Is the RTSGameObject able to attack if (firstSelectedObject.canAttack) { if (hoverOver == HoverOver.UnitEnemy || hoverOver == HoverOver.BuildingEnemy) { interactionMode = InteractionMode.Attack; return; } } //Is the RTSGameObject a Unit if (firstSelectedObject.GetComponent <Unit>()) { Unit unit = (Unit)firstSelectedObject; //Can the Unit move if (unit.canMove) { if (hoverOver == HoverOver.Terrain) { interactionMode = InteractionMode.Move; return; } } //Can the Unit interact if (unit.canInteract) { if (hoverOver == HoverOver.UnitFriendly) { //Check if Unit can interact with another Unit (Heal another unit for example) } if (hoverOver == HoverOver.BuildingFriendly) { //Check if Unit can interact with Building (Repair building for example) } } } //Is the RTSGameObject a Worker if (firstSelectedObject.GetComponent <Worker>()) { Worker worker = (Worker)firstSelectedObject; //Can the Worker build if (worker.canBuild) { if (hoverOver == HoverOver.BuildingFriendly) { Building building = (Building)HoverManager.main.currentHoverRTSObject; if (building.buildingMode == BuildingMode.Construction) { interactionMode = InteractionMode.Build; } } } } } //To select any kind of unit else if (hoverOver == HoverOver.UnitFriendly || hoverOver == HoverOver.BuildingFriendly || hoverOver == HoverOver.UnitEnemy || hoverOver == HoverOver.BuildingEnemy) { //Select Interaction interactionMode = InteractionMode.Select; return; } }
public override void SetMode(InteractionMode _mode) { if (_mode == InteractionMode.Changing && null != equivalences && equivalences.Count > 0) { if (null != equivalences) { foreach (GameObject eq in equivalences) { if (null == eq.GetComponent<RootElement>().cutRef) eq.GetComponent<RootElement>().BroadcastMessage("SetMode", InteractionMode.Changing, SendMessageOptions.DontRequireReceiver); } } } /* if (_mode == InteractionMode.Changing && state == ElementsState.Equivalence) { Debug.Log("qui lo cambia per " + root.name); } */ base.SetMode(_mode); /* if (mode == InteractionMode.Freeze && _mode == InteractionMode.Changing && state == ElementsState.Equivalence) { Debug.Log("setMode"); base.SetMode(InteractionMode.Freeze); }*/ }
void SetMode(InteractionMode mode) { base.SetMode(mode); }
public void Enable() { OnInteractionModeChange(InteractionMode.Free, _currentInteractionMode); _currentInteractionMode = InteractionMode.Free; }
// Instant travel to next level public void ChangeLevelAfterTick(MissionType newType, InteractionMode newMode = InteractionMode.INGAME) { nextLevelType = newType; nextInteractionMode = newMode; nextLevel = true; }
public void SetMode(int mode) { Mode = (InteractionMode)mode; Debug.Log($"Set interaction mode to {Mode}"); }
private void UnprocessedInput_PointerPressed(InkUnprocessedInput sender, PointerEventArgs args) { if (args?.CurrentPoint == null || paletteView == null || _wetInk == null || _tileCanvas == null) { return; } var thisPoint = args.CurrentPoint; args.Handled = true; var isTouch = thisPoint.PointerDevice?.PointerDeviceType == PointerDeviceType.Touch; var shiftPressed = args.KeyModifiers.HasFlag(VirtualKeyModifiers.Shift); // Check for palette if (PaletteVisible) { _interactionMode = InteractionMode.PalettePicker; if (!paletteView.IsHit(args)) { return; } // set pointer to ink... _wetInk.SetPenColor(thisPoint, paletteView.LastColor); _wetInk.SetPenSize(thisPoint, paletteView.LastSize); paletteView.Opacity = 0.0; return; } _lastPoint = thisPoint.Position; // if in selection mode, don't change if (_penMode == PenMode.Select) { if (shiftPressed || isTouch) { _interactionMode = InteractionMode.Move; } else { _interactionMode = InteractionMode.SelectTiles; } return; } _interactionMode = InteractionMode.None; // Finally, set the interaction mode if (shiftPressed) { _interactionMode = InteractionMode.Move; } else { if (isTouch) { _interactionMode = InteractionMode.Move; } else { _interactionMode = InteractionMode.Draw; _wetInk?.StartStroke(sender, args); } } }
//---------------------------------------------------------------------------------------------------------------------- #if UNITY_EDITOR /// <summary> /// Save a GameObject as a prefab. /// </summary> /// <param name="go">The GameObject to be saved.</param> /// <param name="prefabPath">The path of the prefab.</param> /// <param name="mode">The interaction mode. Defaults to InteractionMode.AutomatedAction.</param> /// <returns>The root GameObject of the saved Prefab Asset, if available.</returns> public static GameObject SaveAsPrefab(this GameObject go, string prefabPath, InteractionMode mode = InteractionMode.AutomatedAction) { return PrefabUtility.SaveAsPrefabAssetAndConnect(go, prefabPath, mode); }
private void PrintModeText(InteractionMode interactionMode) { GetComponent <Text>().text = interactionMode.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="InteractionModeChangedEventArgs"/> class. /// </summary> /// <param name="oldValue">The old value.</param> /// <param name="newValue">The new value.</param> public InteractionModeChangedEventArgs(InteractionMode oldValue, InteractionMode newValue) { OldValue = oldValue; NewValue = newValue; }
protected void fireInteractionModeChangedEvent(InteractionMode oldValue, InteractionMode newValue) { if (InteractionModeChanged != null) { try { InteractionModeChanged.Invoke(this, new InteractionModeChangedEventArgs(oldValue, newValue)); } catch (Exception) { } } }
/// <summary> /// Changes the interaction mode. /// </summary> /// <param name="mode">The new mode.</param> /// <returns>the current interaction mode</returns> public InteractionMode ChangeMode(InteractionMode mode) { Mode = mode; return Mode; }
private void GameMode_MenuUpdate() { //Debug.Log("GameMode: Menu"); interactionMode = InteractionMode.Nothing; }
internal static SubScene CreateNewSubScene(string name, NewSubSceneArgs args, InteractionMode interactionMode) { GameObject targetGameObject; Scene parentScene; GameObject[] topLevelGameObjects; CheckInputArguments(args, out parentScene, out targetGameObject, out topLevelGameObjects); return(CreateSubSceneAndMoveObjectsInside(parentScene, targetGameObject?.transform, topLevelGameObjects, name, interactionMode)); }
internal static SubScene CreateSubSceneAndAddSelection(GameObject gameObject, InteractionMode interactionMode = InteractionMode.AutomatedAction) { var args = new NewSubSceneArgs(gameObject, default(Scene), NewSubSceneMode.MoveSelectionToScene); return(CreateNewSubScene(gameObject.name, args, interactionMode)); }
private void ViveRightController_PadUnclicked(object sender, ClickedEventArgs e) { // this gets executed *before* leaving the current mode switch (ViveBridge.InteractionMode) { case InteractionMode.SpawnPrimitives: Debug.Log("Indicator #: " + ViveBridge.IndicatorCount); if (ViveBridge.IndicatorCount == 4 || ViveBridge.IndicatorCount == 8) { var primitive = primitiveManager.SpawnBox(false); ViveBridge.IndicatorCount = 0; UpdateTextMesh(); return; } break; case InteractionMode.SpawnObjects: radialMenu.gameObject.SetActive(false); break; case InteractionMode.Manipulation: if (!ViveBridge.IsManipulating) { viveManipulator.ReleaseObject(); viveManipulator.DeactivateRay(); } else { return; } break; case InteractionMode.ScalePrefabs: viveManipulator.DeactivateRay(); break; } InteractionMode oldMode = ViveBridge.InteractionMode; // this actually changes the mode ViveBridge.InteractionMode = viveManipulator.ChangeMode(ViveBridge.InteractionMode); // this is executed *after* leaving the previous mode switch (oldMode) { case InteractionMode.SpawnPrimitives: viveManipulator.DeactivateTempPrimitive(); break; } // this gets executed *after* entering the new mode switch (ViveBridge.InteractionMode) { case InteractionMode.SpawnPrimitives: viveManipulator.ActivateTempPrimitive(ViveManipulator.MinimumPrimitiveDistance); break; case InteractionMode.ScalePrefabs: case InteractionMode.Manipulation: viveManipulator.ActivateRay(); break; case InteractionMode.SpawnObjects: viveManipulator.ActivateRay(); radialMenu.gameObject.SetActive(true); break; } viveManipulator.ChangeColor(ViveBridge.InteractionMode); }
internal async Task SetInteractionMode(int requestId, InteractionMode interactionMode) { await RunOperationAndFireEvent(requestId, async() => { await Pdfview.Controller.SetInteractionModeAsync(interactionMode); } ); }
// Use this for initialization void Start() { /*I could have done this in declaration, using explicit values, but here if I want to change the * default I just change the one value for mode counter*/ currentMode = possibleModes[modeCounter]; }
public override void ChangeInteraction(InteractionMode mode) { }
// Update is called once per frame void Update () { bool interactionModeChanged = false; if (Input.GetKeyDown(KeyCode.Alpha1)) { textDislayMode.text = "1 | <space>:start animation | <arrow_up>:reset brick | <left_arrow_key>:rotate brick manually"; interactionModeChanged = true; _currentInteractionMode = InteractionMode.e_RotateBrickMode; } else if (Input.GetKeyDown(KeyCode.Alpha2)) { textDislayMode.text = "2 | <space>:start animation | <arrow_up>:reset brick | <right_arrow_key>:move brick manually"; interactionModeChanged = true; _currentInteractionMode = InteractionMode.e_MoveBrickMode; } if (interactionModeChanged) { cleanUp (); interactionModeChanged = false; if (_currentInteractionMode == InteractionMode.e_RotateBrickMode) { RotateBrickScript.rotatableBrick.transform.position = new Vector3(0f, 2.249f, 0f); brickTowerTwo.SetActive (false); camTaskOne.enabled = true; camTaskTwo.enabled = false; } else { MoveBrickScript.moveableBrick.transform.position = new Vector3(0f, 2.249f, 0f); brickTowerTwo.SetActive(true); camTaskOne.enabled = false; camTaskTwo.enabled = true; } } switch (_currentInteractionMode) { case InteractionMode.e_RotateBrickMode: if (Input.GetKeyDown (KeyCode.Space)) { // Trigger animation. RotateBrickScript.doInitialAnimatedRotation (); } if (Input.GetKey ("up")) { RotateBrickScript.resetRotation (); } if (Input.GetKey ("left")) { RotateBrickScript.rotateBrick (); } if (RotateBrickScript.shouldUserFeedbackBeDisplayed ()) { showUserFeedback (); } break; case InteractionMode.e_MoveBrickMode: if (Input.GetKeyDown(KeyCode.Space)) { // Trigger animation. MoveBrickScript.doInitialAnimatedMovement(); } if (Input.GetKey("up")) { MoveBrickScript.resetMovement(); } if (Input.GetKey("right")) { MoveBrickScript.moveBrick(); } if (MoveBrickScript.shouldUserFeedbackBeDisplayed ()) { showUserFeedback (); } break; default: Debug.Log("Unknown Interaction Mode"); break; } }
public void CheckHits(InteractionMode mode, bool isServer = true) { var touchPad = viveBridge.Touchpad; if (touchPad == Vector2.zero) { rotated = false; } if (viveBridge.IsManipulating && !rotated) { if (touchPad.x >= 0.5f) { ManipulatedObject.transform.localScale = initialScale; currentRotation = Quaternion.AngleAxis(180, Vector3.up); ManipulatedObject.transform.localRotation = attachedRotation * currentRotation; rotated = true; } else if (touchPad.x <= -0.5f) { ManipulatedObject.transform.localScale = initialScale; currentRotation = Quaternion.identity; ManipulatedObject.transform.localRotation = attachedRotation * currentRotation; rotated = true; } if (touchPad.y >= 0.5f) { ManipulatedObject.transform.localScale = new Vector3(initialScale.z, initialScale.y, initialScale.x); currentRotation = Quaternion.AngleAxis(90, Vector3.up); ManipulatedObject.transform.localRotation = attachedRotation * currentRotation; rotated = true; } else if (touchPad.y <= -0.5f) { ManipulatedObject.transform.localScale = new Vector3(initialScale.z, initialScale.y, initialScale.x); currentRotation = Quaternion.AngleAxis(-90, Vector3.up); ManipulatedObject.transform.localRotation = attachedRotation * currentRotation; rotated = true; } } if (mode == InteractionMode.SpawnPrimitives || viveBridge.IsManipulating || IsScaling) { vivePawn.transform.Find("Highlighter").gameObject.GetComponent <Light>().enabled = false; return; } var collidedObject = GameObject.Find(viveBridge.CollidedName); PrevCollided = LastCollided; LastCollided = collidedObject; if (LastCollided != null && LastCollided.transform.parent != null) { LastCollided = LastCollided.transform.parent.gameObject; } var colHigh = GameObject.Find(viveBridge.CollidedHighlighter); if (colHigh != null) { vivePawn.transform.Find("Highlighter").gameObject.GetComponent <Light>().enabled = true; int layer = LayerMask.NameToLayer(ViveManipulable.Manipulables); var colHighs = FindGameObjectsWithLayer(layer); if (colHighs != null) { foreach (var high in colHighs) { high.layer = 0; } } colHigh.layer = layer; } else { vivePawn.transform.Find("Highlighter").gameObject.GetComponent <Light>().enabled = false; } var newPosition = new Vector3(0, 0, (viveBridge.HitPoint - viveBridge.Position).magnitude); var sphere = vivePawn.transform.Find(raySphereMesh); newPosition.z -= sphere.transform.localScale.z; if (string.IsNullOrEmpty(viveBridge.CollidedName)) { newPosition.z += 10; } //for indicators sphere.transform.localPosition = isServer ? newPosition : Vector3.Lerp(sphere.transform.localPosition, newPosition, Time.deltaTime * SmoothStep); sphere.GetComponent <MeshRenderer>().enabled = true; }
private void OnInteractionModeInternalChanged(InteractionMode interactionMode) { System.Diagnostics.Debug.WriteLine($"InternalInteractionMode changed to {interactionMode}"); }
public virtual void SetMode(InteractionMode mode) { this.mode = mode; }
public override void ChangeInteraction(InteractionMode mode) { this.mode = mode; updateInFrame = Time.frameCount; }
void Update() { if (mode != lastMode) { if (mode == InteractionMode.Moving) { if (!isSubFraction && state == ElementsState.Fraction) AttachSymbol(true); if (null == symbol) AttachModifierSymbol(); DetachModifierScale(); DetachButtons(); } else if (mode == InteractionMode.Changing || mode == InteractionMode.Initializing) { AttachModifierSymbol(); } else if (mode == InteractionMode.Partitioning) { DetachModifierScale(); DetachButtons(); AttachModifierPartition(); } else if (mode == InteractionMode.Scaling) { DetachModifierSymbol(); DetachButtons(); //AttachModifierScale(); } else if (mode == InteractionMode.Freeze) { if (isHighlighted) highlight.gameObject.SetActive(false); BroadcastMessage("Freeze", SendMessageOptions.DontRequireReceiver); } if (lastMode == InteractionMode.Freeze) { if (isHighlighted) highlight.gameObject.SetActive(true); BroadcastMessage("UnFreeze", SendMessageOptions.DontRequireReceiver); } lastMode = mode; } if (mode == InteractionMode.Moving && !isSubFraction &&( state == ElementsState.Fraction || state == ElementsState.Equivalence)) { if (null == symbol) AttachModifierSymbol(); } if (mode == InteractionMode.Initializing) { Workspace.Instance.SendMessage("SetFocusOn", gameObject); Draw(zIndex); } if (!inputEnabled) return; CheckScaleTween(); #if UNITY_IPHONE || UNITY_ANDROID if (Input.touchCount == 1 && longTapTimer > 0 && Time.time - longTapTimer > 0.6f && !hasDragged && !GameObject.FindGameObjectWithTag("Interface").GetComponent<InterfaceBehaviour>().isDragWindow && !GameObject.FindGameObjectWithTag("Interface").GetComponent<InterfaceBehaviour>().isZoomActive && !GameObject.FindGameObjectWithTag("Interface").GetComponent<InterfaceBehaviour>().isBlockingOperation) { if (denominator > 0) RightClick(); longTapTimer = -1.0f; } #endif if (mode == InteractionMode.Scaling && isScaling) { Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3 diff = mousePos - initialMousePos; float diffGap = Vector3.Dot(diff, scaleDirection); SetElementScale(initialScale + diffGap * 0.282f); } }
public override void OnInspectorGUI() { MouseInteraction myMouseInteraction = (MouseInteraction)target; if (!myMouseInteraction.useCenterScreen && !myMouseInteraction.useTouchClick) { interactionMode = InteractionMode.Mouse; } else if (!myMouseInteraction.useTouchClick) { interactionMode = InteractionMode.CenterOfTheScreen; } else { interactionMode = InteractionMode.TouchClick; } // Settings of the Mouse Interaction script EditorGUILayout.Separator(); // Blank Line (space separator) // Interaction Color myMouseInteraction.interactionColor = EditorGUILayout.ColorField(new GUIContent("Interaction Color", "Color change of the interacted object."), myMouseInteraction.interactionColor); // Interaction Speed myMouseInteraction.interactionSpeed = EditorGUILayout.FloatField(new GUIContent("Interaction Speed", "Fade speed of the color change (slow -> quick)"), myMouseInteraction.interactionSpeed); // Emission Intensity myMouseInteraction.emissionIntensity = EditorGUILayout.Slider(new GUIContent("Emission Intensity", "Emission intensity (doesn't work with material which has no emissive intensity)"), myMouseInteraction.emissionIntensity, 0.0f, 1.0f); EditorGUILayout.Separator(); // Blank Line (space separator) // Interaction Mode interactionMode = (InteractionMode)EditorGUILayout.EnumPopup(new GUIContent("Interaction Mode", "How the interaction work (mouse over, center of the screen or simple touch/click)"), interactionMode); switch (interactionMode) { case InteractionMode.Mouse: myMouseInteraction.useCenterScreen = false; myMouseInteraction.useTouchClick = false; break; case InteractionMode.CenterOfTheScreen: myMouseInteraction.useCenterScreen = true; myMouseInteraction.useTouchClick = false; break; case InteractionMode.TouchClick: myMouseInteraction.useCenterScreen = false; myMouseInteraction.useTouchClick = true; break; default: break; } // Hold Mouse Interaction if (myMouseInteraction.useTouchClick || myMouseInteraction.useCenterScreen) { GUI.enabled = false; } myMouseInteraction.holdMouseInteraction = EditorGUILayout.Toggle(new GUIContent("Hold Mouse Interaction", "Hold the mouse interaction when clicking on the object (Mouse mode only)"), myMouseInteraction.holdMouseInteraction); GUI.enabled = true; // Mouse Cursor if (interactionMode != InteractionMode.Mouse) { GUI.enabled = false; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(new GUIContent("Mouse Cursor", "Cursor sprite when interaction with the object (texture must be a Cursor in import settings)")); myMouseInteraction.mouseCursor = (Texture2D)EditorGUILayout.ObjectField(myMouseInteraction.mouseCursor, typeof(Texture2D), false); EditorGUILayout.EndHorizontal(); GUI.enabled = true; // Interaction distance myMouseInteraction.interactionDistance = EditorGUILayout.IntField(new GUIContent("Interaction Distance", "Max distance of the interaction (1000 = far away, 6 = melee range)"), myMouseInteraction.interactionDistance); // Grouped Interaction myMouseInteraction.groupedInteraction = EditorGUILayout.Toggle(new GUIContent("Grouped Interaction", "Interaction with all objects of the same parent."), myMouseInteraction.groupedInteraction); // Number Of Ascent if (!myMouseInteraction.groupedInteraction) { GUI.enabled = false; } myMouseInteraction.numberOfAscent = EditorGUILayout.IntSlider(new GUIContent("Number Of Ascent", "Number of ascent to define the parent for the Grouped Interaction setting."), myMouseInteraction.numberOfAscent, 0, 4); GUI.enabled = true; // Interaction Animation myMouseInteraction.interactionAnim = (AnimationClip)EditorGUILayout.ObjectField(new GUIContent("Interaction Animation", "Animation played when interacted."), myMouseInteraction.interactionAnim, typeof(AnimationClip), false); if (myMouseInteraction.interactionAnim == null) { GUI.enabled = false; } // Animation Loop myMouseInteraction.animationLoop = EditorGUILayout.Toggle(new GUIContent("Animation Loop", "Loop the interacted animation."), myMouseInteraction.animationLoop); // Animation Reset if (!myMouseInteraction.animationLoop) { GUI.enabled = false; } myMouseInteraction.animationReset = EditorGUILayout.Toggle(new GUIContent("Animation Reset", "[Loop animation only] Reset the animation loop when the interaction exit."), myMouseInteraction.animationReset); GUI.enabled = true; EditorGUILayout.Separator(); // Blank Line (space separator) // Show Tooltip (Beginning of a group list where settings are disabled if you don't want to show tooltip) myMouseInteraction.showTooltip = EditorGUILayout.BeginToggleGroup(new GUIContent("Show Tooltip", "Show a text over the interacted object."), myMouseInteraction.showTooltip); EditorGUI.indentLevel++; // Tooltip UI Panel myMouseInteraction.tooltipUIPanel = (GameObject)EditorGUILayout.ObjectField(new GUIContent("Tooltip UI Panel", "Show a predefined UI Panel over the interacted object."), myMouseInteraction.tooltipUIPanel, typeof(GameObject), true); // Fixed to the Object myMouseInteraction.fixedToTheObject = EditorGUILayout.Toggle(new GUIContent("Fixed to the Object", "Show the tooltip over the object instead of over the mouse."), myMouseInteraction.fixedToTheObject); // Don't Exit Interaction On Clicking UI if (myMouseInteraction.useCenterScreen || (!myMouseInteraction.useCenterScreen && !myMouseInteraction.useTouchClick && !myMouseInteraction.holdMouseInteraction)) { GUI.enabled = false; } myMouseInteraction.dontExitInteractionOnClickingUI = EditorGUILayout.Toggle(new GUIContent("Don't Exit Interaction On Clicking UI", "Don't exit interaction when clicking on UI element (only available on Touch/Click mode and Mouse mode with Hold Mouse Interaction setting)"), myMouseInteraction.dontExitInteractionOnClickingUI); if (myMouseInteraction.showTooltip) { GUI.enabled = true; } // Tooltip Position myMouseInteraction.tooltipPosition = EditorGUILayout.Vector2Field(new GUIContent("Tooltip Position", "Position of the tooltip showed over the interacted object."), myMouseInteraction.tooltipPosition); // Tooltip Text myMouseInteraction.tooltipText = EditorGUILayout.TextField(new GUIContent("Tooltip Text", "Text to show over the interacted object."), myMouseInteraction.tooltipText); if (myMouseInteraction.tooltipText == "") { GUI.enabled = false; } EditorGUI.indentLevel++; // Tooltip Text Color myMouseInteraction.tooltipColor = EditorGUILayout.ColorField(new GUIContent("Text Color", "[Requires Tooltip Text] Color of the text showed over the interacted object."), myMouseInteraction.tooltipColor); // Tooltip Text Size myMouseInteraction.tooltipSize = EditorGUILayout.IntField(new GUIContent("Text Size", "[Requires Tooltip Text] Size of the text showed over the interacted object."), myMouseInteraction.tooltipSize); // Tooltip Text Scaled myMouseInteraction.textResized = EditorGUILayout.Toggle(new GUIContent("Text Resized", "Resize the text, relative to the distance between the object and the camera."), myMouseInteraction.textResized); // Tooltip Text Font myMouseInteraction.tooltipFont = (Font)EditorGUILayout.ObjectField(new GUIContent("Text Font", "[Requires Tooltip Text] Font of the text showed over the interacted object."), myMouseInteraction.tooltipFont, typeof(Font), false); // Tooltip Alignment myMouseInteraction.tooltipAlignment = (MouseInteraction.TooltipAlignment)EditorGUILayout.EnumPopup(new GUIContent("Text Alignment", "Alignment of the text showed over the interacted object."), myMouseInteraction.tooltipAlignment); // Tooltip Shadow Color myMouseInteraction.tooltipShadowColor = EditorGUILayout.ColorField(new GUIContent("Text Shadow Color", "Color of the text shadow showed over the interacted object."), myMouseInteraction.tooltipShadowColor); // Tooltip Shadow Position myMouseInteraction.tooltipShadowPosition = EditorGUILayout.Vector2Field(new GUIContent("Text Shadow Position", "Position of the text shadow showed over the interacted object."), myMouseInteraction.tooltipShadowPosition); EditorGUI.indentLevel--; GUI.enabled = true; EditorGUI.indentLevel--; EditorGUILayout.EndToggleGroup(); // End of the group list (of Show Tooltip) EditorGUILayout.Separator(); // Blank Line (space separator) // Using Event (Beginning of a group list where settings are disabled if you don't want to use event) myMouseInteraction.usingEvent = EditorGUILayout.BeginToggleGroup(new GUIContent("Using Event", "Enable event options for calling external method."), myMouseInteraction.usingEvent); if (myMouseInteraction.usingEvent) { SerializedProperty sprop; // Event called when object enter in interacted mode sprop = serializedObject.FindProperty("eventInteractionEnter"); EditorGUILayout.PropertyField(sprop); serializedObject.ApplyModifiedProperties(); // Event called when object exit the interacted mode sprop = serializedObject.FindProperty("eventInteractionExit"); EditorGUILayout.PropertyField(sprop); serializedObject.ApplyModifiedProperties(); } EditorGUILayout.EndToggleGroup(); // End of the group list (of Using Event) EditorGUILayout.Separator(); // Blank Line (space separator) // Warning messages // Check if the interacted object has a collider if (!myMouseInteraction.transform.gameObject.GetComponent <Collider>()) { EditorGUILayout.HelpBox("Don't forget to attach a collider to this object.", MessageType.Warning); } // Advice for the Touch/Click interaction if (myMouseInteraction.useTouchClick && !myMouseInteraction.fixedToTheObject && myMouseInteraction.showTooltip) { EditorGUILayout.HelpBox("In Touch/Click interaction, 'Fixed to the object' setting is recommended for mobile uses.", MessageType.Warning); } // Check if the object has an animation component for the Interaction Animation setting if (myMouseInteraction.interactionAnim != null && myMouseInteraction.GetComponent <Animation>() == null) { EditorGUILayout.HelpBox("There is no Animation Component attached to this object.", MessageType.Error); } // Check if the object has the good number of parent, related to the Number Of Ascent setting if (myMouseInteraction.groupedInteraction) { bool error_parent = false; Transform current_parent = myMouseInteraction.transform.parent; for (int i = 1; i <= myMouseInteraction.numberOfAscent; i++) { if (current_parent == null) { error_parent = true; break; } else { current_parent = current_parent.parent; } } if (error_parent) { EditorGUILayout.HelpBox("Number Of Ascent value is too high, this object doesn't have enough parent.", MessageType.Error); } } // Check if the UI Panel has a RectTransform component /*if(myMouseInteraction.checkOutOfScreen && myMouseInteraction.tooltipUIPanel != null) { * if(myMouseInteraction.tooltipUIPanel.GetComponent<RectTransform>() == null) * EditorGUILayout.HelpBox("Your UI Panel must have a RectTransform component.", MessageType.Error) ; * }*/ }