2026-04-27 BGM 및 이스터에그

This commit is contained in:
2026-04-27 17:47:44 +09:00
parent 88a71e6292
commit 18d3077cc4
840 changed files with 53720 additions and 4 deletions

View File

@@ -0,0 +1,63 @@
/// Created by Ferdowsur Asif @ Tiny Giant Studios
using System.Collections;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
/// <summary>
/// Variable Holders:
/// 0 - Delay - Float
/// 1 - Enable gravity - bool
/// 2 - Don't add force - bool
/// 3 - Horizontal Foce - Float
/// 4 - Vertical Foce - Float
/// 5 - Force Direction Min - Vector3
/// 6 - Force Direction Max - Vector3
/// 7 - Physic Material - Physic Material
/// </summary>
[CreateAssetMenu(menuName = "Tiny Giant Studio/Modular 3D Text/Modules/Add Physics")]
public class AddPhysics : Module
{
public override IEnumerator ModuleRoutine(GameObject obj, VariableHolder[] variableHolders)
{
if (variableHolders == null || variableHolders.Length == 0)
yield break;
yield return new WaitForSeconds(variableHolders[0].floatValue);
if (obj)
{
if (obj.GetComponent<MeshFilter>())
{
if (!obj.GetComponent<Rigidbody>())
obj.AddComponent<Rigidbody>();
if (!obj.GetComponent<BoxCollider>())
obj.AddComponent<BoxCollider>();
if (variableHolders[7].physicMaterialValue)
obj.GetComponent<BoxCollider>().material = variableHolders[7].physicMaterialValue;
obj.GetComponent<Rigidbody>().useGravity = variableHolders[1].boolValue;
if (!variableHolders[2].boolValue)
{
float horizontalForcePower = variableHolders[3].floatValue;
float verticalForcePower = variableHolders[4].floatValue;
Vector3 forceDirectionMinimum = variableHolders[5].vector3Value;
Vector3 forceDirectionMaximum = variableHolders[6].vector3Value;
obj.GetComponent<Rigidbody>().AddForce(new Vector3(horizontalForcePower * Random.Range(forceDirectionMinimum.x, forceDirectionMaximum.x), verticalForcePower * Random.Range(forceDirectionMinimum.y, forceDirectionMaximum.y), horizontalForcePower * Random.Range(forceDirectionMinimum.z, forceDirectionMaximum.z)));
}
}
}
}
public override string VariableWarnings(VariableHolder[] variableHolders)
{
return null;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6b6a20c10e9bdbb4498a43fdd9960739
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 357398909940d3149be0d4878c0a2fee, type: 3}
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/Modules/Scripts/AddPhysics.cs
uploadId: 877966

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7eb45e460dbceb3448893b341b805297
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;
namespace TinyGiantStudio.Modules
{
[CustomEditor(typeof(ModuleApplier))]
public class ModuleApplierEditor : Editor
{
private ModuleApplier myTarget;
private SerializedObject soTarget;
SerializedProperty targetObject;
SerializedProperty modules;
SerializedProperty applyModule;
public override void OnInspectorGUI()
{
myTarget = (ModuleApplier)target;
soTarget = new SerializedObject(target);
targetObject = soTarget.FindProperty(nameof(ModuleApplier.moduleTarget));
modules = soTarget.FindProperty(nameof(ModuleApplier.modules));
applyModule = soTarget.FindProperty(nameof(ModuleApplier.applyModules));
soTarget.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(targetObject);
ModuleDrawer.BaseModuleContainerList("Modules", "Modules that can be applied. Note that module always have to be applied to enabled game object.", myTarget.modules, modules, soTarget, applyModule);
if (EditorGUI.EndChangeCheck())
{
soTarget.ApplyModifiedProperties();
EditorUtility.SetDirty(myTarget);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2c883a4dd5cb5ba4287862af23f4f444
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/Modules/Scripts/Editor/ModuleApplierEditor.cs
uploadId: 877966

View File

@@ -0,0 +1,380 @@
using System.Collections.Generic;
using TinyGiantStudio.Layout;
using UnityEditor;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
public static class ModuleDrawer
{
static GUIStyle headerLabel;
static Texture addIcon;
static Texture deleteIcon;
public static bool ElementUpdatersExist()
{
return true;
//string[] guids = AssetDatabase.FindAssets("t:LayoutElementModule", null);
//if (guids.Length > 0)
// return true;
//return false;
}
public static void UpdateStyles()
{
if (addIcon == null)
addIcon = EditorGUIUtility.Load("Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Utility/Editor Icons/Icon_Plus.png") as Texture;
if (deleteIcon == null)
deleteIcon = EditorGUIUtility.Load("Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Utility/Editor Icons/Icon_Cross.png") as Texture;
headerLabel ??= new GUIStyle(EditorStyles.wordWrappedLabel)
{
fontSize = 12,
fontStyle = FontStyle.Bold,
//alignment = TextAnchor.MiddleCenter,
};
}
public static void ElementUpdaterContainerList(string label, string tooltip, LayoutElementModuleContainer elementUpdaterContainer, SerializedProperty serializedProperty, SerializedObject soTarget)
{
UpdateStyles();
EditorGUI.indentLevel = 0;
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.BeginVertical(EditorStyles.toolbar);
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(new GUIContent(label, tooltip), headerLabel);
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.Space(5);
{
GUILayout.BeginVertical(EditorStyles.helpBox);
//GUILayout.BeginVertical("CN EntryBackEven");
EditorGUI.indentLevel = 0;
GUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(serializedProperty.FindPropertyRelative("module"), GUIContent.none, GUILayout.MinWidth(10));
//GUILayout.Label(GUIContent.none, GUILayout.MaxWidth(5));
GUILayout.EndHorizontal();
EditorGUI.indentLevel = 0;
{
if (elementUpdaterContainer.module != null)
{
if (elementUpdaterContainer.variableHolders != null)
{
if (elementUpdaterContainer.module.variableHolders != null)
{
if (elementUpdaterContainer.variableHolders.Length != elementUpdaterContainer.module.variableHolders.Length)
{
elementUpdaterContainer.variableHolders = new VariableHolder[elementUpdaterContainer.module.variableHolders.Length];
for (int k = 0; k < elementUpdaterContainer.variableHolders.Length; k++)
{
if (k < elementUpdaterContainer.module.variableHolders.Length)
{
elementUpdaterContainer.variableHolders[k] = elementUpdaterContainer.module.variableHolders[k];
}
}
soTarget.Update();
}
}
for (int j = 0; j < elementUpdaterContainer.variableHolders.Length; j++)
{
DrawVariableHolder(elementUpdaterContainer, serializedProperty, j);
}
string warning = elementUpdaterContainer.module.VariableWarnings(elementUpdaterContainer.variableHolders);
if (warning != null)
{
if (warning.Length > 0)
{
EditorGUILayout.HelpBox(warning, MessageType.Warning);
}
}
}
}
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
public static void BaseModuleContainerList(string label, string tooltip, List<ModuleContainer> moduleContainers, SerializedProperty serializedProperty, SerializedObject soTarget, SerializedProperty boolProperty = null)
{
UpdateStyles();
EditorGUI.indentLevel = 0;
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.BeginVertical(EditorStyles.toolbar);
GUILayout.BeginHorizontal();
if (boolProperty != null)
{
EditorGUILayout.PropertyField(boolProperty, GUIContent.none, GUILayout.MaxWidth(17));
}
EditorGUILayout.LabelField(new GUIContent(label, tooltip), headerLabel);
if (GUILayout.Button(addIcon, EditorStyles.toolbarButton, GUILayout.MaxHeight(20), GUILayout.MaxWidth(20)))
EmptyEffect(moduleContainers, serializedProperty);
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.Space(5);
for (int i = 0; i < moduleContainers.Count; i++)
{
if (serializedProperty.arraySize <= i) //no module
continue;
GUILayout.BeginVertical(EditorStyles.helpBox);
//GUILayout.BeginVertical("CN EntryBackEven");
EditorGUI.indentLevel = 0;
GUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(serializedProperty.GetArrayElementAtIndex(i).FindPropertyRelative("module"), GUIContent.none, GUILayout.MinWidth(10));
GUILayout.Label(GUIContent.none, GUILayout.MaxWidth(5));
if (GUILayout.Button(deleteIcon, EditorStyles.toolbarButton, GUILayout.MinHeight(20), GUILayout.MaxWidth(20)))
{
if (!Application.isPlaying)
Undo.RecordObject(serializedProperty.serializedObject.targetObject, "Delete module");
serializedProperty.DeleteArrayElementAtIndex(i);
}
GUILayout.EndHorizontal();
EditorGUI.indentLevel = 0;
if (i < moduleContainers.Count)
{
if (moduleContainers[i].module != null)
{
if (moduleContainers[i].variableHolders != null)
{
if (moduleContainers[i].module.variableHolders != null)
{
if (moduleContainers[i].variableHolders.Length != moduleContainers[i].module.variableHolders.Length)
{
moduleContainers[i].variableHolders = new VariableHolder[moduleContainers[i].module.variableHolders.Length];
for (int k = 0; k < moduleContainers[i].variableHolders.Length; k++)
{
if (k < moduleContainers[i].variableHolders.Length)
{
moduleContainers[i].variableHolders[k] = moduleContainers[i].module.variableHolders[k];
}
}
soTarget.Update();
}
}
for (int j = 0; j < moduleContainers[i].variableHolders.Length; j++)
{
DrawVariableHolder(moduleContainers, serializedProperty, i, j);
}
string warning = moduleContainers[i].module.VariableWarnings(moduleContainers[i].variableHolders);
if (warning != null)
{
if (warning.Length > 0)
{
EditorGUILayout.HelpBox(warning, MessageType.Warning);
}
}
}
}
}
GUILayout.EndVertical();
if (i + 1 != moduleContainers.Count)
{
EditorGUILayout.Space(5);
}
}
GUILayout.EndVertical();
}
public static void EmptyEffect(List<ModuleContainer> moduleList, SerializedProperty serializedProperty)
{
if (!Application.isPlaying)
Undo.RecordObject(serializedProperty.serializedObject.targetObject, "Add module");
serializedProperty.InsertArrayElementAtIndex(serializedProperty.arraySize);
}
static void DrawVariableHolder(LayoutElementModuleContainer elementUpdater, SerializedProperty serializedProperty, int j)
{
if (elementUpdater.module.variableHolders != null)
{
if (!ShowProperty(elementUpdater.module.variableHolders, j, elementUpdater.variableHolders))
return;
string contentName = string.Empty;
string contentTooltip = string.Empty;
if (elementUpdater.module.variableHolders[j].variableName != null)
if (elementUpdater.module.variableHolders[j].variableName != string.Empty)
contentName = elementUpdater.module.variableHolders[j].variableName;
if (string.IsNullOrEmpty(contentName))
contentName = "Unlabeled variable";
if (elementUpdater.module.variableHolders[j].tooltip != null)
if (elementUpdater.module.variableHolders[j].tooltip != string.Empty)
contentTooltip = elementUpdater.module.variableHolders[j].tooltip;
GUIContent variableLabelContent = new GUIContent(contentName, contentTooltip);
ModuleVariableType type = elementUpdater.module.variableHolders[j].type;
SerializedProperty property;
string propertyName = ModuleDrawer.GetPropertyName(type);
if (elementUpdater != null)
{
if (serializedProperty.FindPropertyRelative("variableHolders").arraySize > j)
{
property = serializedProperty.FindPropertyRelative("variableHolders").GetArrayElementAtIndex(j).FindPropertyRelative(propertyName);
EditorGUILayout.PropertyField(property, variableLabelContent);
}
else
{
EditorGUILayout.LabelField("Problem");
}
}
}
}
static void DrawVariableHolder(List<ModuleContainer> moduleContainers, SerializedProperty serializedContainer, int i, int j)
{
if (moduleContainers[i].module.variableHolders != null)
{
if (!ShowProperty(moduleContainers[i].module.variableHolders, j, moduleContainers[i].variableHolders))
return;
string contentName = string.Empty;
string contentTooltip = string.Empty;
if (moduleContainers[i].module.variableHolders[j].variableName != null)
if (moduleContainers[i].module.variableHolders[j].variableName != string.Empty)
contentName = moduleContainers[i].module.variableHolders[j].variableName;
if (string.IsNullOrEmpty(contentName))
contentName = "Unlabeled variable";
if (moduleContainers[i].module.variableHolders[j].tooltip != null)
if (moduleContainers[i].module.variableHolders[j].tooltip != string.Empty)
contentTooltip = moduleContainers[i].module.variableHolders[j].tooltip;
GUIContent variableLabelContent = new GUIContent(contentName, contentTooltip);
ModuleVariableType type = moduleContainers[i].module.variableHolders[j].type;
SerializedProperty property;
string propertyName = ModuleDrawer.GetPropertyName(type);
if (moduleContainers != null)
{
if (serializedContainer.arraySize > i)
{
if (serializedContainer.GetArrayElementAtIndex(i).FindPropertyRelative("variableHolders").arraySize > j)
{
property = serializedContainer.GetArrayElementAtIndex(i).FindPropertyRelative("variableHolders").GetArrayElementAtIndex(j).FindPropertyRelative(propertyName);
EditorGUILayout.PropertyField(property, variableLabelContent);
}
}
}
}
}
//should check from the module in module container list
static bool ShowProperty(VariableHolder[] moduleVariables, int i, VariableHolder[] textVariables)
{
if (moduleVariables[i].hideIf == null)
return true;
if (!string.IsNullOrEmpty(moduleVariables[i].hideIf))
{
for (int j = 0; j < moduleVariables.Length; j++)
{
if (j == i)
continue;
if (moduleVariables[j].type == ModuleVariableType.@bool)
{
if (moduleVariables[j].variableName == moduleVariables[i].hideIf)
{
if (textVariables[j] == null)
return true;
if (textVariables[j].boolValue == true)
return false;
else
return true;
}
}
}
}
return true;
}
public static string GetPropertyName(ModuleVariableType type)
{
string propertyName;
if (type == ModuleVariableType.@float)
propertyName = "floatValue";
else if (type == ModuleVariableType.@int)
propertyName = "intValue";
else if (type == ModuleVariableType.@bool)
propertyName = "boolValue";
else if (type == ModuleVariableType.@string)
propertyName = "stringValue";
else if (type == ModuleVariableType.vector2)
propertyName = "vector2Value";
else if (type == ModuleVariableType.vector3)
propertyName = "vector3Value";
else if (type == ModuleVariableType.animationCurve)
propertyName = "animationCurve";
else if (type == ModuleVariableType.gameObject)
propertyName = "gameObjectValue";
else if (type == ModuleVariableType.physicMaterial)
propertyName = "physicMaterialValue";
else
propertyName = "floatValue";
return propertyName;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 5b868d9a03b0acf479907b860257b8f1
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/Modules/Scripts/Editor/ModuleDrawer.cs
uploadId: 877966

View File

@@ -0,0 +1,132 @@
using UnityEditor;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
[CustomEditor(typeof(ModuleCore), true)]
public class ModuleEditor : Editor
{
ModuleCore myTarget;
SerializedObject soTarget;
SerializedProperty variableHolders;
Texture deleteIcon;
GUIStyle defaultLabel = null;
Vector2 scrollPos;
void OnEnable()
{
myTarget = (ModuleCore)target;
soTarget = new SerializedObject(target);
variableHolders = soTarget.FindProperty("variableHolders");
deleteIcon = EditorGUIUtility.Load("Assets/Plugins/Tiny Giant Studio/Modular 3D Text/Utility/Editor Icons/Icon_Cross.png") as Texture;
}
public override void OnInspectorGUI()
{
GenerateStyle();
soTarget.Update();
EditorGUI.BeginChangeCheck();
if (myTarget.variableHolders != null)
{
EditorGUILayout.HelpBox("Modifiable variables by text. These are dependent on individual modules. Changing them might result in undesirable effects. If that happens, please fix them from the instruction in code summary or download the original version from the asset store.", MessageType.Warning);
int indexWidth = 16;
int nameWidth = 70;
int typeMinWidth = 50;
int typeMaxWidth = 125;
int defaultValueWidth = 75;
int tooltipWidth = 75;
int hideIfWidth = 70;
scrollPos =
EditorGUILayout.BeginScrollView(scrollPos);
if (myTarget.variableHolders.Length > 0)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("", defaultLabel, GUILayout.MaxWidth(indexWidth));//Index
EditorGUILayout.LabelField("Name", defaultLabel, GUILayout.MinWidth(nameWidth));
EditorGUILayout.LabelField("Type", defaultLabel, GUILayout.MinWidth(typeMinWidth), GUILayout.MaxWidth(typeMaxWidth));
EditorGUILayout.LabelField(new GUIContent("Hide if", "The variable will be invisible if the bool variable with show if name is set to true."), defaultLabel, GUILayout.MinWidth(hideIfWidth), GUILayout.MaxWidth(hideIfWidth * 2));
EditorGUILayout.LabelField(new GUIContent("defaultValue"), defaultLabel, GUILayout.MinWidth(defaultValueWidth), GUILayout.MaxWidth(defaultValueWidth * 2));
EditorGUILayout.LabelField(new GUIContent("Tooltip", "Little info boxes like this one."), defaultLabel, GUILayout.MinWidth(tooltipWidth), GUILayout.MaxWidth(tooltipWidth * 2));
EditorGUILayout.LabelField("", GUILayout.MaxWidth(20), GUILayout.MinWidth(20));
EditorGUILayout.EndHorizontal();
}
for (int i = 0; i < myTarget.variableHolders.Length; i++)
{
EditorGUILayout.BeginHorizontal();
Color color = GUI.color;
GUI.color = Color.gray;
EditorGUILayout.LabelField(i.ToString(), GUILayout.MaxWidth(indexWidth)); //Index
GUI.color = color;
EditorGUILayout.PropertyField(variableHolders.GetArrayElementAtIndex(i).FindPropertyRelative("variableName"), GUIContent.none, GUILayout.MinWidth(nameWidth));
EditorGUILayout.PropertyField(variableHolders.GetArrayElementAtIndex(i).FindPropertyRelative("type"), GUIContent.none, GUILayout.MinWidth(typeMinWidth), GUILayout.MaxWidth(typeMaxWidth));
EditorGUILayout.PropertyField(variableHolders.GetArrayElementAtIndex(i).FindPropertyRelative("hideIf"), GUIContent.none, GUILayout.MinWidth(hideIfWidth), GUILayout.MaxWidth(hideIfWidth * 2));
EditorGUILayout.PropertyField(variableHolders.GetArrayElementAtIndex(i).FindPropertyRelative(ModuleDrawer.GetPropertyName(myTarget.variableHolders[i].type)), GUIContent.none, GUILayout.MinWidth(defaultValueWidth), GUILayout.MaxWidth(defaultValueWidth * 2));
EditorGUILayout.PropertyField(variableHolders.GetArrayElementAtIndex(i).FindPropertyRelative("tooltip"), GUIContent.none, GUILayout.MinWidth(tooltipWidth), GUILayout.MaxWidth(tooltipWidth * 2));
if (GUILayout.Button(deleteIcon, EditorStyles.label, GUILayout.MaxWidth(18), GUILayout.MaxHeight(18)))
{
RemoveVariable(i);
}
GUI.color = color;
EditorGUILayout.EndHorizontal();
}
GUILayout.Space(10);
if (GUILayout.Button("Add new variable", GUILayout.MaxHeight(25)))
{
System.Array.Resize(ref myTarget.variableHolders, myTarget.variableHolders.Length + 1);
EditorUtility.SetDirty(myTarget);
}
EditorGUILayout.EndScrollView();
}
else
{
myTarget.variableHolders = new VariableHolder[0];
}
DrawDefaultInspector();
if (EditorGUI.EndChangeCheck())
{
soTarget.ApplyModifiedProperties();
}
}
void RemoveVariable(int removeTarget)
{
for (int i = removeTarget; i < myTarget.variableHolders.Length - 1; i++)
{
myTarget.variableHolders[i] = myTarget.variableHolders[i + 1];
}
System.Array.Resize(ref myTarget.variableHolders, myTarget.variableHolders.Length - 1);
EditorUtility.SetDirty(myTarget);
}
void GenerateStyle()
{
if (defaultLabel == null)
{
defaultLabel = new GUIStyle(EditorStyles.whiteMiniLabel)
{
fontStyle = FontStyle.BoldAndItalic,
fontSize = 13
};
defaultLabel.normal.textColor = Color.yellow;
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: a5e7e1501b3be134ea8fdb1ef9434ee6
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/Modules/Scripts/Editor/ModuleEditor.cs
uploadId: 877966

View File

@@ -0,0 +1,12 @@
using System.Collections;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
[HelpURL("https://app.gitbook.com/@ferdowsur/s/modular-3d-text/scripts/modules")]
public abstract class Module : ModuleCore
{
public abstract IEnumerator ModuleRoutine(GameObject obj, VariableHolder[] variableHolders);
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: e313daa6bd00b234ca6a9cf505970858
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 357398909940d3149be0d4878c0a2fee, type: 3}
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/Modules/Scripts/Module.cs
uploadId: 877966

View File

@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
public class ModuleApplier : MonoBehaviour
{
public GameObject moduleTarget;
[Tooltip("Target needs to be enabled to apply module")]
public List<ModuleContainer> modules = new List<ModuleContainer>();
public bool applyModules = true;
[ContextMenu("Apply all modules")]
public void ApplyAllModule()
{
if (moduleTarget == null)
return;
if (!moduleTarget.activeInHierarchy)
return;
for (int i = 0; i < modules.Count; i++)
{
if (modules[i].module)
StartCoroutine(modules[i].module.ModuleRoutine(moduleTarget, modules[i].variableHolders));
}
}
public void ApplyModule(int i)
{
if (moduleTarget == null)
return;
if (!moduleTarget.activeInHierarchy)
return;
if (modules.Count >= i)
return;
if (modules[i].module)
StartCoroutine(modules[i].module.ModuleRoutine(moduleTarget, modules[i].variableHolders));
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 7ffc5aedd4aa170458558e3abaf95412
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/Modules/Scripts/ModuleApplier.cs
uploadId: 877966

View File

@@ -0,0 +1,78 @@
using UnityEditor;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
[System.Serializable]
public class ModuleContainer
{
/// <summary>
/// If you are updating/changing modules runtime, remember to call UpdateVariableHolders() to update the variable holders length. Otherwise, it won't work.
/// </summary>
public Module module;
public VariableHolder[] variableHolders;
public void UpdateVariableHolders()
{
if (module == null) return;
if (module.variableHolders == null) return;
if (variableHolders == null || variableHolders.Length != module.variableHolders.Length)
{
variableHolders = new VariableHolder[module.variableHolders.Length];
for (int k = 0; k < variableHolders.Length; k++)
{
if (k < module.variableHolders.Length)
{
variableHolders[k] = module.variableHolders[k];
}
}
}
}
}
[System.Serializable]
public class VariableHolder
{
public string variableName;
public ModuleVariableType type;
//[HideInInspector]
public float floatValue;
//[HideInInspector]
public int intValue;
//[HideInInspector]
public bool boolValue;
//[HideInInspector]
public string stringValue;
//[HideInInspector]
public Vector2 vector2Value;
//[HideInInspector]
public Vector3 vector3Value;
//[HideInInspector]
public AnimationCurve animationCurve = AnimationCurve.EaseInOut(0, 0, 1, 1);
//[HideInInspector]
public GameObject gameObjectValue;
//[HideInInspector]
public PhysicsMaterial physicMaterialValue;
//[HideInInspector]
public string hideIf;
//[HideInInspector]
public string tooltip = string.Empty;
}
[System.Serializable]
public enum ModuleVariableType
{
@float,
@int,
@bool,
@string,
vector2,
vector3,
animationCurve,
gameObject,
physicMaterial
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 074f927dda347474eb50e9a33b1e2775
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/Modules/Scripts/ModuleContainer.cs
uploadId: 877966

View File

@@ -0,0 +1,27 @@
using UnityEngine;
namespace TinyGiantStudio.Modules
{
[HelpURL("https://app.gitbook.com/@ferdowsur/s/modular-3d-text/scripts/modules")]
public abstract class ModuleCore : ScriptableObject
{
[HideInInspector]
public VariableHolder[] variableHolders;
/// <summary>
/// The return of this string is shown as warning. Used to show warnings incase of faulty settings
/// </summary>
/// <returns></returns>
public abstract string VariableWarnings(VariableHolder[] variableHolders);
public string AddWarning(string toAdd, string original)
{
if (!string.IsNullOrEmpty(original))
original += '\n';
original += toAdd;
return original;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2133fd9399850024183df41aca4b108f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 357398909940d3149be0d4878c0a2fee, type: 3}
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/Modules/Scripts/ModuleCore.cs
uploadId: 877966

View File

@@ -0,0 +1,67 @@
using System.Collections;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
/// <summary>
/// Variable holders:
/// Index 0: Delay - Float
/// Index 1: Particle Prefab - GameObject
/// Index 2: Dont Auto Destroy Particle - Bool
/// Index 3: Destroy Particle After - Float
/// </summary>
[CreateAssetMenu(menuName = "Tiny Giant Studio/Modular 3D Text/Modules/Play Particle")]
public class PlayParticles : Module
{
public override IEnumerator ModuleRoutine(GameObject obj, VariableHolder[] variableHolders)
{
if (variableHolders[0].floatValue > 0)
yield return new WaitForSeconds(variableHolders[0].floatValue); //even with 0, this was causing particle to not spawn.
if (obj)
{
if (variableHolders[1].gameObjectValue)
{
GameObject spawnedParticle = Instantiate(variableHolders[1].gameObjectValue);
spawnedParticle.transform.SetPositionAndRotation(obj.transform.position, obj.transform.rotation);
if (spawnedParticle.GetComponent<ParticleSystem>())
spawnedParticle.GetComponent<ParticleSystem>().Play();
Destroy(spawnedParticle, variableHolders[3].floatValue);
}
}
}
public override string VariableWarnings(VariableHolder[] variableHolders)
{
string warning = string.Empty;
if (variableHolders == null)
return warning;
if (variableHolders.Length < 1)
return warning;
try
{
if (variableHolders[1].gameObjectValue == null)
{
warning = AddWarning("Please specify a particle prefab to spawn.", warning);
}
if (!variableHolders[2].boolValue)
{
if (variableHolders[3].floatValue <= 0)
{
warning = AddWarning("Invalid particle auto destroy timer", warning);
}
}
}
catch
{
return warning;
}
return warning;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: a322a0e4f3c0d844b941f32535499538
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 357398909940d3149be0d4878c0a2fee, type: 3}
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/Modules/Scripts/PlayParticles.cs
uploadId: 877966

View File

@@ -0,0 +1,36 @@
/// Created by Ferdowsur Asif @ Tiny Giant Studios
using System.Collections;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
/// <summary>
/// Variable Holders:
/// 0 - Delay - Float
/// </summary>
[CreateAssetMenu(menuName = "Tiny Giant Studio/Modular 3D Text/Modules/Remove Physics")]
public class RemovePhysics : Module
{
public override IEnumerator ModuleRoutine(GameObject obj, VariableHolder[] variableHolders)
{
yield return new WaitForSeconds(variableHolders[0].floatValue);
if (obj)
{
if (obj.GetComponent<BoxCollider>())
{
Destroy(obj.GetComponent<Rigidbody>());
}
if (obj.GetComponent<Rigidbody>())
{
Destroy(obj.GetComponent<Rigidbody>());
}
}
}
public override string VariableWarnings(VariableHolder[] variableHolders)
{
return null;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8cf1c7d566c8f3848a16bdbcbfdfd647
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 357398909940d3149be0d4878c0a2fee, type: 3}
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/Modules/Scripts/RemovePhysics.cs
uploadId: 877966

View File

@@ -0,0 +1,90 @@
using System.Collections;
using UnityEngine;
namespace TinyGiantStudio.Modules
{
/// <summary>
/// Variable holders:
/// Index 0: Delay | float
/// Index 1: Duration | float
/// Index 2: Grow from default scale | bool
/// Index 3: Grow from | vector3
/// Index 4: Grow to original | bool
/// Index 5: Grow to | vector3
/// Index 6: Scale curve | Animation curve
/// </summary>
[CreateAssetMenu(menuName = "Tiny Giant Studio/Modular 3D Text/Modules/Change Scale")]
public class ScaleChange : Module
{
public override IEnumerator ModuleRoutine(GameObject obj, VariableHolder[] variableHolders)
{
if (obj != null && variableHolders != null)
{
if (variableHolders.Length >= 6)
{
Transform transform = obj.transform;
Vector3 startScale = variableHolders[3].vector3Value; //Grow from
if (variableHolders[2].boolValue) //Grow from default scale
startScale = transform.localScale;
Vector3 targetScale = variableHolders[5].vector3Value; //Grow to
if (variableHolders[4].boolValue) //Grow to default scale
targetScale = transform.localScale;
float timer = 0;
float duration = variableHolders[1].floatValue;
AnimationCurve animationCurve = variableHolders[6].animationCurve;
yield return new WaitForSeconds(variableHolders[0].floatValue); // Delay before starting
while (timer < duration)
{
if (!transform)
break;
float perc = timer / duration;
transform.localScale = Vector3.LerpUnclamped(startScale, targetScale, animationCurve.Evaluate(perc));
timer += Time.deltaTime;
yield return null;
}
if (transform)
transform.localScale = targetScale;
}
}
}
public override string VariableWarnings(VariableHolder[] variableHolders)
{
if (variableHolders == null)
return null;
string warning = string.Empty;
if (variableHolders != null)
{
if (variableHolders.Length > 1)
{
try
{
if (variableHolders[1].floatValue <= 0) // duration
{
warning += AddWarning("Invalid duration input.", warning);
}
if (variableHolders[2].boolValue && variableHolders[4].boolValue)
{
warning += AddWarning("Changing scale from default to default. No change detected.", warning);
}
if ((!variableHolders[2].boolValue && !variableHolders[4].boolValue) && variableHolders[3].vector3Value == variableHolders[5].vector3Value)
{
warning += AddWarning("No change to scale detected.", warning);
}
}
catch
{
}
}
}
return warning;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 262ed55fff0aa894fbfb852cceca5be9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 357398909940d3149be0d4878c0a2fee, type: 3}
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/Modules/Scripts/ScaleChange.cs
uploadId: 877966