2026-04-27 BGM 및 이스터에그
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TinyGiantStudio.Text.Example
|
||||
{
|
||||
public class Countdown : MonoBehaviour
|
||||
{
|
||||
[SerializeField] bool startCountdownOnStart = true;
|
||||
[Space]
|
||||
[SerializeField] Modular3DText modular3DText = null;
|
||||
[Space]
|
||||
[SerializeField] string textAfterCountdownEnds = "";
|
||||
[Space]
|
||||
[SerializeField] int duration = 10;
|
||||
[Tooltip("How fast the duration goes down.\nValue of 1 = normal time.")]
|
||||
[SerializeField] float timeStep = 1;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (startCountdownOnStart && modular3DText)
|
||||
StartCoroutine(CountdownRoutine());
|
||||
}
|
||||
|
||||
IEnumerator CountdownRoutine()
|
||||
{
|
||||
if (timeStep == 0)
|
||||
timeStep = 0.01f;
|
||||
|
||||
modular3DText.UpdateText(duration.ToString());
|
||||
|
||||
for (int i = duration - 1; i > 0; i--)
|
||||
{
|
||||
yield return new WaitForSeconds(timeStep);
|
||||
modular3DText.UpdateText(i.ToString());
|
||||
}
|
||||
yield return new WaitForSeconds(1);
|
||||
modular3DText.UpdateText(textAfterCountdownEnds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 564494fa003cb044e83a3ad81d005262
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 247241
|
||||
packageName: Modular 3D Text - In-Game 3D UI System
|
||||
packageVersion: 4.9.2
|
||||
assetPath: Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Scripts/Examples/Countdown.cs
|
||||
uploadId: 877966
|
||||
@@ -0,0 +1,60 @@
|
||||
/// Created by Ferdowsur Asif @ Tiny Giant Studios
|
||||
|
||||
using System.Collections;
|
||||
using TinyGiantStudio.Modules;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace TinyGiantStudio.Text.Example
|
||||
{
|
||||
public class DamageText : MonoBehaviour
|
||||
{
|
||||
public Modular3DText modular3DText = null;
|
||||
public Transform textHolder = null;
|
||||
public Module module = null;
|
||||
|
||||
|
||||
|
||||
public void UpdateText(string str)
|
||||
{
|
||||
ResetTransform();
|
||||
modular3DText.UpdateText(str);
|
||||
StartCoroutine(ApplyModules());
|
||||
}
|
||||
public void UpdateText(float number)
|
||||
{
|
||||
ResetTransform();
|
||||
modular3DText.UpdateText(number);
|
||||
StartCoroutine(ApplyModules());
|
||||
}
|
||||
public void UpdateText(int number)
|
||||
{
|
||||
ResetTransform();
|
||||
modular3DText.UpdateText(number);
|
||||
StartCoroutine(ApplyModules());
|
||||
}
|
||||
|
||||
void ResetTransform()
|
||||
{
|
||||
textHolder.localPosition = Vector3.zero;
|
||||
textHolder.localRotation = Quaternion.identity;
|
||||
|
||||
if (textHolder.gameObject.GetComponent<Rigidbody>())
|
||||
{
|
||||
textHolder.gameObject.GetComponent<Rigidbody>().linearVelocity = Vector3.zero;
|
||||
textHolder.gameObject.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator ApplyModules()
|
||||
{
|
||||
if (gameObject.activeInHierarchy)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
if (module)
|
||||
StartCoroutine(module.ModuleRoutine(textHolder.gameObject, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67ae51a71b9068e42ae7987604396f82
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 247241
|
||||
packageName: Modular 3D Text - In-Game 3D UI System
|
||||
packageVersion: 4.9.2
|
||||
assetPath: Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Scripts/Examples/DamageText.cs
|
||||
uploadId: 877966
|
||||
@@ -0,0 +1,130 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TinyGiantStudio.Text.Example
|
||||
{
|
||||
[RequireComponent(typeof(Modular3DText))]
|
||||
[AddComponentMenu("Tiny Giant Studio/Modular 3D Text/Extra/Loop Animation", order: 20102)]
|
||||
public class LoopAnimation : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Vector2 duration = new Vector2(1, 2);
|
||||
[SerializeField] TargetType targetType = TargetType.letters;
|
||||
[Space]
|
||||
[SerializeField] Material focusedMaterial = null;
|
||||
|
||||
//[HideInInspector]
|
||||
public List<GameObject> targetLetterList = new List<GameObject>();
|
||||
public List<List<GameObject>> targetWordsList = new List<List<GameObject>>();
|
||||
Modular3DText Modular3DText => GetComponent<Modular3DText>();
|
||||
|
||||
|
||||
private enum TargetType
|
||||
{
|
||||
letters,
|
||||
words
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
UpdateTargetList();
|
||||
|
||||
if (targetType == TargetType.letters)
|
||||
StartCoroutine(LetterAnimationRoutine());
|
||||
else
|
||||
StartCoroutine(WordAnimationRoutine());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This needs to be called everytime the text is changed
|
||||
/// </summary>
|
||||
public void UpdateTargetList()
|
||||
{
|
||||
targetLetterList.Clear();
|
||||
targetWordsList.Clear();
|
||||
|
||||
if (targetType == TargetType.letters)
|
||||
{
|
||||
for (int i = 0; i < Modular3DText.characterObjectList.Count; i++)
|
||||
{
|
||||
targetLetterList.Add(Modular3DText.characterObjectList[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<GameObject> letterList = new List<GameObject>();
|
||||
for (int i = 0; i < Modular3DText.characterObjectList.Count; i++)
|
||||
{
|
||||
if (Modular3DText.characterObjectList[i].name == "Space")
|
||||
{
|
||||
targetWordsList.Add(letterList);
|
||||
letterList = new List<GameObject>();
|
||||
}
|
||||
else
|
||||
{
|
||||
letterList.Add(Modular3DText.characterObjectList[i]);
|
||||
}
|
||||
}
|
||||
if (letterList.Count > 0)
|
||||
{
|
||||
targetWordsList.Add(letterList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator LetterAnimationRoutine()
|
||||
{
|
||||
yield return null;
|
||||
for (int i = 0; i < targetLetterList.Count; i++)
|
||||
{
|
||||
Focus(targetLetterList[i]);
|
||||
yield return new WaitForSeconds(Random.Range(duration.x, duration.y));
|
||||
UnFocus(targetLetterList[i]);
|
||||
}
|
||||
|
||||
StartCoroutine(LetterAnimationRoutine());
|
||||
}
|
||||
private IEnumerator WordAnimationRoutine()
|
||||
{
|
||||
yield return null;
|
||||
for (int i = 0; i < targetWordsList.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < targetWordsList[i].Count; j++)
|
||||
{
|
||||
Focus(targetWordsList[i][j]);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(Random.Range(duration.x, duration.y));
|
||||
|
||||
for (int j = 0; j < targetWordsList[i].Count; j++)
|
||||
{
|
||||
UnFocus(targetWordsList[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
StartCoroutine(WordAnimationRoutine());
|
||||
}
|
||||
|
||||
|
||||
private void Focus(GameObject target)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (focusedMaterial)
|
||||
{
|
||||
if (target.GetComponent<Renderer>())
|
||||
target.GetComponent<Renderer>().material = focusedMaterial;
|
||||
}
|
||||
}
|
||||
private void UnFocus(GameObject target)
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (target.GetComponent<Renderer>())
|
||||
target.GetComponent<Renderer>().material = Modular3DText.Material;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b34a6e0f789b9346b53244166ecd722
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 247241
|
||||
packageName: Modular 3D Text - In-Game 3D UI System
|
||||
packageVersion: 4.9.2
|
||||
assetPath: Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Scripts/Examples/LoopAnimation.cs
|
||||
uploadId: 877966
|
||||
@@ -0,0 +1,108 @@
|
||||
// You can use this one script for the entire scene
|
||||
//1. Create text with the style you want
|
||||
//2. Assign it as prefab to a styles list
|
||||
//3. Call this script with ShowToolTip() method. Has multiple overloads
|
||||
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TinyGiantStudio.Text.Example
|
||||
{
|
||||
public class StatusToolTip : MonoBehaviour
|
||||
{
|
||||
public List<Styles> styles = new List<Styles>();
|
||||
[Space]
|
||||
[Space]
|
||||
public float defaultDuration = 3;
|
||||
|
||||
[Tooltip("This uses itself as pool holder, not poolmanager like the text and the text prefabs MUST have unique names because that's what is used for pool key")]
|
||||
public bool pooling = true;
|
||||
public Dictionary<string, Queue<GameObject>> poolDictionary = new Dictionary<string, Queue<GameObject>>();
|
||||
|
||||
[System.Serializable]
|
||||
public class Styles
|
||||
{
|
||||
public GameObject textPrefab = null;
|
||||
public Vector3 offsetMin = Vector3.zero;
|
||||
public Vector3 offsetMax = Vector3.zero;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ShowToolTip(string text, int style, Vector3 position, Quaternion rotation, bool worldPosition)
|
||||
{
|
||||
ShowToolTip(text, style, position, rotation, worldPosition, defaultDuration);
|
||||
}
|
||||
public void ShowToolTip(string text, int style, Vector3 position, Quaternion rotation, bool worldPosition, float duration)
|
||||
{
|
||||
GameObject obj = GetIObj(style);
|
||||
SetPosition(obj.transform, style, position, rotation, worldPosition);
|
||||
obj.SetActive(true);
|
||||
ApplyText(text, obj);
|
||||
StartCoroutine(DestroyObj(obj, duration));
|
||||
}
|
||||
|
||||
|
||||
|
||||
GameObject GetIObj(int style)
|
||||
{
|
||||
if (pooling)
|
||||
{
|
||||
string key = styles[style].textPrefab.name;
|
||||
if (poolDictionary.ContainsKey(key))
|
||||
{
|
||||
if (poolDictionary[key].Count > 0)
|
||||
{
|
||||
GameObject poolItem = poolDictionary[key].Dequeue();
|
||||
return poolItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GetNewObj(style);
|
||||
}
|
||||
|
||||
private GameObject GetNewObj(int style)
|
||||
{
|
||||
GameObject newItem = Instantiate(styles[style].textPrefab);
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
void SetPosition(Transform objTransform, int style, Vector3 position, Quaternion rotation, bool worldPosition)
|
||||
{
|
||||
if (worldPosition)
|
||||
{
|
||||
objTransform.position = position + RandomVector3(styles[style].offsetMin, styles[style].offsetMax);
|
||||
objTransform.rotation = rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
objTransform.localPosition = position + RandomVector3(styles[style].offsetMin, styles[style].offsetMax);
|
||||
objTransform.localRotation = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 RandomVector3(Vector3 min, Vector3 max)
|
||||
{
|
||||
float x = Random.Range(min.x, max.x);
|
||||
float y = Random.Range(min.y, max.y);
|
||||
float z = Random.Range(min.z, max.z);
|
||||
return new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
void ApplyText(string text, GameObject obj)
|
||||
{
|
||||
obj.GetComponent<Modular3DText>().UpdateText(text);
|
||||
}
|
||||
IEnumerator DestroyObj(GameObject obj, float duration)
|
||||
{
|
||||
yield return new WaitForSeconds(duration);
|
||||
obj.GetComponent<Modular3DText>().UpdateText(string.Empty);
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
Destroy(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4bb3b00b7c08eb4f8e53c66d75af992
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 247241
|
||||
packageName: Modular 3D Text - In-Game 3D UI System
|
||||
packageVersion: 4.9.2
|
||||
assetPath: Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Scripts/Examples/StatusToolTip.cs
|
||||
uploadId: 877966
|
||||
@@ -0,0 +1,99 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TinyGiantStudio.Text.Example
|
||||
{
|
||||
[AddComponentMenu("Tiny Giant Studio/Modular 3D Text/Extra/Typewriter", order: 20101)]
|
||||
public class Typewriter : MonoBehaviour
|
||||
{
|
||||
[TextArea]
|
||||
public string text = "Typewriter text";
|
||||
[Space(20)]
|
||||
|
||||
public Modular3DText modular3DText = null;
|
||||
[SerializeField] bool startAutomatically = true;
|
||||
[SerializeField] float startDelay = 1;
|
||||
[Tooltip("Minimum and maximum possible speed.")]
|
||||
public Vector2 typeDelay = new Vector2(0.01f, 0.1f);
|
||||
[SerializeField] string typingSymbol = null;
|
||||
|
||||
|
||||
[Space(10)]
|
||||
[SerializeField] AudioClip typeSound = null;
|
||||
[Tooltip("Minimum and maximum possible volume. \nA variation of values makes it look natural.")]
|
||||
[SerializeField] Vector2 volume = Vector2.one;
|
||||
[SerializeField] AudioSource audioSource = null;
|
||||
|
||||
///If disabled while typing, this lets the script know it should start the routine again
|
||||
private bool typing = false;
|
||||
///If typewriter is resumed, the effect resumes from this number letter.
|
||||
private int currentLetter;
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (startAutomatically & modular3DText)
|
||||
modular3DText.Text = string.Empty;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (startAutomatically)
|
||||
StartTyping();
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (typing)
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(TypingRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If gameobject is enabled, this starts a coroutine for the typewriter
|
||||
/// </summary>
|
||||
public void StartTyping()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(FirstStart());
|
||||
typing = true;
|
||||
}
|
||||
|
||||
IEnumerator FirstStart()
|
||||
{
|
||||
yield return null;
|
||||
yield return new WaitForSeconds(startDelay);
|
||||
StartCoroutine(TypingRoutine());
|
||||
}
|
||||
|
||||
IEnumerator TypingRoutine()
|
||||
{
|
||||
if (modular3DText)
|
||||
{
|
||||
for (int i = currentLetter; i <= text.Length; i++)
|
||||
{
|
||||
modular3DText.Text = (text.Substring(0, i) + typingSymbol);
|
||||
|
||||
|
||||
yield return null;
|
||||
yield return new WaitForSeconds(Random.Range(typeDelay.x, typeDelay.y));
|
||||
|
||||
if (audioSource && typeSound)
|
||||
{
|
||||
audioSource.pitch = Random.Range(0.9f, 1.1f);
|
||||
audioSource.PlayOneShot(typeSound, Random.Range(volume.x, volume.y));
|
||||
}
|
||||
currentLetter = i;
|
||||
}
|
||||
typing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("<color=red>No text object is selected on typewriter.</color> :" + gameObject.name, gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f2a85735d21c8c43af7398b82645ae5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 247241
|
||||
packageName: Modular 3D Text - In-Game 3D UI System
|
||||
packageVersion: 4.9.2
|
||||
assetPath: Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Scripts/Examples/Typewriter.cs
|
||||
uploadId: 877966
|
||||
Reference in New Issue
Block a user