Implement hand menu features
This commit is contained in:
278
Assets/DamageNumbersPro/Scripts/DamageNumberGUI.cs
Normal file
278
Assets/DamageNumbersPro/Scripts/DamageNumberGUI.cs
Normal file
@@ -0,0 +1,278 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using DamageNumbersPro.Internal;
|
||||
using TMPro;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
public class DamageNumberGUI : DamageNumber
|
||||
{
|
||||
/*
|
||||
* Contact me if you need any support.
|
||||
* Email: ekincantascontact@gmail.com
|
||||
* Discord: https://discord.com/invite/nWbRkN8Zxr
|
||||
*
|
||||
* Check the manual for more information.
|
||||
* Manual: https://ekincantas.com/damage-numbers-pro/
|
||||
*
|
||||
* Thank you for using my asset.
|
||||
* If you want to add your own code please use the functions below.
|
||||
* I recommend creating a duplicate of this script first or creating your own script which derives from DamageNumber.
|
||||
* Otherwise you may loose your custom code when you update damage numbers pro.
|
||||
*
|
||||
* Good Luck
|
||||
*/
|
||||
|
||||
//Custom Events:
|
||||
protected override void OnPreSpawn()
|
||||
{
|
||||
//Fixes an issue where the previous mesh was visible for 1 frame.
|
||||
if (textMeshProA != null)
|
||||
{
|
||||
textMeshProA.enabled = textMeshProB.enabled = false;
|
||||
}
|
||||
}
|
||||
protected override void OnStart()
|
||||
{
|
||||
//Only damage numbers of the same parent can interact with each other.
|
||||
if(spamGroup != "" && transform.parent != null)
|
||||
{
|
||||
spamGroup += transform.parent.GetInstanceID();
|
||||
}
|
||||
|
||||
//GUI Alpha Fix:
|
||||
skippedFrames = 0;
|
||||
skipFrames = true;
|
||||
realStartTime = Time.unscaledTime;
|
||||
}
|
||||
protected override void OnLateUpdate()
|
||||
{
|
||||
//GUI Alpha Fix:
|
||||
if (skipFrames)
|
||||
{
|
||||
transform.localScale = Vector3.one * 0.0001f;
|
||||
currentFade = 0;
|
||||
|
||||
if (skippedFrames > 2 && Time.unscaledTime > realStartTime + 0.03f)
|
||||
{
|
||||
skipFrames = false;
|
||||
transform.localScale = originalScale;
|
||||
currentFade = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnStop()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnUpdate(float deltaTime)
|
||||
{
|
||||
//GUI Alpha Fix:
|
||||
skippedFrames++;
|
||||
}
|
||||
protected override void OnAbsorb(float number, float newSum)
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnTextUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* The code below is required for the GUI version of damage numbers pro.
|
||||
* So you should not change it too much.
|
||||
* But you can use the events above to add your custom behavior.
|
||||
*/
|
||||
|
||||
//References:
|
||||
RectTransform myRect;
|
||||
TextMeshProUGUI textMeshProA;
|
||||
TextMeshProUGUI textMeshProB;
|
||||
RectTransform textRectA;
|
||||
RectTransform textRectB;
|
||||
List<TMP_SubMeshUI> subMeshs;
|
||||
|
||||
//Internal:
|
||||
float realStartTime;
|
||||
bool skipFrames;
|
||||
int skippedFrames;
|
||||
|
||||
//Components:
|
||||
public override void GetReferencesIfNecessary()
|
||||
{
|
||||
if(textMeshProA == null)
|
||||
{
|
||||
GetReferences();
|
||||
}
|
||||
}
|
||||
public override void GetReferences()
|
||||
{
|
||||
baseAlpha = 0.9f;
|
||||
|
||||
myRect = GetComponent<RectTransform>();
|
||||
transformA = transform.Find("TMPA");
|
||||
transformB = transform.Find("TMPB");
|
||||
textMeshProA = transformA.GetComponent<TextMeshProUGUI>();
|
||||
textMeshProB = transformB.GetComponent<TextMeshProUGUI>();
|
||||
textRectA = transformA.GetComponent<RectTransform>();
|
||||
textRectB = transformB.GetComponent<RectTransform>();
|
||||
}
|
||||
public override TMP_Text[] GetTextMeshs()
|
||||
{
|
||||
return new TMP_Text[] { textMeshProA, textMeshProB };
|
||||
}
|
||||
public override TMP_Text GetTextMesh()
|
||||
{
|
||||
return textMeshProA;
|
||||
}
|
||||
|
||||
//Materials:
|
||||
public override Material[] GetSharedMaterials()
|
||||
{
|
||||
return textMeshProA.fontSharedMaterials;
|
||||
}
|
||||
public override Material[] GetMaterials()
|
||||
{
|
||||
return textMeshProA.fontMaterials;
|
||||
}
|
||||
public override Material GetSharedMaterial()
|
||||
{
|
||||
return textMeshProA.fontSharedMaterial;
|
||||
}
|
||||
public override Material GetMaterial()
|
||||
{
|
||||
return textMeshProA.fontMaterial;
|
||||
}
|
||||
|
||||
//Text:
|
||||
protected override void SetTextString(string fullString)
|
||||
{
|
||||
textMeshProA.text = textMeshProB.text = fullString;
|
||||
|
||||
if(!textMeshProA.enabled)
|
||||
{
|
||||
textMeshProA.enabled = textMeshProB.enabled = true;
|
||||
}
|
||||
|
||||
textMeshProA.ForceMeshUpdate();
|
||||
textMeshProB.ForceMeshUpdate();
|
||||
textMeshProA.canvasRenderer.SetMesh(textMeshProA.mesh);
|
||||
textMeshProB.canvasRenderer.SetMesh(textMeshProB.mesh);
|
||||
|
||||
meshs = new List<Mesh>();
|
||||
meshs.Add(textMeshProA.mesh);
|
||||
meshs.Add(textMeshProB.mesh);
|
||||
|
||||
//Sub Meshs:
|
||||
subMeshs = new List<TMP_SubMeshUI>();
|
||||
foreach(TMP_SubMeshUI subMesh in textMeshProA.GetComponentsInChildren<TMP_SubMeshUI>())
|
||||
{
|
||||
subMeshs.Add(subMesh);
|
||||
meshs.Add(subMesh.mesh);
|
||||
}
|
||||
foreach (TMP_SubMeshUI subMesh in textMeshProB.GetComponentsInChildren<TMP_SubMeshUI>())
|
||||
{
|
||||
subMeshs.Add(subMesh);
|
||||
meshs.Add(subMesh.mesh);
|
||||
}
|
||||
}
|
||||
|
||||
//Position:
|
||||
public override Vector3 GetPosition()
|
||||
{
|
||||
return myRect.anchoredPosition3D;
|
||||
}
|
||||
public override void SetPosition(Vector3 newPosition)
|
||||
{
|
||||
GetReferencesIfNecessary();
|
||||
position = myRect.anchoredPosition3D = newPosition;
|
||||
}
|
||||
public override void SetAnchoredPosition(Transform rectParent, Vector2 anchoredPosition)
|
||||
{
|
||||
//Old Transform:
|
||||
Vector3 oldScale = transform.localScale;
|
||||
|
||||
//Set Parent and Position:
|
||||
GetReferencesIfNecessary();
|
||||
myRect.SetParent(rectParent, false);
|
||||
myRect.anchoredPosition = anchoredPosition;
|
||||
|
||||
//New Transform:
|
||||
transform.localScale = oldScale;
|
||||
transform.eulerAngles = textMeshProA.canvas.transform.eulerAngles;
|
||||
}
|
||||
public override void SetAnchoredPosition(Transform rectParent, Transform rectPosition, Vector2 relativeAnchoredPosition)
|
||||
{
|
||||
//Old Transform:
|
||||
Vector3 oldScale = transform.localScale;
|
||||
|
||||
//Set Parent and Position:
|
||||
GetReferencesIfNecessary();
|
||||
myRect.SetParent(rectParent, false);
|
||||
myRect.position = rectPosition.position;
|
||||
myRect.anchoredPosition += relativeAnchoredPosition;
|
||||
|
||||
//New Transform:
|
||||
transform.localScale = oldScale;
|
||||
transform.eulerAngles = textMeshProA.canvas.transform.eulerAngles;
|
||||
}
|
||||
|
||||
protected override void SetLocalPositionA(Vector3 localPosition)
|
||||
{
|
||||
textRectA.anchoredPosition = localPosition * 50;
|
||||
}
|
||||
protected override void SetLocalPositionB(Vector3 localPosition)
|
||||
{
|
||||
textRectB.anchoredPosition = localPosition * 50;
|
||||
}
|
||||
protected override float GetPositionFactor()
|
||||
{
|
||||
return 100f;
|
||||
}
|
||||
|
||||
//Other:
|
||||
protected override void OnFade(float currentFade)
|
||||
{
|
||||
textMeshProA.canvasRenderer.SetMesh(textMeshProA.mesh);
|
||||
textMeshProB.canvasRenderer.SetMesh(textMeshProB.mesh);
|
||||
|
||||
foreach (TMP_SubMeshUI subMesh in subMeshs)
|
||||
{
|
||||
subMesh.canvasRenderer.SetMesh(subMesh.mesh);
|
||||
}
|
||||
}
|
||||
protected override void UpdateRotationZ()
|
||||
{
|
||||
SetRotationZ(textMeshProA.transform);
|
||||
SetRotationZ(textMeshProB.transform);
|
||||
}
|
||||
public override void CheckAndEnable3D()
|
||||
{
|
||||
enable3DGame = false;
|
||||
}
|
||||
public override bool IsMesh()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override Vector3 GetUpVector()
|
||||
{
|
||||
return Vector3.up;
|
||||
}
|
||||
public override Vector3 GetRightVector()
|
||||
{
|
||||
return Vector3.right;
|
||||
}
|
||||
public override Vector3 GetFreshUpVector()
|
||||
{
|
||||
return Vector3.up;
|
||||
}
|
||||
public override Vector3 GetFreshRightVector()
|
||||
{
|
||||
return Vector3.right;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/DamageNumbersPro/Scripts/DamageNumberGUI.cs.meta
Normal file
11
Assets/DamageNumbersPro/Scripts/DamageNumberGUI.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 970bc0384e845f941a90f0d12b80b0c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 524
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
55
Assets/DamageNumbersPro/Scripts/DamageNumberMesh.cs
Normal file
55
Assets/DamageNumbersPro/Scripts/DamageNumberMesh.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using DamageNumbersPro.Internal;
|
||||
using TMPro;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
public class DamageNumberMesh : DamageNumber
|
||||
{
|
||||
/*
|
||||
* Contact me if you need any support.
|
||||
* Email: ekincantascontact@gmail.com
|
||||
* Discord: https://discord.com/invite/nWbRkN8Zxr
|
||||
*
|
||||
* Check the manual for more information.
|
||||
* Manual: https://ekincantas.com/damage-numbers-pro/
|
||||
*
|
||||
* Thank you for using my asset.
|
||||
* If you want to add your own code please use the functions below.
|
||||
* I recommend creating a duplicate of this script first and renaming it.
|
||||
* Otherwise you may loose your custom code when you update damage numbers pro.
|
||||
*
|
||||
* Good Luck on your Project
|
||||
*/
|
||||
|
||||
//Custom Events:
|
||||
protected override void OnStart()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnStop()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnUpdate(float deltaTime)
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnFade(float currentFade)
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnTextUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnAbsorb(float number, float newSum)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/DamageNumbersPro/Scripts/DamageNumberMesh.cs.meta
Normal file
11
Assets/DamageNumbersPro/Scripts/DamageNumberMesh.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38ab3cdc3b49a6e428853efe80194005
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 522
|
||||
icon: {fileID: 2800000, guid: 47a7c3a675ab92247b88f6f2978ea88d, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/DamageNumbersPro/Scripts/Internal.meta
Normal file
8
Assets/DamageNumbersPro/Scripts/Internal.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22d63a4b14154fd48a7ded7576db49f7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
499
Assets/DamageNumbersPro/Scripts/Internal/DNPPreset.cs
Normal file
499
Assets/DamageNumbersPro/Scripts/Internal/DNPPreset.cs
Normal file
@@ -0,0 +1,499 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using DamageNumbersPro;
|
||||
|
||||
namespace DamageNumbersPro.Internal
|
||||
{
|
||||
[CreateAssetMenu(fileName = "Preset", menuName = "TextMeshPro/Preset for DNP", order = -1)]
|
||||
public class DNPPreset : ScriptableObject
|
||||
{
|
||||
//Font:
|
||||
public bool changeFontAsset;
|
||||
public TMP_FontAsset fontAsset;
|
||||
|
||||
//Color:
|
||||
public bool changeColor;
|
||||
public Color color = Color.white;
|
||||
public bool enableGradient;
|
||||
public VertexGradient gradient = new VertexGradient(Color.white, Color.white, Color.white, Color.white);
|
||||
|
||||
//Number:
|
||||
public bool changeNumber;
|
||||
public bool enableNumber = true;
|
||||
public TextSettings numberSettings = new TextSettings(0);
|
||||
public DigitSettings digitSettings = new DigitSettings(0);
|
||||
|
||||
//Left Text:
|
||||
public bool changeLeftText;
|
||||
public bool enableLeftText = true;
|
||||
public string leftText;
|
||||
public TextSettings leftTextSettings = new TextSettings(0f);
|
||||
|
||||
//Right Text:
|
||||
public bool changeRightText;
|
||||
public bool enableRightText = true;
|
||||
public string rightText;
|
||||
public TextSettings rightTextSettings = new TextSettings(0f);
|
||||
|
||||
//Vertical Text:
|
||||
public bool hideVerticalTexts = false;
|
||||
|
||||
//Fade In:
|
||||
public bool changeFadeIn = false;
|
||||
public float durationFadeIn = 0.2f;
|
||||
public bool enableOffsetFadeIn = true;
|
||||
[Tooltip("TextA and TextB move together from this offset.")]
|
||||
public Vector2 offsetFadeIn = new Vector2(0.5f, 0);
|
||||
public bool enableScaleFadeIn = true;
|
||||
[Tooltip("Scales in from this scale.")]
|
||||
public Vector2 scaleFadeIn = new Vector2(2, 2);
|
||||
public bool enableCrossScaleFadeIn = false;
|
||||
[Tooltip("Scales TextA in from this scale and TextB from the inverse of this scale.")]
|
||||
public Vector2 crossScaleFadeIn = new Vector2(1, 1.5f);
|
||||
public bool enableShakeFadeIn = false;
|
||||
[Tooltip("Shakes in from this offset.")]
|
||||
public Vector2 shakeOffsetFadeIn = new Vector2(0, 1.5f);
|
||||
[Tooltip("Shakes in at this frequency.")]
|
||||
public float shakeFrequencyFadeIn = 4f;
|
||||
|
||||
//Fade Out:
|
||||
public bool changeFadeOut = false;
|
||||
public float durationFadeOut = 0.2f;
|
||||
public bool enableOffsetFadeOut = true;
|
||||
[Tooltip("TextA and TextB move apart to this offset.")]
|
||||
public Vector2 offsetFadeOut = new Vector2(0.5f, 0);
|
||||
public bool enableScaleFadeOut = false;
|
||||
[Tooltip("Scales out to this scale.")]
|
||||
public Vector2 scaleFadeOut = new Vector2(2, 2);
|
||||
public bool enableCrossScaleFadeOut = false;
|
||||
[Tooltip("Scales TextA out to this scale and TextB to the inverse of this scale.")]
|
||||
public Vector2 crossScaleFadeOut = new Vector2(1, 1.5f);
|
||||
public bool enableShakeFadeOut = false;
|
||||
[Tooltip("Shakes out to this offset.")]
|
||||
public Vector2 shakeOffsetFadeOut = new Vector2(0, 1.5f);
|
||||
[Tooltip("Shakes out at this frequency.")]
|
||||
public float shakeFrequencyFadeOut = 4f;
|
||||
|
||||
//Movement:
|
||||
public bool changeMovement = false;
|
||||
public bool enableLerp = true;
|
||||
public LerpSettings lerpSettings = new LerpSettings(0);
|
||||
public bool enableVelocity = false;
|
||||
public VelocitySettings velocitySettings = new VelocitySettings(0);
|
||||
public bool enableShaking = false;
|
||||
[Tooltip("Shake settings during idle.")]
|
||||
public ShakeSettings shakeSettings = new ShakeSettings(new Vector2(0.005f, 0.005f));
|
||||
public bool enableFollowing = false;
|
||||
public FollowSettings followSettings = new FollowSettings(0);
|
||||
|
||||
//Rotation:
|
||||
public bool changeRotation = false;
|
||||
public bool enableStartRotation = false;
|
||||
[Tooltip("The minimum z-angle for the random spawn rotation.")]
|
||||
public float minRotation = -4f;
|
||||
[Tooltip("The maximum z-angle for the random spawn rotation.")]
|
||||
public float maxRotation = 4f;
|
||||
public bool enableRotateOverTime = false;
|
||||
[Tooltip("The minimum rotation speed for the z-angle.")]
|
||||
public float minRotationSpeed = -15f;
|
||||
[Tooltip("The maximum rotation speed for the z-angle.")]
|
||||
public float maxRotationSpeed = 15;
|
||||
[Tooltip("Defines rotation speed over lifetime.")]
|
||||
public AnimationCurve rotateOverTime = new AnimationCurve(new Keyframe[] { new Keyframe(0, 1), new Keyframe(0.4f, 1), new Keyframe(0.8f, 0), new Keyframe(1, 0) });
|
||||
|
||||
//Scaling:
|
||||
public bool changeScaling = false;
|
||||
public bool enableScaleByNumber = false;
|
||||
public ScaleByNumberSettings scaleByNumberSettings = new ScaleByNumberSettings(0);
|
||||
public bool enableScaleOverTime = false;
|
||||
[Tooltip("Will scale over it's lifetime using this curve.")]
|
||||
public AnimationCurve scaleOverTime = new AnimationCurve(new Keyframe(0, 1), new Keyframe(1, 0.7f));
|
||||
|
||||
//Spam Control:
|
||||
public bool changeSpamControl = false;
|
||||
public string spamGroup = "";
|
||||
public bool enableCombination = false;
|
||||
public CombinationSettings combinationSettings = new CombinationSettings(0);
|
||||
public bool enableDestruction = false;
|
||||
public DestructionSettings destructionSettings = new DestructionSettings(0);
|
||||
public bool enableCollision = false;
|
||||
public CollisionSettings collisionSettings = new CollisionSettings(0);
|
||||
public bool enablePush = false;
|
||||
public PushSettings pushSettings = new PushSettings(0);
|
||||
|
||||
public bool IsApplied(DamageNumber dn)
|
||||
{
|
||||
TMP_Text[] textMeshs = dn.GetTextMeshs();
|
||||
|
||||
if (textMeshs[0] == null)
|
||||
{
|
||||
dn.GetReferencesIfNecessary();
|
||||
textMeshs = dn.GetTextMeshs();
|
||||
}
|
||||
|
||||
bool isApplied = true;
|
||||
|
||||
//Font:
|
||||
if (changeFontAsset)
|
||||
{
|
||||
foreach(TMP_Text tmp in textMeshs)
|
||||
{
|
||||
if (fontAsset != tmp.font)
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Color:
|
||||
if (changeColor)
|
||||
{
|
||||
foreach (TMP_Text tmp in textMeshs)
|
||||
{
|
||||
if (color != tmp.color || enableGradient != tmp.enableVertexGradient || !gradient.Equals(tmp.colorGradient))
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Number:
|
||||
if(changeNumber)
|
||||
{
|
||||
if(enableNumber != dn.enableNumber || !numberSettings.Equals(dn.numberSettings) || !digitSettings.Equals(dn.digitSettings))
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Left Text:
|
||||
if(changeLeftText)
|
||||
{
|
||||
if(enableLeftText != dn.enableLeftText || !leftTextSettings.Equals(dn.leftTextSettings) || leftText != dn.leftText)
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Right Text:
|
||||
if (changeRightText)
|
||||
{
|
||||
if (enableRightText != dn.enableRightText || !rightTextSettings.Equals(dn.rightTextSettings) || rightText != dn.rightText)
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Vertical Texts:
|
||||
if (hideVerticalTexts)
|
||||
{
|
||||
if(dn.enableTopText || dn.enableBottomText)
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Fade In:
|
||||
if(changeFadeIn)
|
||||
{
|
||||
if(durationFadeIn != dn.durationFadeIn || enableOffsetFadeIn != dn.enableOffsetFadeIn || offsetFadeIn != dn.offsetFadeIn ||
|
||||
enableScaleFadeIn != dn.enableScaleFadeIn || scaleFadeIn != dn.scaleFadeIn || enableCrossScaleFadeIn != dn.enableCrossScaleFadeIn ||
|
||||
crossScaleFadeIn != dn.crossScaleFadeIn || enableShakeFadeIn != dn.enableShakeFadeIn || shakeOffsetFadeIn != dn.shakeOffsetFadeIn ||
|
||||
shakeFrequencyFadeIn != dn.shakeFrequencyFadeIn)
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Fade Out:
|
||||
if (changeFadeOut)
|
||||
{
|
||||
if (durationFadeOut != dn.durationFadeOut || enableOffsetFadeOut != dn.enableOffsetFadeOut || offsetFadeOut != dn.offsetFadeOut ||
|
||||
enableScaleFadeOut != dn.enableScaleFadeOut || scaleFadeOut != dn.scaleFadeOut || enableCrossScaleFadeOut != dn.enableCrossScaleFadeOut ||
|
||||
crossScaleFadeOut != dn.crossScaleFadeOut || enableShakeFadeOut != dn.enableShakeFadeOut || shakeOffsetFadeOut != dn.shakeOffsetFadeOut ||
|
||||
shakeFrequencyFadeOut != dn.shakeFrequencyFadeOut)
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Movement:
|
||||
if(changeMovement)
|
||||
{
|
||||
if(enableLerp != dn.enableLerp || !lerpSettings.Equals(dn.lerpSettings) ||
|
||||
enableVelocity != dn.enableVelocity || !velocitySettings.Equals(dn.velocitySettings) ||
|
||||
enableShaking != dn.enableShaking || !shakeSettings.Equals(dn.shakeSettings) ||
|
||||
enableFollowing != dn.enableFollowing || !followSettings.Equals(dn.followSettings))
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Rotation:
|
||||
if(changeRotation)
|
||||
{
|
||||
if(enableStartRotation != dn.enableStartRotation || minRotation != dn.minRotation || maxRotation != dn.maxRotation ||
|
||||
enableRotateOverTime != dn.enableRotateOverTime || minRotationSpeed != dn.minRotationSpeed || maxRotationSpeed != dn.maxRotationSpeed || !rotateOverTime.Equals(dn.rotateOverTime))
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Scale:
|
||||
if(changeScaling)
|
||||
{
|
||||
if(enableScaleByNumber != dn.enableScaleByNumber || !scaleByNumberSettings.Equals(dn.scaleByNumberSettings) ||
|
||||
enableScaleOverTime != dn.enableScaleOverTime || !scaleOverTime.Equals(dn.scaleOverTime))
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Spam Group:
|
||||
if(changeSpamControl)
|
||||
{
|
||||
if(enableCombination != dn.enableCombination || !combinationSettings.Equals(dn.combinationSettings) ||
|
||||
enableDestruction != dn.enableDestruction || !destructionSettings.Equals(dn.destructionSettings) ||
|
||||
enableCollision != dn.enableCollision || !collisionSettings.Equals(dn.collisionSettings) ||
|
||||
enablePush != dn.enablePush || !pushSettings.Equals(dn.pushSettings))
|
||||
{
|
||||
isApplied = false;
|
||||
}
|
||||
}
|
||||
|
||||
return isApplied;
|
||||
}
|
||||
|
||||
public void Apply(DamageNumber dn)
|
||||
{
|
||||
TMP_Text[] textMeshs = dn.GetTextMeshs();
|
||||
|
||||
//Font:
|
||||
if (changeFontAsset)
|
||||
{
|
||||
foreach(TMP_Text tmp in textMeshs)
|
||||
{
|
||||
tmp.font = fontAsset;
|
||||
}
|
||||
}
|
||||
|
||||
//Color:
|
||||
if (changeColor)
|
||||
{
|
||||
foreach (TMP_Text tmp in textMeshs)
|
||||
{
|
||||
tmp.color = color;
|
||||
tmp.enableVertexGradient = enableGradient;
|
||||
tmp.colorGradient = gradient;
|
||||
}
|
||||
}
|
||||
|
||||
//Number:
|
||||
if (changeNumber)
|
||||
{
|
||||
dn.enableNumber = enableNumber;
|
||||
dn.numberSettings = numberSettings;
|
||||
dn.digitSettings = digitSettings;
|
||||
}
|
||||
|
||||
//Left Text:
|
||||
if (changeLeftText)
|
||||
{
|
||||
dn.enableLeftText = enableLeftText;
|
||||
dn.leftText = leftText;
|
||||
dn.leftTextSettings = leftTextSettings;
|
||||
}
|
||||
|
||||
//Right Text:
|
||||
if (changeRightText)
|
||||
{
|
||||
dn.enableRightText = enableRightText;
|
||||
dn.rightText = rightText;
|
||||
dn.rightTextSettings = rightTextSettings;
|
||||
}
|
||||
|
||||
//Hide Vertical Texts:
|
||||
if(hideVerticalTexts)
|
||||
{
|
||||
dn.enableTopText = dn.enableBottomText = false;
|
||||
}
|
||||
|
||||
//Fade In:
|
||||
if(changeFadeIn)
|
||||
{
|
||||
dn.durationFadeIn = durationFadeIn;
|
||||
dn.enableOffsetFadeIn = enableOffsetFadeIn;
|
||||
dn.offsetFadeIn = offsetFadeIn;
|
||||
dn.enableScaleFadeIn = enableScaleFadeIn;
|
||||
dn.scaleFadeIn = scaleFadeIn;
|
||||
dn.enableCrossScaleFadeIn = enableCrossScaleFadeIn;
|
||||
dn.crossScaleFadeIn = crossScaleFadeIn;
|
||||
dn.enableShakeFadeIn = enableShakeFadeIn;
|
||||
dn.shakeOffsetFadeIn = shakeOffsetFadeIn;
|
||||
dn.shakeFrequencyFadeIn = shakeFrequencyFadeIn;
|
||||
}
|
||||
|
||||
//Fade Out:
|
||||
if (changeFadeOut)
|
||||
{
|
||||
dn.durationFadeOut = durationFadeOut;
|
||||
dn.enableOffsetFadeOut = enableOffsetFadeOut;
|
||||
dn.offsetFadeOut = offsetFadeOut;
|
||||
dn.enableScaleFadeOut = enableScaleFadeOut;
|
||||
dn.scaleFadeOut = scaleFadeOut;
|
||||
dn.enableCrossScaleFadeOut = enableCrossScaleFadeOut;
|
||||
dn.crossScaleFadeOut = crossScaleFadeOut;
|
||||
dn.enableShakeFadeOut = enableShakeFadeOut;
|
||||
dn.shakeOffsetFadeOut = shakeOffsetFadeOut;
|
||||
dn.shakeFrequencyFadeOut = shakeFrequencyFadeOut;
|
||||
}
|
||||
|
||||
//Movement:
|
||||
if(changeMovement)
|
||||
{
|
||||
dn.enableLerp = enableLerp;
|
||||
dn.lerpSettings = lerpSettings;
|
||||
dn.enableVelocity = enableVelocity;
|
||||
dn.velocitySettings = velocitySettings;
|
||||
dn.enableShaking = enableShaking;
|
||||
dn.shakeSettings = shakeSettings;
|
||||
dn.enableFollowing = enableFollowing;
|
||||
dn.followSettings = followSettings;
|
||||
}
|
||||
|
||||
//Rotation:
|
||||
if(changeRotation)
|
||||
{
|
||||
dn.enableStartRotation = enableStartRotation;
|
||||
dn.minRotation = minRotation;
|
||||
dn.maxRotation = maxRotation;
|
||||
dn.enableRotateOverTime = enableRotateOverTime;
|
||||
dn.minRotationSpeed = minRotationSpeed;
|
||||
dn.maxRotationSpeed = maxRotationSpeed;
|
||||
dn.rotateOverTime = rotateOverTime;
|
||||
}
|
||||
|
||||
//Scale:
|
||||
if(changeScaling)
|
||||
{
|
||||
dn.enableScaleByNumber = enableScaleByNumber;
|
||||
dn.scaleByNumberSettings = scaleByNumberSettings;
|
||||
dn.enableScaleOverTime = enableScaleOverTime;
|
||||
dn.scaleOverTime = scaleOverTime;
|
||||
}
|
||||
|
||||
//Spam Control:
|
||||
if(changeSpamControl)
|
||||
{
|
||||
if(dn.spamGroup == null || dn.spamGroup == "")
|
||||
{
|
||||
dn.spamGroup = spamGroup;
|
||||
}
|
||||
|
||||
dn.enableCombination = enableCombination;
|
||||
dn.combinationSettings = combinationSettings;
|
||||
dn.enableDestruction = enableDestruction;
|
||||
dn.destructionSettings = destructionSettings;
|
||||
dn.enableCollision = enableCollision;
|
||||
dn.collisionSettings = collisionSettings;
|
||||
dn.enablePush = enablePush;
|
||||
dn.pushSettings = pushSettings;
|
||||
}
|
||||
}
|
||||
|
||||
public void Get(DamageNumber dn)
|
||||
{
|
||||
TMP_Text[] textMeshs = dn.GetTextMeshs();
|
||||
|
||||
//Font:
|
||||
changeFontAsset = true;
|
||||
foreach (TMP_Text tmp in textMeshs)
|
||||
{
|
||||
if(tmp != null)
|
||||
{
|
||||
fontAsset = tmp.font;
|
||||
}
|
||||
}
|
||||
|
||||
//Color:
|
||||
changeColor = true;
|
||||
foreach (TMP_Text tmp in textMeshs)
|
||||
{
|
||||
if(tmp != null)
|
||||
{
|
||||
color = tmp.color;
|
||||
enableGradient = tmp.enableVertexGradient;
|
||||
gradient = tmp.colorGradient;
|
||||
}
|
||||
}
|
||||
|
||||
//Fade In:
|
||||
changeFadeIn = true;
|
||||
durationFadeIn = dn.durationFadeIn;
|
||||
enableOffsetFadeIn = dn.enableOffsetFadeIn;
|
||||
offsetFadeIn = dn.offsetFadeIn;
|
||||
enableScaleFadeIn = dn.enableScaleFadeIn;
|
||||
scaleFadeIn = dn.scaleFadeIn;
|
||||
enableCrossScaleFadeIn = dn.enableCrossScaleFadeIn;
|
||||
crossScaleFadeIn = dn.crossScaleFadeIn;
|
||||
enableShakeFadeIn = dn.enableShakeFadeIn;
|
||||
shakeOffsetFadeIn = dn.shakeOffsetFadeIn;
|
||||
shakeFrequencyFadeIn = dn.shakeFrequencyFadeIn;
|
||||
|
||||
//Fade Out:
|
||||
changeFadeOut = true;
|
||||
durationFadeOut = dn.durationFadeOut;
|
||||
enableOffsetFadeOut = dn.enableOffsetFadeOut;
|
||||
offsetFadeOut = dn.offsetFadeOut;
|
||||
enableScaleFadeOut = dn.enableScaleFadeOut;
|
||||
scaleFadeOut = dn.scaleFadeOut;
|
||||
enableCrossScaleFadeOut = dn.enableCrossScaleFadeOut;
|
||||
crossScaleFadeOut = dn.crossScaleFadeOut;
|
||||
enableShakeFadeOut = dn.enableShakeFadeOut;
|
||||
shakeOffsetFadeOut = dn.shakeOffsetFadeOut;
|
||||
shakeFrequencyFadeOut = dn.shakeFrequencyFadeOut;
|
||||
|
||||
//Movement:
|
||||
changeMovement = true;
|
||||
enableLerp = dn.enableLerp;
|
||||
lerpSettings = dn.lerpSettings;
|
||||
enableVelocity = dn.enableVelocity;
|
||||
velocitySettings = dn.velocitySettings;
|
||||
enableShaking = dn.enableShaking;
|
||||
shakeSettings = dn.shakeSettings;
|
||||
enableFollowing = dn.enableFollowing;
|
||||
followSettings = dn.followSettings;
|
||||
|
||||
//Rotation:
|
||||
changeRotation = true;
|
||||
enableStartRotation = dn.enableStartRotation;
|
||||
minRotation = dn.minRotation;
|
||||
maxRotation = dn.maxRotation;
|
||||
enableRotateOverTime = dn.enableRotateOverTime;
|
||||
minRotationSpeed = dn.minRotationSpeed;
|
||||
maxRotationSpeed = dn.maxRotationSpeed;
|
||||
rotateOverTime = dn.rotateOverTime;
|
||||
|
||||
//Scale:
|
||||
changeScaling = true;
|
||||
enableScaleByNumber = dn.enableScaleByNumber;
|
||||
scaleByNumberSettings = dn.scaleByNumberSettings;
|
||||
enableScaleOverTime = dn.enableScaleOverTime;
|
||||
scaleOverTime = dn.scaleOverTime;
|
||||
|
||||
//Spam Group:
|
||||
changeSpamControl = true;
|
||||
spamGroup = dn.spamGroup != "" ? "Default" : "";
|
||||
enableCombination = dn.enableCombination;
|
||||
combinationSettings = dn.combinationSettings;
|
||||
enableDestruction = dn.enableDestruction;
|
||||
destructionSettings = dn.destructionSettings;
|
||||
enableCollision = dn.enableCollision;
|
||||
collisionSettings = dn.collisionSettings;
|
||||
enablePush = dn.enablePush;
|
||||
pushSettings = dn.pushSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/DamageNumbersPro/Scripts/Internal/DNPPreset.cs.meta
Normal file
11
Assets/DamageNumbersPro/Scripts/Internal/DNPPreset.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d57d6f502e7c30a4ca03abf7f4c97bbc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/DamageNumbersPro/Scripts/Internal/DNPType.cs
Normal file
12
Assets/DamageNumbersPro/Scripts/Internal/DNPType.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public enum DNPType
|
||||
{
|
||||
All
|
||||
,
|
||||
Mesh
|
||||
,
|
||||
GUI
|
||||
}
|
||||
11
Assets/DamageNumbersPro/Scripts/Internal/DNPType.cs.meta
Normal file
11
Assets/DamageNumbersPro/Scripts/Internal/DNPType.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fae86257cb5b74d498f64e6825132b12
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
141
Assets/DamageNumbersPro/Scripts/Internal/DNPUpdater.cs
Normal file
141
Assets/DamageNumbersPro/Scripts/Internal/DNPUpdater.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using DamageNumbersPro;
|
||||
|
||||
namespace DamageNumbersPro.Internal
|
||||
{
|
||||
public class DNPUpdater : MonoBehaviour
|
||||
{
|
||||
//Dicitonary:
|
||||
static Dictionary<float, DNPUpdater> unscaledUpdaters;
|
||||
static Dictionary<float, DNPUpdater> scaledUpdaters;
|
||||
|
||||
//Static:
|
||||
public static Vector3 upVector;
|
||||
public static Vector3 rightVector;
|
||||
public static bool vectorsNeedUpdate;
|
||||
public static Quaternion cameraRotation;
|
||||
|
||||
//Settings:
|
||||
public bool isUnscaled = false;
|
||||
public float updateDelay = 0.0125f;
|
||||
public HashSet<DamageNumber> activePopups;
|
||||
public HashSet<DamageNumber> removedPopups;
|
||||
|
||||
//Internal:
|
||||
float lastUpdateTime = 0;
|
||||
float delta = 0;
|
||||
float time = 0;
|
||||
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(UpdatePopups());
|
||||
}
|
||||
|
||||
IEnumerator UpdatePopups()
|
||||
{
|
||||
//Delay:
|
||||
WaitForSecondsRealtime delay = new WaitForSecondsRealtime(updateDelay);
|
||||
|
||||
while(true)
|
||||
{
|
||||
//Vector Update:
|
||||
vectorsNeedUpdate = true;
|
||||
|
||||
//Update:
|
||||
foreach (DamageNumber popup in activePopups)
|
||||
{
|
||||
if(popup != null)
|
||||
{
|
||||
popup.UpdateDamageNumber(delta, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
removedPopups.Add(popup);
|
||||
}
|
||||
}
|
||||
|
||||
//Clean Up:
|
||||
if(removedPopups.Count > 0)
|
||||
{
|
||||
foreach (DamageNumber removed in removedPopups)
|
||||
{
|
||||
activePopups.Remove(removed);
|
||||
}
|
||||
removedPopups = new HashSet<DamageNumber>();
|
||||
}
|
||||
|
||||
//Wait:
|
||||
if (isUnscaled)
|
||||
{
|
||||
lastUpdateTime = Time.unscaledTime;
|
||||
yield return delay;
|
||||
time = Time.unscaledTime;
|
||||
delta = time - lastUpdateTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastUpdateTime = Time.time;
|
||||
yield return delay;
|
||||
time = Time.time;
|
||||
delta = time - lastUpdateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RegisterPopup(bool unscaledTime, float updateDelay, DamageNumber popup)
|
||||
{
|
||||
ref Dictionary<float, DNPUpdater> updaters = ref unscaledTime ? ref unscaledUpdaters : ref scaledUpdaters;
|
||||
|
||||
if (updaters == null)
|
||||
{
|
||||
updaters = new Dictionary<float, DNPUpdater>();
|
||||
}
|
||||
|
||||
bool containsKey = updaters.ContainsKey(updateDelay);
|
||||
if (containsKey && updaters[updateDelay] != null)
|
||||
{
|
||||
updaters[updateDelay].activePopups.Add(popup);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(containsKey)
|
||||
{
|
||||
updaters.Remove(updateDelay);
|
||||
}
|
||||
|
||||
GameObject newUpdater = new GameObject("");
|
||||
newUpdater.hideFlags = HideFlags.HideInHierarchy;
|
||||
|
||||
DNPUpdater dnpUpdater = newUpdater.AddComponent<DNPUpdater>();
|
||||
dnpUpdater.activePopups = new HashSet<DamageNumber>();
|
||||
dnpUpdater.removedPopups = new HashSet<DamageNumber>();
|
||||
dnpUpdater.isUnscaled = unscaledTime;
|
||||
dnpUpdater.updateDelay = updateDelay;
|
||||
DontDestroyOnLoad(newUpdater);
|
||||
|
||||
updaters.Add(updateDelay, dnpUpdater);
|
||||
|
||||
dnpUpdater.activePopups.Add(popup);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnregisterPopup(bool unscaledTime, float updateDelay, DamageNumber popup)
|
||||
{
|
||||
Dictionary<float, DNPUpdater> updaters = unscaledTime ? unscaledUpdaters : scaledUpdaters;
|
||||
|
||||
if (updaters != null && updaters.ContainsKey(updateDelay) && updaters[updateDelay].activePopups.Contains(popup))
|
||||
{
|
||||
updaters[updateDelay].removedPopups.Add(popup);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateVectors(Transform popup)
|
||||
{
|
||||
vectorsNeedUpdate = false;
|
||||
upVector = popup.up;
|
||||
rightVector = popup.right;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/DamageNumbersPro/Scripts/Internal/DNPUpdater.cs.meta
Normal file
11
Assets/DamageNumbersPro/Scripts/Internal/DNPUpdater.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70295d7c27ed57f429198ae6c41fd45f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 526
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2908
Assets/DamageNumbersPro/Scripts/Internal/DamageNumber.cs
Normal file
2908
Assets/DamageNumbersPro/Scripts/Internal/DamageNumber.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb457e4f4b6f37c4ba7cbb64769f967e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 520
|
||||
icon: {fileID: 2800000, guid: 47a7c3a675ab92247b88f6f2978ea88d, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/DamageNumbersPro/Scripts/Internal/Editor.meta
Normal file
8
Assets/DamageNumbersPro/Scripts/Internal/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 922277e9523a7064c959ec3b68e0d55f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1366
Assets/DamageNumbersPro/Scripts/Internal/Editor/DNPEditorInternal.cs
Normal file
1366
Assets/DamageNumbersPro/Scripts/Internal/Editor/DNPEditorInternal.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 945de8189a19b914f8d54c4af7ea2187
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,89 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace DamageNumbersPro.Internal
|
||||
{
|
||||
[CustomEditor(typeof(DNPPreset))]
|
||||
public class DNPPresetEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
//Prepare:
|
||||
GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
|
||||
labelStyle.richText = true;
|
||||
|
||||
|
||||
//Copying:
|
||||
EditorGUILayout.Space(4);
|
||||
DamageNumber dn = (DamageNumber) EditorGUILayout.ObjectField(null, typeof(DamageNumber), true,GUILayout.Height(80));
|
||||
GUIStyle dropStyle = new GUIStyle(GUI.skin.box);
|
||||
dropStyle.alignment = TextAnchor.MiddleCenter;
|
||||
Rect lastRect = GUILayoutUtility.GetLastRect();
|
||||
GUI.Box(lastRect, "Drop damage number here.", dropStyle);
|
||||
if(dn != null)
|
||||
{
|
||||
DNPPreset preset = (DNPPreset)target;
|
||||
Undo.RegisterCompleteObjectUndo(preset, "Copied damage number.");
|
||||
preset.Get(dn);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
|
||||
//Get First Property:
|
||||
SerializedProperty currentProperty = serializedObject.FindProperty("changeFontAsset");
|
||||
|
||||
//Display Properties:
|
||||
EditorGUILayout.BeginVertical();
|
||||
bool visible = true;
|
||||
do
|
||||
{
|
||||
bool isNewCategory = currentProperty.name.StartsWith("change") || currentProperty.name == "hideVerticalTexts";
|
||||
if (isNewCategory)
|
||||
{
|
||||
visible = true;
|
||||
EditorGUILayout.EndVertical();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.BeginVertical("Helpbox");
|
||||
}
|
||||
|
||||
if(visible)
|
||||
{
|
||||
if(isNewCategory)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel("<size=14><b>" + currentProperty.displayName + "</b></size>", labelStyle);
|
||||
EditorGUILayout.PropertyField(currentProperty, GUIContent.none, true);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(currentProperty, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (isNewCategory)
|
||||
{
|
||||
visible = currentProperty.boolValue;
|
||||
|
||||
if(visible && currentProperty.name.StartsWith("change"))
|
||||
{
|
||||
DNPEditorInternal.Lines();
|
||||
}
|
||||
}
|
||||
|
||||
} while (currentProperty.NextVisible(false));
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
//Save Changes:
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c55b1576eec682446928e58fab62ee59
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 668f6245f82e2b8428228e6bf559c394
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/DamageNumbersPro/Scripts/Settings.meta
Normal file
8
Assets/DamageNumbersPro/Scripts/Settings.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 103eaec301d5d8644b3f7ca7285b2949
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct CollisionSettings
|
||||
{
|
||||
public CollisionSettings(float customDefault)
|
||||
{
|
||||
radius = 0.5f;
|
||||
pushFactor = 1f;
|
||||
|
||||
desiredDirection = new Vector3(0, 0);
|
||||
}
|
||||
|
||||
[Header("Main:")]
|
||||
public float radius;
|
||||
public float pushFactor;
|
||||
|
||||
[Header("Direction:")]
|
||||
public Vector3 desiredDirection;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f06cc1d4b3c9200429bfa12351da082e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct ColorByNumberSettings
|
||||
{
|
||||
public ColorByNumberSettings(float customValue)
|
||||
{
|
||||
colorGradient = new Gradient();
|
||||
colorGradient.SetKeys(new GradientColorKey[] { new GradientColorKey(new Color(1f, 0.8f, 0.5f), 0f), new GradientColorKey(new Color(1f, 0f, 0f), 1f) }, new GradientAlphaKey[] { new GradientAlphaKey(1, 0) });
|
||||
|
||||
fromNumber = 10;
|
||||
toNumber = 100;
|
||||
}
|
||||
|
||||
public Gradient colorGradient;
|
||||
public float fromNumber;
|
||||
public float toNumber;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1aa45ee916e53dd41bde21255c7b14dd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct CombinationSettings
|
||||
{
|
||||
public CombinationSettings(float customDefault)
|
||||
{
|
||||
method = CombinationMethod.ABSORB_NEW;
|
||||
maxDistance = 10f;
|
||||
|
||||
bonusLifetime = 1f;
|
||||
spawnDelay = 0.2f;
|
||||
|
||||
absorbDuration = 0.4f;
|
||||
scaleCurve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(0.7f, 1), new Keyframe(1f, 0f));
|
||||
alphaCurve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(0.5f, 1), new Keyframe(1f, 0));
|
||||
|
||||
moveToAbsorber = true;
|
||||
teleportToAbsorber = false;
|
||||
instantGain = false;
|
||||
|
||||
absorberScaleFactor = 1.5f;
|
||||
absorberScaleFade = 15;
|
||||
}
|
||||
|
||||
[Header("Main:")]
|
||||
[Tooltip("ABSORB_NEW: Oldest damage number absorbs newer damage numbers.\n\nREPLACE_OLD: New damage numbers absorb all existing damage numbers.\n\nIS_ALWAYS_ABSORBER: Will absorb all IS_ALWAYS_VICTIM damage numbers.\n\nIS_ALWAYS_VICTIM: Will be absorbed by the closest IS_ALWAYS_ABSORBER damage number.")]
|
||||
public CombinationMethod method;
|
||||
[Tooltip("The maximum distance at which numbers will combine.")]
|
||||
public float maxDistance;
|
||||
[Tooltip("The absorbtion delay after spawning.")]
|
||||
public float spawnDelay;
|
||||
|
||||
[Header("Animation:")]
|
||||
[Tooltip("The length of the absorb animation.")]
|
||||
public float absorbDuration;
|
||||
[Tooltip("The scale over the absorb duration.")]
|
||||
public AnimationCurve scaleCurve;
|
||||
[Tooltip("The alpha over the absorb duration.")]
|
||||
public AnimationCurve alphaCurve;
|
||||
[Tooltip("If enabled the damage number will move towards it's absorber.")]
|
||||
public bool moveToAbsorber;
|
||||
[Tooltip("If enabled the damage number will teleport (spawn) inside it's absorber.")]
|
||||
public bool teleportToAbsorber;
|
||||
[Tooltip("How much the absorber is scaled up when it absorbs a damage number.")]
|
||||
public float absorberScaleFactor;
|
||||
[Tooltip("How quickly the absorber scales back to it's original size after being scaled up.")]
|
||||
public float absorberScaleFade;
|
||||
|
||||
[Header("Other:")]
|
||||
[Tooltip("If true, the absorber will instantly gain the numbers of the target. Should be used when combination is very fast.")]
|
||||
public bool instantGain;
|
||||
[Tooltip("The lifetime of the absorber is reset but also increased by this bonus lifetime.")]
|
||||
public float bonusLifetime;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public enum CombinationMethod
|
||||
{
|
||||
ABSORB_NEW
|
||||
,
|
||||
REPLACE_OLD
|
||||
,
|
||||
IS_ALWAYS_ABSORBER
|
||||
,
|
||||
IS_ALWAYS_VICTIM
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25338eab2ddfa234da6380e8d4f38326
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct DestructionSettings
|
||||
{
|
||||
public DestructionSettings(float customDefault)
|
||||
{
|
||||
maxDistance = 2f;
|
||||
spawnDelay = 0.2f;
|
||||
|
||||
duration = 0.3f;
|
||||
scaleCurve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(1, 0.5f));
|
||||
alphaCurve = new AnimationCurve(new Keyframe(0, 1), new Keyframe(1, 0));
|
||||
}
|
||||
|
||||
[Header("Main:")]
|
||||
[Tooltip("The maximum distance at which damage numbers will be destroyed.")]
|
||||
public float maxDistance;
|
||||
[Tooltip("The delay after spawning that numbers will be destroyed.")]
|
||||
public float spawnDelay;
|
||||
|
||||
[Header("Animation:")]
|
||||
public float duration;
|
||||
[Tooltip("The scale over the destruction duration.")]
|
||||
public AnimationCurve scaleCurve;
|
||||
[Tooltip("The alpha over the destruction duration.")]
|
||||
public AnimationCurve alphaCurve;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5743aaa6eccf6e41ad6473781df80b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
53
Assets/DamageNumbersPro/Scripts/Settings/DigitSettings.cs
Normal file
53
Assets/DamageNumbersPro/Scripts/Settings/DigitSettings.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct DigitSettings
|
||||
{
|
||||
public DigitSettings(float customDefault)
|
||||
{
|
||||
decimals = 0;
|
||||
decimalChar = ".";
|
||||
hideZeros = false;
|
||||
|
||||
dotSeparation = false;
|
||||
dotDistance = 3;
|
||||
dotChar = ".";
|
||||
|
||||
suffixShorten = false;
|
||||
suffixes = new List<string>() { "K", "M", "B" };
|
||||
suffixDigits = new List<int>() { 3, 3, 3 };
|
||||
maxDigits = 4;
|
||||
}
|
||||
|
||||
[Header("Decimals:")]
|
||||
[Range(0,3)]
|
||||
[Tooltip("Amount of digits visible after the dot.")]
|
||||
public int decimals;
|
||||
[Tooltip("The character used for the dot.")]
|
||||
public string decimalChar;
|
||||
[Tooltip("If true zeros at the end of the number will be hidden.")]
|
||||
public bool hideZeros;
|
||||
|
||||
[Header("Dots:")]
|
||||
[Tooltip("Separates the number with dots.")]
|
||||
public bool dotSeparation;
|
||||
[Tooltip("Amount of digits between each dot.")]
|
||||
public int dotDistance;
|
||||
[Tooltip("The character used for the dot.")]
|
||||
public string dotChar;
|
||||
|
||||
[Header("Suffix Shorten:")]
|
||||
[Tooltip("Shortens a number like 10000 to 10K.")]
|
||||
public bool suffixShorten;
|
||||
[Tooltip("List of suffixes.")]
|
||||
public List<string> suffixes;
|
||||
[Tooltip("Corresponding list of how many digits a suffix shortens. Keep both lists at the same size.")]
|
||||
public List<int> suffixDigits;
|
||||
[Tooltip("Maximum of visible digits. If number has more digits than this it will be shortened.")]
|
||||
public int maxDigits;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94ac3ebee71988a45a19cdef332a0c01
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct DistanceScalingSettings
|
||||
{
|
||||
public DistanceScalingSettings (float customDefault)
|
||||
{
|
||||
baseDistance = 15f;
|
||||
closeDistance = 5f;
|
||||
farDistance = 50f;
|
||||
|
||||
closeScale = 2f;
|
||||
farScale = 0.5f;
|
||||
}
|
||||
|
||||
[Header("Distances:")]
|
||||
[Tooltip("The consistent size of the number is based on this distance.")]
|
||||
public float baseDistance;
|
||||
[Tooltip("The closest distance the number will be scaling up to.")]
|
||||
public float closeDistance;
|
||||
[Tooltip("The farthest distance the number will be scaling down to.")]
|
||||
public float farDistance;
|
||||
|
||||
[Header("Scales:")]
|
||||
[Tooltip("The max scale the number reaches at the closest distance.")]
|
||||
public float closeScale;
|
||||
[Tooltip("The min scale the number reaches at the farthest distance.")]
|
||||
public float farScale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8feb521dcedd714fb553f36d8ce58b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
Assets/DamageNumbersPro/Scripts/Settings/FollowSettings.cs
Normal file
21
Assets/DamageNumbersPro/Scripts/Settings/FollowSettings.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct FollowSettings
|
||||
{
|
||||
public FollowSettings(float customDefault)
|
||||
{
|
||||
speed = 10;
|
||||
drag = 0f;
|
||||
}
|
||||
|
||||
[Tooltip("Speed at which target is followed.")]
|
||||
public float speed;
|
||||
[Tooltip("Decreases follow speed over time.")]
|
||||
public float drag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be2429837e46598448fc6ce1739b4082
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/DamageNumbersPro/Scripts/Settings/LerpSettings.cs
Normal file
40
Assets/DamageNumbersPro/Scripts/Settings/LerpSettings.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct LerpSettings
|
||||
{
|
||||
public LerpSettings (int customDefault)
|
||||
{
|
||||
minX = -0.4f;
|
||||
maxX = 0.4f;
|
||||
minY = 0.5f;
|
||||
maxY = 1f;
|
||||
|
||||
speed = 5f;
|
||||
|
||||
randomFlip = false;
|
||||
}
|
||||
|
||||
[Header("Speed:")]
|
||||
[Tooltip("Speed at which it moves to the offset position.")]
|
||||
public float speed;
|
||||
|
||||
[Header("Offset:")]
|
||||
[Tooltip("Minimum of horizontal offset.")]
|
||||
public float minX;
|
||||
[Tooltip("Maximum of horizontal offset.")]
|
||||
public float maxX;
|
||||
[Tooltip("Minimum of vertical offset.")]
|
||||
public float minY;
|
||||
[Tooltip("Maximum of vertical offset.")]
|
||||
public float maxY;
|
||||
|
||||
[Header("Horizontal Flip:")]
|
||||
[Tooltip("Randomly flips the X Offset.\nUseful for avoiding small movements.\nSet Min X and Max X to a positive value.")]
|
||||
public bool randomFlip;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3467302984b8b07408f6ef0ff44f82aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/DamageNumbersPro/Scripts/Settings/PushSettings.cs
Normal file
20
Assets/DamageNumbersPro/Scripts/Settings/PushSettings.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct PushSettings
|
||||
{
|
||||
public PushSettings(float customDefault)
|
||||
{
|
||||
radius = 4f;
|
||||
pushOffset = 0.8f;
|
||||
}
|
||||
|
||||
[Header("Main:")]
|
||||
public float radius;
|
||||
public float pushOffset;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd1255669b0b7134dad1cd3c2851f27b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct ScaleByNumberSettings
|
||||
{
|
||||
public ScaleByNumberSettings(float customDefault)
|
||||
{
|
||||
fromNumber = 0f;
|
||||
fromScale = 1f;
|
||||
|
||||
toNumber = 1000f;
|
||||
toScale = 2f;
|
||||
}
|
||||
|
||||
[Header("Number Range:")]
|
||||
[Tooltip("The number at which scaling starts.")]
|
||||
public float fromNumber;
|
||||
[Tooltip("The number at which scaling caps.")]
|
||||
public float toNumber;
|
||||
|
||||
[Header("Scale Range:")]
|
||||
[Tooltip("The scale when the number is smaller of equal 'From Number'.")]
|
||||
public float fromScale;
|
||||
[Tooltip("The scale when the number is bigger of equal 'To Number'.")]
|
||||
public float toScale;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25ca6c9756a39e94bb4e5381bbd5b786
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/DamageNumbersPro/Scripts/Settings/ShakeSettings.cs
Normal file
22
Assets/DamageNumbersPro/Scripts/Settings/ShakeSettings.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct ShakeSettings
|
||||
{
|
||||
public ShakeSettings(Vector2 customDefault)
|
||||
{
|
||||
offset = customDefault;
|
||||
frequency = 50f;
|
||||
}
|
||||
|
||||
[Tooltip("Moves back and fourth from negative offset to positive offset.")]
|
||||
public Vector2 offset;
|
||||
[Tooltip("Changes the speed at which the number moves back and fourth.\nUsed in a sinus function.")]
|
||||
public float frequency;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ba13446d4819874a91988b6f9d4acc8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Assets/DamageNumbersPro/Scripts/Settings/TextSettings.cs
Normal file
68
Assets/DamageNumbersPro/Scripts/Settings/TextSettings.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro {
|
||||
[System.Serializable]
|
||||
public struct TextSettings
|
||||
{
|
||||
public TextSettings(float customDefault)
|
||||
{
|
||||
horizontal = customDefault;
|
||||
|
||||
customColor = false;
|
||||
color = new Color(1, 1, 0f, 1);
|
||||
|
||||
size = 0;
|
||||
vertical = 0;
|
||||
characterSpacing = 0f;
|
||||
|
||||
alpha = 1;
|
||||
|
||||
mark = false;
|
||||
markColor = new Color(0, 0, 0, 0.5f);
|
||||
|
||||
bold = false;
|
||||
italic = false;
|
||||
underline = false;
|
||||
strike = false;
|
||||
}
|
||||
|
||||
[Header("Basics:")]
|
||||
[Tooltip("Makes the text bold.")]
|
||||
public bool bold;
|
||||
[Tooltip("Makes the text italic.")]
|
||||
public bool italic;
|
||||
[Tooltip("Adds an underline to the text.")]
|
||||
public bool underline;
|
||||
[Tooltip("Strikes through the text with a line.")]
|
||||
public bool strike;
|
||||
|
||||
[Header("Alpha:")]
|
||||
[Range(0, 1)]
|
||||
[Tooltip("Changes the alpha of the text.\nWon't work if Custom Color is used.")]
|
||||
public float alpha;
|
||||
|
||||
[Header("Color:")]
|
||||
[Tooltip("Changes the color of the text.\nOverrides the alpha option above.")]
|
||||
public bool customColor;
|
||||
public Color color;
|
||||
|
||||
[Header("Mark:")]
|
||||
[Tooltip("Highlights the text with a custom color.")]
|
||||
public bool mark;
|
||||
public Color markColor;
|
||||
|
||||
[Header("Offset:")]
|
||||
[Tooltip("Horizontally moves the text.\nCan be used to offset the prefix or suffix.")]
|
||||
public float horizontal;
|
||||
[Tooltip("Vertically moves the text.\nCan be used to offset the prefix or suffix.")]
|
||||
public float vertical;
|
||||
|
||||
[Header("Extra:")]
|
||||
[Tooltip("Changes the character spacing.")]
|
||||
public float characterSpacing;
|
||||
[Tooltip("Changes the font size.")]
|
||||
public float size;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32481eb77457b05468a3608bb6be640e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
Assets/DamageNumbersPro/Scripts/Settings/VelocitySettings.cs
Normal file
48
Assets/DamageNumbersPro/Scripts/Settings/VelocitySettings.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DamageNumbersPro
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct VelocitySettings
|
||||
{
|
||||
public VelocitySettings(float customDefault)
|
||||
{
|
||||
minX = -1f;
|
||||
maxX = 1f;
|
||||
minY = 4f;
|
||||
maxY = 5f;
|
||||
|
||||
randomFlip = false;
|
||||
|
||||
dragX = 0.1f;
|
||||
dragY = 1f;
|
||||
gravity = 3f;
|
||||
}
|
||||
|
||||
[Header("Velocity:")]
|
||||
[Tooltip("Minimum of horizontal velocity.")]
|
||||
public float minX;
|
||||
[Tooltip("Maximum of horizontal velocity.")]
|
||||
public float maxX;
|
||||
[Tooltip("Minimum of vertical velocity.")]
|
||||
public float minY;
|
||||
[Tooltip("Maximum of vertical velocity.")]
|
||||
public float maxY;
|
||||
|
||||
[Header("Horizontal Flip:")]
|
||||
[Tooltip("Randomly flips the X Velocity.\nUseful for avoiding small movements.\nSet Min X and Max X to a positive value.")]
|
||||
public bool randomFlip;
|
||||
|
||||
[Header("Drag:")]
|
||||
[Tooltip("Reduces horizontal velocity over time.")]
|
||||
public float dragX;
|
||||
[Tooltip("Reduces vertical velocity over time.")]
|
||||
public float dragY;
|
||||
|
||||
[Header("Gravity:")]
|
||||
[Tooltip("Increases vertical velocity downwards.")]
|
||||
public float gravity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0a37e0a6a4d6724c97cda019c7da794
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user