public void GiveNumber() { if (!givenNumber) { givenNumber = true; myAbsorber.number += number; myAbsorber.UpdateText(); myAbsorber.currentScale = new Vector3(myAbsorber.baseScale.x * combinationSettings.absorberScaleGain.x, myAbsorber.baseScale.y * combinationSettings.absorberScaleGain.y, 1); } }
public override void OnInspectorGUI() { style = new GUIStyle(GUI.skin.label); style.richText = true; if (repaintViews) { repaintViews = false; UnityEditorInternal.InternalEditorUtility.RepaintAllViews(); } //Top: EditorGUILayout.BeginVertical("Helpbox"); EditorGUILayout.LabelField("<size=15><b>Damage Numbers Pro</b></size>", style); GUI.color = new Color(1, 1, 1, 0.7f); EditorGUILayout.LabelField("Variables show a <b>tooltip</b> when you hover over them.", style); EditorGUILayout.LabelField("Disabled features do not affect performance.", style); EditorGUILayout.Space(); DisplayHints(ref spawnHelp, "How to spawn damage numbers.", "Save your damage number as a <b>prefab</b>.", "Spawn prefabs using <b>numberPrefab.CreateNew(number,position)</b>.", "You can find more information in the documentation."); DisplayHints(ref glowHelp, "How to create glowing damage numbers.", "First enable <b>HDR</b> and add <b>Bloom</b> post processing.", "There is a detailed tutorial in the documentation.", "Then increase the <b>Color Intensity</b> of the material."); DisplayHints(ref overlayHelp, "How to render damage numbers through walls.", "Change the material's shader to <b>'Distance Field Overlay'</b>.", "For 2D games look into the <b>'Sorting Group'</b> component below."); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); if (textA == null || textB == null) { if (GUILayout.Button("Prepare")) { Prepare(dn.gameObject); OnEnable(); } EditorGUILayout.LabelField("", style); EditorGUILayout.LabelField("Click the button above to prepare the gameobject.", style); EditorGUILayout.LabelField("Or use <b>[GameObject/2D Object/Damage Number]</b> to create a number.", style); return; } serializedObject.Update(); //Warnings: if (dn.enablePooling && Application.isPlaying) { GUI.color = new Color(1, 0.9f, 0.5f); EditorGUILayout.BeginVertical("Helpbox"); EditorGUILayout.LabelField("<b>Pooling</b> makes <b>tweaking</b> settings at <b>runtime</b> impossible.", style); EditorGUILayout.EndVertical(); GUI.color = new Color(1, 1, 1); } EditorGUILayout.BeginVertical(); //Properties: DisplayMainSettings(); DisplayNumber(); DisplayPrefix(); DisplaySuffix(); DisplayFading(); DisplayMovement(); DisplayShaking(); DisplayStartRotation(); DisplayCombination(); DisplayFollowing(); DisplayPerspective(); DisplayPooling(); EditorGUILayout.EndVertical(); //Fix Variables: FixTextSettings(ref dn.numberSettings); FixTextSettings(ref dn.prefixSettings); FixTextSettings(ref dn.suffixSettings); FixFadeSettings(ref dn.fadeIn); FixFadeSettings(ref dn.fadeOut); MinZero(ref dn.digitSettings.decimals); MinZero(ref dn.digitSettings.dotDistance); //Apply Properties: serializedObject.ApplyModifiedProperties(); //Update Text: if (Selection.gameObjects != null && Selection.gameObjects.Length > 1) { foreach (GameObject gameObject in Selection.gameObjects) { if (gameObject != dn.gameObject) { DamageNumber other = gameObject.GetComponent <DamageNumber>(); if (other != null) { other.UpdateText(); } } } } dn.UpdateText(); //Preview FadePreview(); //External Editors: ExternalEditors(); DisplayFinalInformation(); }