summaryrefslogtreecommitdiff
path: root/Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/Benchmark02.cs
diff options
context:
space:
mode:
authordereelatwit <54997325+dereelatwit@users.noreply.github.com>2023-08-03 14:05:08 -0400
committerdereelatwit <54997325+dereelatwit@users.noreply.github.com>2023-08-03 14:05:08 -0400
commitb8aa2e0935f309b112648f0352f35f5f33da946b (patch)
tree9121ae1a65e483dddba8367cbbdd4991abfb3e26 /Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/Benchmark02.cs
parent374125ba34e0366afb062578906877cfdf229bb9 (diff)
started implementing UI
Diffstat (limited to 'Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/Benchmark02.cs')
-rw-r--r--Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/Benchmark02.cs97
1 files changed, 97 insertions, 0 deletions
diff --git a/Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/Benchmark02.cs b/Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/Benchmark02.cs
new file mode 100644
index 0000000..29d75b6
--- /dev/null
+++ b/Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/Benchmark02.cs
@@ -0,0 +1,97 @@
+using UnityEngine;
+using System.Collections;
+
+
+namespace TMPro.Examples
+{
+
+ public class Benchmark02 : MonoBehaviour
+ {
+
+ public int SpawnType = 0;
+ public int NumberOfNPC = 12;
+
+ public bool IsTextObjectScaleStatic;
+ private TextMeshProFloatingText floatingText_Script;
+
+
+ void Start()
+ {
+
+ for (int i = 0; i < NumberOfNPC; i++)
+ {
+
+
+ if (SpawnType == 0)
+ {
+ // TextMesh Pro Implementation
+ GameObject go = new GameObject();
+ go.transform.position = new Vector3(Random.Range(-95f, 95f), 0.25f, Random.Range(-95f, 95f));
+
+ TextMeshPro textMeshPro = go.AddComponent<TextMeshPro>();
+
+ textMeshPro.autoSizeTextContainer = true;
+ textMeshPro.rectTransform.pivot = new Vector2(0.5f, 0);
+
+ textMeshPro.alignment = TextAlignmentOptions.Bottom;
+ textMeshPro.fontSize = 96;
+ textMeshPro.enableKerning = false;
+
+ textMeshPro.color = new Color32(255, 255, 0, 255);
+ textMeshPro.text = "!";
+ textMeshPro.isTextObjectScaleStatic = IsTextObjectScaleStatic;
+
+ // Spawn Floating Text
+ floatingText_Script = go.AddComponent<TextMeshProFloatingText>();
+ floatingText_Script.SpawnType = 0;
+ floatingText_Script.IsTextObjectScaleStatic = IsTextObjectScaleStatic;
+ }
+ else if (SpawnType == 1)
+ {
+ // TextMesh Implementation
+ GameObject go = new GameObject();
+ go.transform.position = new Vector3(Random.Range(-95f, 95f), 0.25f, Random.Range(-95f, 95f));
+
+ TextMesh textMesh = go.AddComponent<TextMesh>();
+ textMesh.font = Resources.Load<Font>("Fonts/ARIAL");
+ textMesh.GetComponent<Renderer>().sharedMaterial = textMesh.font.material;
+
+ textMesh.anchor = TextAnchor.LowerCenter;
+ textMesh.fontSize = 96;
+
+ textMesh.color = new Color32(255, 255, 0, 255);
+ textMesh.text = "!";
+
+ // Spawn Floating Text
+ floatingText_Script = go.AddComponent<TextMeshProFloatingText>();
+ floatingText_Script.SpawnType = 1;
+ }
+ else if (SpawnType == 2)
+ {
+ // Canvas WorldSpace Camera
+ GameObject go = new GameObject();
+ Canvas canvas = go.AddComponent<Canvas>();
+ canvas.worldCamera = Camera.main;
+
+ go.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
+ go.transform.position = new Vector3(Random.Range(-95f, 95f), 5f, Random.Range(-95f, 95f));
+
+ TextMeshProUGUI textObject = new GameObject().AddComponent<TextMeshProUGUI>();
+ textObject.rectTransform.SetParent(go.transform, false);
+
+ textObject.color = new Color32(255, 255, 0, 255);
+ textObject.alignment = TextAlignmentOptions.Bottom;
+ textObject.fontSize = 96;
+ textObject.text = "!";
+
+ // Spawn Floating Text
+ floatingText_Script = go.AddComponent<TextMeshProFloatingText>();
+ floatingText_Script.SpawnType = 0;
+ }
+
+
+
+ }
+ }
+ }
+}