();
+
+ if (soundList.mainMixer && soundList.sfxMixer) {
+ if (s.type == Sounds.List.Type.Music)
+ s.source.outputAudioMixerGroup = soundList.mainMixer;
+ else
+ s.source.outputAudioMixerGroup = soundList.sfxMixer;
+ }
+
+ s.source.clip = s.clip;
+
+ s.source.volume = s.volume;
+ s.source.pitch = s.pitch;
+ s.source.loop = s.loop;
+ }
+ }
+
+ #region Play
+ /// Use this to play a sound with a specific name
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void Play(string name) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = s.RandomVolume;
+ s.source.Play();
+ }
+ /// Use this to play a sound with a specific name and with a certain delay
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void Play(string name, float delay) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = s.RandomVolume;
+ s.source.PlayDelayed(delay);
+ }
+ /// Use this to play one shot of a sound with a specific name
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void PlayOneShot(string name) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = s.RandomVolume;
+ s.source.PlayOneShot(s.clip);
+ }
+ /// Use this to play an intro song and then start playing the song loop
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void PlayWithIntro(string intro, string song) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == intro);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + intro + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = s.RandomVolume;
+ s.source.Play();
+
+ float introDuration = s.clip.length;
+ Play(song, introDuration);
+ }
+ /// Use this to play one shot of a random sound within a list
+ /// They have to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void PlayRandomSound(params string[] names) {
+ int random = UnityEngine.Random.Range(0, names.Length);
+ PlayOneShot(names[random]);
+ }
+ #endregion
+ #region Pause
+ /// Use this to pause a sound with a specific name
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void Pause(string name) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = s.RandomVolume;
+ s.source.Pause();
+ }
+ /// Use this to unpause a sound with a specific name
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void UnPause(string name) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = s.RandomVolume;
+ s.source.UnPause();
+ }
+ #endregion
+ #region Stop
+ /// Use this to stop a sound with a specific name
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void Stop(string name) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = s.RandomVolume;
+ s.source.Stop();
+ }
+ /// Use this to stop all the sounds
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void StopAll() {
+ foreach (Sounds.List s in soundList.sounds) {
+ if (s.source) {
+ s.source.Stop();
+ }
+ }
+ }
+ #endregion
+ /// This function returns the AudioSource that contains a specific sound
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public AudioSource GetSource(string name) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return null;
+ }
+ return s.source;
+ }
+ #region Fades
+ /// Use this to start playing a sound with a fade in
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void FadeIn(string name, float duration) {
+ StartCoroutine(FadeInCoroutine(name, duration));
+ }
+ IEnumerator FadeInCoroutine(string name, float fadeTime) {
+ AudioSource audioSource = GetSource(name);
+ if (audioSource != null && !audioSource.isPlaying) {
+ float volume = audioSource.volume;
+ audioSource.volume = 0;
+ audioSource.Play();
+ while (audioSource.volume < volume) {
+ audioSource.volume += Time.deltaTime / fadeTime;
+ yield return null;
+ }
+
+ audioSource.volume = volume;
+ }
+ }
+ /// Use this to stop playing a sound with a fade out
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void FadeOut(string name, float duration) {
+ StartCoroutine(FadeOutCoroutine(name, duration));
+ }
+ IEnumerator FadeOutCoroutine(string name, float fadeTime) {
+ AudioSource audioSource = GetSource(name);
+
+ if (audioSource && audioSource.isPlaying) {
+ float startVolume = audioSource.volume;
+
+ while (audioSource.volume > 0) {
+ audioSource.volume -= startVolume * Time.deltaTime / fadeTime;
+ yield return null;
+ }
+
+ audioSource.Stop();
+ audioSource.volume = startVolume;
+ }
+ }
+
+ /// Use this to start playing a sound muted
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void PlayMuted(string name) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.pitch = s.RandomPitch;
+ s.source.volume = 0f;
+ s.source.Play();
+ }
+ /// Use this to fade in a sound that is currently muted
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ /// WARNING: If the PlayMuted hasn't been called before, this function won't work
+ ///
+ public void FadeMutedIn(string name, float duration) {
+ StartCoroutine(FadeMutedInCoroutine(name, duration));
+ }
+ IEnumerator FadeMutedInCoroutine(string name, float fadeTime) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ yield break;
+ }
+
+ while (s.source.volume < s.volume) {
+ s.source.volume += Time.deltaTime / fadeTime;
+ yield return null;
+ }
+ s.source.volume = s.volume;
+ }
+ /// Use this to fade out a sound and keep playing that muted
+ /// It has to be in the Sound asset referenced in the AudioManager instance
+ ///
+ public void FadeMutedOut(string name, float duration) {
+ StartCoroutine(FadeMutedOutCoroutine(name, duration));
+ }
+ IEnumerator FadeMutedOutCoroutine(string name, float fadeTime) {
+ Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
+ if (s == null) {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ yield break;
+ }
+
+ while (s.source.volume > 0) {
+ s.source.volume -= Time.deltaTime / fadeTime;
+ yield return null;
+ }
+ s.source.volume = 0;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/AudioManager/AudioManager.cs.meta b/SimpleTools/Tools/AudioManager/AudioManager.cs.meta
new file mode 100644
index 0000000..4a77e93
--- /dev/null
+++ b/SimpleTools/Tools/AudioManager/AudioManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7d2879f3876727040b4f0cc799ec7ada
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/AudioManager/AudioManager.png b/SimpleTools/Tools/AudioManager/AudioManager.png
new file mode 100644
index 0000000000000000000000000000000000000000..712262f738675eb46063dce66b4855e7118a2d82
GIT binary patch
literal 1644
zcmb`I`9IqS1INF)5XLJNM+l0DRD&WBY2yfr#?=Tb)tG2{sM1BWiKmors*GB-R`>lx|un>!_nE4Ueg`?rU*2iyGzW{)gv>&*%O6yxxDnCx;pAr>$wM2>^gLAeXDu>V$=W{XCAr*c`UP&Se
zXSc_9rvB-#DBapx7OwPFk}z2@n7YB*q2&c)dIPt(3g@Tw+Aspv2I+&n%P}1b>P$&F
zkVII)58wVI+LX>`&CA>O!q~_@Xk+)iiKn{R7L+R>{_Vld8*ClhBBD2?1X$hYz)|1*
znz-uDYvl(%-xmdTf+S+vES+P-d&~;-w21=W{IYpa_+d;Z@Po-wp1??Fdm~wA$27Zt-tfgZ6$s{S)CpKBTb>EBeK#x
zCUw!k=)*=178kMazPN!4y?FDLeKmhYEf096WOvD>uu*MC$o7M=>w;tY%cE8jo7
zc)@z_z`yd30H@fdHm`m|z$5N(9Q3ydEhF~}??t0`fuv?J88SIwgJz&XAyz!HAMMoz
zBRS)mtU}gGab2i`Y56u2+7^~1$lyfi!K)`dAemgKULKN3wWd#$0RPV+OGvEmEp!Rg
zJ@B`>+L84$EwW!)6o@vRkG_KG2zTw)7rJ7k3TF5G4vG-&kD(Tx1Wq{+=g5ch%BSYy#vJLLf;Y%zXP8
zI9n)xy6}Sy`0IAd>|n?fv5hp5@}}6m3|g-cBz*J<1!Dw_gMOi427jTpVnB~`e~{Lq
z6RY{U;;73^?j1k{XTr#c`R+T#J3$muc^Nc5%$7!Z%RiTmWLD;7A?`H$hJwydF0x>M
zoqmyM5UaTwV_zwg5*R*jyvc|N-CD%N@uE;J8Ig<~5l5uiK8hTuwE=0Hx%#~~pFbWu
z=6tRlHQ2~bi>*?p%*f0WAXVM*^m;oHrcG=oHDK)Ag4u74bOesB8(Ms&RlTPs4>eZC
zpzU~SK!#60uSm=S)X=a6tJr|Tm1UsCx{}PZaGD;5O>xZ<>zqnZm!Tn-H+hFY|@K`
z%=+cws1k)CPcp6CrFzL-V7TeC5-Mxdp<`)2QG;jtz=D1y>GY>bC2$EJaGjRb>ITaK
z!ilNGcJ<}kZr`vM%f77Yy>BYH6MxCOOW5NWsrn+Wu>AKQbDf6$FOT|sCn5hOs{B!A
zadw5sr>gY?O_@JQ-6(X<4&pn%wIz%!X*WeSn(qbLeJ^ChV0`0%bimlTKhuMxo%i`g
O0ESQS;YKgc)&BuiP1UIY
literal 0
HcmV?d00001
diff --git a/SimpleTools/Tools/AudioManager/AudioManager.png.meta b/SimpleTools/Tools/AudioManager/AudioManager.png.meta
new file mode 100644
index 0000000..61ce9f6
--- /dev/null
+++ b/SimpleTools/Tools/AudioManager/AudioManager.png.meta
@@ -0,0 +1,96 @@
+fileFormatVersion: 2
+guid: af0857324620d1d4b8b6bf41b6cdecfc
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/AudioManager/Sounds.cs b/SimpleTools/Tools/AudioManager/Sounds.cs
new file mode 100644
index 0000000..35e2dd0
--- /dev/null
+++ b/SimpleTools/Tools/AudioManager/Sounds.cs
@@ -0,0 +1,53 @@
+using UnityEngine;
+using UnityEngine.Audio;
+
+namespace SimpleTools.AudioManager {
+ [CreateAssetMenu(fileName = "Sounds", menuName = "Simple Tools/Sounds", order = 11)]
+ public class Sounds : ScriptableObject {
+
+ [Tooltip("The music mixer.")]
+ public AudioMixerGroup mainMixer = default;
+ [Tooltip("The SFX mixer.")]
+ public AudioMixerGroup sfxMixer = default;
+
+ public List[] sounds;
+
+ [System.Serializable]
+ public class List {
+ [Tooltip("Name of the sound. Each name has to be different between each other.")]
+ public string name;
+
+ public AudioClip clip;
+
+ [System.Serializable] public enum Type { Music, SFX }
+ [Space]
+ [Tooltip("Is it part of the music or the SFX?")] public Type type;
+
+ [Space]
+ [Tooltip("Default volume of the sound."), Range(0f, 1f)] public float volume;
+ [Tooltip("Variance percentage of the volume"), Range(0f, 1f)] public float volumeVariance;
+ [Tooltip("Default pitch of the sound."), Range(.1f, 3f)] public float pitch;
+ [Tooltip("Variance percentage of the pitch"), Range(0f, 1f)] public float pitchVariance;
+
+ public bool loop;
+
+ [HideInInspector] public AudioSource source;
+
+ float randomVolume;
+ public float RandomVolume {
+ get {
+ randomVolume = volume * (1f + Random.Range(-volumeVariance / 2f, volumeVariance / 2f));
+ return randomVolume;
+ }
+ }
+
+ float randomPitch;
+ public float RandomPitch {
+ get {
+ randomPitch = pitch * (1f + Random.Range(-pitchVariance / 2f, pitchVariance / 2f));
+ return randomPitch;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/AudioManager/Sounds.cs.meta b/SimpleTools/Tools/AudioManager/Sounds.cs.meta
new file mode 100644
index 0000000..a22e5ea
--- /dev/null
+++ b/SimpleTools/Tools/AudioManager/Sounds.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6ded47588579f3047b1c3cd72cd87044
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {fileID: 2800000, guid: af0857324620d1d4b8b6bf41b6cdecfc, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Cinemachine.meta b/SimpleTools/Tools/Cinemachine.meta
new file mode 100644
index 0000000..608d7cd
--- /dev/null
+++ b/SimpleTools/Tools/Cinemachine.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5a2ff5ceb779d824d811d139fa608262
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs b/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs
new file mode 100644
index 0000000..8afd47a
--- /dev/null
+++ b/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs
@@ -0,0 +1,40 @@
+using UnityEngine;
+using Cinemachine;
+
+namespace SimpleTools.Cinemachine {
+ public class CMCameraTrigger : MonoBehaviour {
+
+ CinemachineVirtualCamera vcam;
+
+ void Awake() {
+ vcam = GetComponentInChildren(true);
+ vcam.gameObject.SetActive(false);
+ }
+
+ #region 3D
+ void OnTriggerEnter(Collider col) {
+ if (col.CompareTag("Player")) {
+ vcam.gameObject.SetActive(true);
+ }
+ }
+ void OnTriggerExit(Collider col) {
+ if (col.CompareTag("Player")) {
+ vcam.gameObject.SetActive(true);
+ }
+ }
+ #endregion
+
+ #region 2D
+ void OnTriggerEnter2D(Collider2D col) {
+ if (col.CompareTag("Player")) {
+ vcam.gameObject.SetActive(true);
+ }
+ }
+ void OnTriggerExit2D(Collider2D col) {
+ if (col.CompareTag("Player")) {
+ vcam.gameObject.SetActive(false);
+ }
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs.meta b/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs.meta
new file mode 100644
index 0000000..7d3bb42
--- /dev/null
+++ b/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 368758c1440a4cb4c867e140e8934c09
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Cinemachine/ScreenShake.cs b/SimpleTools/Tools/Cinemachine/ScreenShake.cs
new file mode 100644
index 0000000..5d4aaa5
--- /dev/null
+++ b/SimpleTools/Tools/Cinemachine/ScreenShake.cs
@@ -0,0 +1,38 @@
+using Cinemachine;
+using UnityEngine;
+
+namespace SimpleTools.Cinemachine {
+ public static class ScreenShake {
+
+ static CinemachineVirtualCamera vCam;
+ static ScreenShakeUpdate shakeUpdate;
+
+ class ScreenShakeUpdate : MonoBehaviour {
+ [HideInInspector] public float shakeTimer;
+ [HideInInspector] public float shakeTimerTotal;
+ [HideInInspector] public float startingIntensity;
+
+ void Update() {
+ if (shakeTimer > 0) {
+ shakeTimer -= Time.deltaTime;
+ CinemachineBasicMultiChannelPerlin multiChannelPerlin = vCam.GetCinemachineComponent();
+ multiChannelPerlin.m_AmplitudeGain = Mathf.Lerp(startingIntensity, 0f, 1 - (shakeTimer / shakeTimerTotal));
+ }
+ }
+ }
+
+ /// Shake the camera
+ /// It needs a cinemachine camera with a noise profile in it.
+ ///
+ public static void Shake(float intensity, float time) {
+ if (vCam == null) {
+ vCam = Camera.main.GetComponent().ActiveVirtualCamera.VirtualCameraGameObject.GetComponent();
+ }
+ if (shakeUpdate == null) {
+ shakeUpdate = new GameObject("ShakeUpdate").AddComponent();
+ }
+ shakeUpdate.startingIntensity = intensity;
+ shakeUpdate.shakeTimer = shakeUpdate.shakeTimerTotal = time;
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/Cinemachine/ScreenShake.cs.meta b/SimpleTools/Tools/Cinemachine/ScreenShake.cs.meta
new file mode 100644
index 0000000..048e505
--- /dev/null
+++ b/SimpleTools/Tools/Cinemachine/ScreenShake.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 181034c7ad5ece241a2737ab35d47c5c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem.meta b/SimpleTools/Tools/DialogueSystem.meta
new file mode 100644
index 0000000..b94d838
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 645cca644899cc74882ea9bc1d9c5aa9
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.cs b/SimpleTools/Tools/DialogueSystem/Dialogue.cs
new file mode 100644
index 0000000..7b9ce5a
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/Dialogue.cs
@@ -0,0 +1,16 @@
+using UnityEngine;
+
+namespace SimpleTools.DialogueSystem {
+ [CreateAssetMenu(fileName = "New Dialogue", menuName = "Simple Tools/Dialogue", order = 11)]
+ public class Dialogue : ScriptableObject {
+ public DialogueBox[] sentences;
+ }
+
+ [System.Serializable]
+ public class DialogueBox {
+ public bool displayName;
+ public string characterName;
+ public Sprite characterImage;
+ [TextArea(5, 10)] public string sentence;
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.cs.meta b/SimpleTools/Tools/DialogueSystem/Dialogue.cs.meta
new file mode 100644
index 0000000..63ccf99
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/Dialogue.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bd553cd05b84d614b998afe62e37c17c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {fileID: 2800000, guid: 4dfc626116fd10c4f972c17720d957ac, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.png b/SimpleTools/Tools/DialogueSystem/Dialogue.png
new file mode 100644
index 0000000000000000000000000000000000000000..3bff2d35af56bc93cbb250520d3bfcca02168d49
GIT binary patch
literal 2405
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
X65^Z_x-SEH00000NkvXXu0mjf!ZT!a
literal 0
HcmV?d00001
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.png.meta b/SimpleTools/Tools/DialogueSystem/Dialogue.png.meta
new file mode 100644
index 0000000..4991597
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/Dialogue.png.meta
@@ -0,0 +1,96 @@
+fileFormatVersion: 2
+guid: 4dfc626116fd10c4f972c17720d957ac
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueManager.cs b/SimpleTools/Tools/DialogueSystem/DialogueManager.cs
new file mode 100644
index 0000000..4b025a9
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/DialogueManager.cs
@@ -0,0 +1,111 @@
+using System.Collections.Generic;
+using TMPro;
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace SimpleTools.DialogueSystem {
+ public class DialogueManager : MonoBehaviour {
+
+ DialogueVertexAnimator dialogueVertexAnimator;
+
+ Queue sentences;
+ Queue displayNames;
+ Queue characterNames;
+ Queue characterImages;
+ bool talking;
+
+ public DialogueItems dialogueItems;
+
+ public static DialogueManager instance;
+ void Awake() {
+ instance = this;
+ sentences = new Queue();
+ displayNames = new Queue();
+ characterNames = new Queue();
+ characterImages = new Queue();
+
+ dialogueVertexAnimator = new DialogueVertexAnimator(dialogueItems.textBox);
+ }
+
+ public bool Dialogue(Dialogue dialogue) {
+ return Dialogue(dialogue, string.Empty);
+ }
+
+ public bool Dialogue(Dialogue dialogue, params string[] sounds) {
+ dialogueVertexAnimator.SetAudioSourceGroup(sounds);
+
+ if (!talking) {
+ sentences.Clear();
+ if (dialogue.sentences.Length != 0) {
+ foreach (DialogueBox sentence in dialogue.sentences) {
+ sentences.Enqueue(sentence.sentence);
+ displayNames.Enqueue(sentence.displayName);
+ characterNames.Enqueue(sentence.characterName);
+ characterImages.Enqueue(sentence.characterImage);
+ }
+ } else {
+ sentences.Enqueue("I am error. No text has been added");
+ }
+ talking = true;
+
+ if (sentences.Count == 0) {
+ talking = false;
+ return false;
+ }
+
+ string sentenceToShow = sentences.Peek();
+ bool displayName = displayNames.Peek();
+ string characterName = characterNames.Peek();
+ Sprite characterImage = characterImages.Peek();
+ if (PlayDialogue(sentenceToShow, displayName, characterName, characterImage)) {
+ sentences.Dequeue();
+ displayNames.Dequeue();
+ characterNames.Dequeue();
+ characterImages.Dequeue();
+ }
+ return true;
+ } else {
+ if (sentences.Count == 0) {
+ talking = false;
+ return false;
+ }
+
+ string sentenceToShow = sentences.Peek();
+ bool displayName = displayNames.Peek();
+ string characterName = characterNames.Peek();
+ Sprite characterImage = characterImages.Peek();
+ if (PlayDialogue(sentenceToShow, displayName, characterName, characterImage)) {
+ sentences.Dequeue();
+ displayNames.Dequeue();
+ characterNames.Dequeue();
+ characterImages.Dequeue();
+ }
+ return true;
+ }
+ }
+
+ private Coroutine typeRoutine = null;
+ bool PlayDialogue(string message, bool displayName = false, string characterName = "", Sprite characterImage = null) {
+ if (dialogueVertexAnimator.IsMessageAnimating()) {
+ dialogueVertexAnimator.SkipToEndOfCurrentMessage();
+ return false; //Next message hasn't been shown because the current one is still animating.
+ }
+ this.EnsureCoroutineStopped(ref typeRoutine);
+ dialogueVertexAnimator.textAnimating = false;
+ List commands = DialogueUtility.ProcessInputString(message, out string totalTextMessage);
+ typeRoutine = StartCoroutine(dialogueVertexAnimator.AnimateTextIn(commands, totalTextMessage, null));
+
+ dialogueItems.characterImage.sprite = characterImage;
+ dialogueItems.characterName.text = displayName ? characterName : "???";
+ return true; //Next message shown successfully
+ }
+ }
+
+ [System.Serializable]
+ public struct DialogueItems {
+ public Image characterImage;
+ public TMP_Text characterName;
+ public TMP_Text textBox;
+ public Canvas canvas;
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueManager.cs.meta b/SimpleTools/Tools/DialogueSystem/DialogueManager.cs.meta
new file mode 100644
index 0000000..1cc6cbc
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/DialogueManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 23d6a059fd2bc464a9cba3a5ced1724d
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs b/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs
new file mode 100644
index 0000000..98a67c3
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs
@@ -0,0 +1,170 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+using System;
+
+namespace SimpleTools.DialogueSystem {
+ public class DialogueUtility : MonoBehaviour {
+
+ // grab the remainder of the text until ">" or end of string
+ const string REMAINDER_REGEX = "(.*?((?=>)|(/|$)))";
+ const string PAUSE_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
+ static readonly Regex pauseRegex = new Regex(PAUSE_REGEX_STRING);
+ const string SOUND_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
+ static readonly Regex soundRegex = new Regex(SOUND_REGEX_STRING);
+ const string SPEED_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
+ static readonly Regex speedRegex = new Regex(SPEED_REGEX_STRING);
+ const string ANIM_START_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
+ static readonly Regex animStartRegex = new Regex(ANIM_START_REGEX_STRING);
+ const string ANIM_END_REGEX_STRING = "";
+ static readonly Regex animEndRegex = new Regex(ANIM_END_REGEX_STRING);
+
+ static readonly Dictionary pauseDictionary = new Dictionary{
+ { "tiny", .1f },
+ { "short", .25f },
+ { "normal", 0.666f },
+ { "long", 1f },
+ { "read", 2f },
+ };
+
+ public static List ProcessInputString(string message, out string processedMessage) {
+ List result = new List();
+ processedMessage = message;
+
+ processedMessage = HandlePauseTags(processedMessage, result);
+ processedMessage = HandleSoundTags(processedMessage, result);
+ processedMessage = HandleSpeedTags(processedMessage, result);
+ processedMessage = HandleAnimStartTags(processedMessage, result);
+ processedMessage = HandleAnimEndTags(processedMessage, result);
+
+ return result;
+ }
+
+ static string HandleAnimEndTags(string processedMessage, List result) {
+ MatchCollection animEndMatches = animEndRegex.Matches(processedMessage);
+ foreach (Match match in animEndMatches) {
+ result.Add(new DialogueCommand {
+ position = VisibleCharactersUpToIndex(processedMessage, match.Index),
+ type = DialogueCommandType.AnimEnd,
+ });
+ }
+ processedMessage = Regex.Replace(processedMessage, ANIM_END_REGEX_STRING, "");
+ return processedMessage;
+ }
+
+ static string HandleAnimStartTags(string processedMessage, List result) {
+ MatchCollection animStartMatches = animStartRegex.Matches(processedMessage);
+ foreach (Match match in animStartMatches) {
+ string stringVal = match.Groups["anim"].Value;
+ result.Add(new DialogueCommand {
+ position = VisibleCharactersUpToIndex(processedMessage, match.Index),
+ type = DialogueCommandType.AnimStart,
+ textAnimValue = GetTextAnimationType(stringVal)
+ });
+ }
+ processedMessage = Regex.Replace(processedMessage, ANIM_START_REGEX_STRING, "");
+ return processedMessage;
+ }
+
+ static string HandleSpeedTags(string processedMessage, List result) {
+ MatchCollection speedMatches = speedRegex.Matches(processedMessage);
+ foreach (Match match in speedMatches) {
+ string stringVal = match.Groups["speed"].Value;
+ if (!float.TryParse(stringVal, out float val)) {
+ val = 150f;
+ }
+ result.Add(new DialogueCommand {
+ position = VisibleCharactersUpToIndex(processedMessage, match.Index),
+ type = DialogueCommandType.TextSpeedChange,
+ floatValue = val
+ });
+ }
+ processedMessage = Regex.Replace(processedMessage, SPEED_REGEX_STRING, "");
+ return processedMessage;
+ }
+
+ static string HandlePauseTags(string processedMessage, List result) {
+ MatchCollection pauseMatches = pauseRegex.Matches(processedMessage);
+ foreach (Match match in pauseMatches) {
+ string val = match.Groups["pause"].Value;
+ string pauseName = val;
+ Debug.Assert(pauseDictionary.ContainsKey(pauseName), "no pause registered for '" + pauseName + "'");
+ result.Add(new DialogueCommand {
+ position = VisibleCharactersUpToIndex(processedMessage, match.Index),
+ type = DialogueCommandType.Pause,
+ floatValue = pauseDictionary[pauseName]
+ });
+ }
+ processedMessage = Regex.Replace(processedMessage, PAUSE_REGEX_STRING, "");
+ return processedMessage;
+ }
+ static string HandleSoundTags(string processedMessage, List result) {
+ MatchCollection soundMatches = soundRegex.Matches(processedMessage);
+ foreach (Match match in soundMatches) {
+ string val = match.Groups["sound"].Value;
+ string soundName = val;
+ result.Add(new DialogueCommand {
+ position = VisibleCharactersUpToIndex(processedMessage, match.Index),
+ type = DialogueCommandType.Sound,
+ stringValue = soundName
+ });
+ }
+ processedMessage = Regex.Replace(processedMessage, SOUND_REGEX_STRING, "");
+ return processedMessage;
+ }
+
+ static TextAnimationType GetTextAnimationType(string stringVal) {
+ TextAnimationType result;
+ try {
+ result = (TextAnimationType)Enum.Parse(typeof(TextAnimationType), stringVal, true);
+ } catch (ArgumentException) {
+ Debug.LogError("Invalid Text Animation Type: " + stringVal);
+ result = TextAnimationType.none;
+ }
+ return result;
+ }
+
+ static int VisibleCharactersUpToIndex(string message, int index) {
+ int result = 0;
+ bool insideBrackets = false;
+ for (int i = 0; i < index; i++) {
+ if (message[i] == '<') {
+ insideBrackets = true;
+ } else if (message[i] == '>') {
+ insideBrackets = false;
+ result--;
+ }
+ if (!insideBrackets) {
+ result++;
+ } else if (i + 6 < index && message.Substring(i, 6) == "sprite") {
+ result++;
+ }
+ }
+ return result;
+ }
+ }
+ public struct DialogueCommand {
+ public int position;
+ public DialogueCommandType type;
+ public float floatValue;
+ public string stringValue;
+ public TextAnimationType textAnimValue;
+ }
+
+ public enum DialogueCommandType {
+ Pause,
+ TextSpeedChange,
+ AnimStart,
+ AnimEnd,
+ Sound
+ }
+
+ public enum TextAnimationType {
+ none,
+ shake,
+ wave,
+ wobble,
+ rainbow,
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs.meta b/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs.meta
new file mode 100644
index 0000000..a98dbdc
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d4649243ed65dff45b7891eed22eb4c6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs b/SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs
new file mode 100644
index 0000000..24eb6e4
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs
@@ -0,0 +1,265 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using TMPro;
+using UnityEngine;
+
+namespace SimpleTools.DialogueSystem {
+ public class DialogueVertexAnimator {
+ public bool textAnimating = false;
+ bool stopAnimating = false;
+
+ readonly TMP_Text textBox;
+ string[] audioSourceGroup;
+ public void SetAudioSourceGroup(params string[] _audioSourceGroup) {
+ audioSourceGroup = _audioSourceGroup;
+ }
+ public DialogueVertexAnimator(TMP_Text _textBox) {
+ textBox = _textBox;
+ }
+
+ static readonly Color32 clear = new Color32(0, 0, 0, 0);
+ const float CHAR_ANIM_TIME = 0.07f;
+ static readonly Vector3 vecZero = Vector3.zero;
+ public IEnumerator AnimateTextIn(List commands, string processedMessage, Action onFinish) {
+ textAnimating = true;
+ float secondsPerCharacter = 1f / 150f;
+ float timeOfLastCharacter = 0;
+
+ TextAnimInfo[] textAnimInfo = SeparateOutTextAnimInfo(commands);
+ TMP_TextInfo textInfo = textBox.textInfo;
+ for (int i = 0; i < textInfo.meshInfo.Length; i++) {
+ TMP_MeshInfo meshInfer = textInfo.meshInfo[i];
+ if (meshInfer.vertices != null) {
+ for (int j = 0; j < meshInfer.vertices.Length; j++) {
+ meshInfer.vertices[j] = vecZero;
+ }
+ }
+ }
+
+ textBox.text = processedMessage;
+ textBox.ForceMeshUpdate();
+
+ TMP_MeshInfo[] cachedMeshInfo = textInfo.CopyMeshInfoVertexData();
+ Color32[][] originalColors = new Color32[textInfo.meshInfo.Length][];
+ for (int i = 0; i < originalColors.Length; i++) {
+ Color32[] theColors = textInfo.meshInfo[i].colors32;
+ originalColors[i] = new Color32[theColors.Length];
+ Array.Copy(theColors, originalColors[i], theColors.Length);
+ }
+ int charCount = textInfo.characterCount;
+ float[] charAnimStartTimes = new float[charCount];
+ for (int i = 0; i < charCount; i++) {
+ charAnimStartTimes[i] = -1;
+ }
+ int visableCharacterIndex = 0;
+ while (true) {
+ if (stopAnimating) {
+ for (int i = visableCharacterIndex; i < charCount; i++) {
+ charAnimStartTimes[i] = Time.unscaledTime;
+ }
+ visableCharacterIndex = charCount;
+ FinishAnimating(onFinish);
+ }
+ if (ShouldShowNextCharacter(secondsPerCharacter, timeOfLastCharacter)) {
+ if (visableCharacterIndex <= charCount) {
+ ExecuteCommandsForCurrentIndex(commands, visableCharacterIndex, ref secondsPerCharacter, ref timeOfLastCharacter);
+ if (visableCharacterIndex < charCount && ShouldShowNextCharacter(secondsPerCharacter, timeOfLastCharacter)) {
+ charAnimStartTimes[visableCharacterIndex] = Time.unscaledTime;
+ PlayDialogueSound();
+ visableCharacterIndex++;
+ timeOfLastCharacter = Time.unscaledTime;
+ if (visableCharacterIndex == charCount) {
+ FinishAnimating(onFinish);
+ }
+ }
+ }
+ }
+ for (int j = 0; j < charCount; j++) {
+ TMP_CharacterInfo charInfo = textInfo.characterInfo[j];
+ if (charInfo.isVisible) {
+ int vertexIndex = charInfo.vertexIndex;
+ int materialIndex = charInfo.materialReferenceIndex;
+ Color32[] destinationColors = textInfo.meshInfo[materialIndex].colors32;
+ Color32 theColor = j < visableCharacterIndex ? originalColors[materialIndex][vertexIndex] : clear;
+ destinationColors[vertexIndex + 0] = theColor;
+ destinationColors[vertexIndex + 1] = theColor;
+ destinationColors[vertexIndex + 2] = theColor;
+ destinationColors[vertexIndex + 3] = theColor;
+
+ Vector3[] sourceVertices = cachedMeshInfo[materialIndex].vertices;
+ Vector3[] destinationVertices = textInfo.meshInfo[materialIndex].vertices;
+ float charSize = 0;
+ float charAnimStartTime = charAnimStartTimes[j];
+ if (charAnimStartTime >= 0) {
+ float timeSinceAnimStart = Time.unscaledTime - charAnimStartTime;
+ charSize = Mathf.Min(1, timeSinceAnimStart / CHAR_ANIM_TIME);
+ }
+
+ Vector3 animPosAdjustment = GetAnimPosAdjustment(textAnimInfo, j, textBox.fontSize, Time.unscaledTime);
+ Vector3 offset = (sourceVertices[vertexIndex + 0] + sourceVertices[vertexIndex + 2]) / 2;
+ destinationVertices[vertexIndex + 0] = ((sourceVertices[vertexIndex + 0] - offset) * charSize) + offset + animPosAdjustment;
+ destinationVertices[vertexIndex + 1] = ((sourceVertices[vertexIndex + 1] - offset) * charSize) + offset + animPosAdjustment;
+ destinationVertices[vertexIndex + 2] = ((sourceVertices[vertexIndex + 2] - offset) * charSize) + offset + animPosAdjustment;
+ destinationVertices[vertexIndex + 3] = ((sourceVertices[vertexIndex + 3] - offset) * charSize) + offset + animPosAdjustment;
+ for (int i = 0; i < 4; i++) {
+ Vector3 animVertexAdjustment = GetAnimVertexAdjustment(textAnimInfo, j, textBox.fontSize, Time.unscaledTime + i);
+ destinationVertices[vertexIndex + i] += animVertexAdjustment;
+
+ Color animColorAdjustment = GetAnimColorAdjustment(textAnimInfo, j, Time.unscaledTime + i, destinationVertices[vertexIndex + i]);
+ if (animColorAdjustment == Color.white)
+ continue;
+ destinationColors[vertexIndex + i] += animColorAdjustment;
+ }
+ }
+ }
+ textBox.UpdateVertexData(TMP_VertexDataUpdateFlags.Colors32);
+ for (int i = 0; i < textInfo.meshInfo.Length; i++) {
+ TMP_MeshInfo theInfo = textInfo.meshInfo[i];
+ theInfo.mesh.vertices = theInfo.vertices;
+ textBox.UpdateGeometry(theInfo.mesh, i);
+ }
+ yield return null;
+ }
+ }
+
+ void ExecuteCommandsForCurrentIndex(List commands, int visableCharacterIndex, ref float secondsPerCharacter, ref float timeOfLastCharacter) {
+ for (int i = 0; i < commands.Count; i++) {
+ DialogueCommand command = commands[i];
+ if (command.position == visableCharacterIndex) {
+ switch (command.type) {
+ case DialogueCommandType.Pause:
+ timeOfLastCharacter = Time.unscaledTime + command.floatValue;
+ break;
+ case DialogueCommandType.TextSpeedChange:
+ secondsPerCharacter = 1f / command.floatValue;
+ break;
+ case DialogueCommandType.Sound:
+ AudioManager.AudioManager.instance.PlayOneShot(command.stringValue);
+ break;
+ }
+ commands.RemoveAt(i);
+ i--;
+ }
+ }
+ }
+
+ void FinishAnimating(Action onFinish) {
+ textAnimating = false;
+ stopAnimating = false;
+ onFinish?.Invoke();
+ }
+
+ const float NOISE_MAGNITUDE_ADJUSTMENT = 0.06f;
+ const float NOISE_FREQUENCY_ADJUSTMENT = 15f;
+ const float WAVE_MAGNITUDE_ADJUSTMENT = 0.06f;
+ const float WOBBLE_MAGNITUDE_ADJUSTMENT = 0.5f;
+ const float RAINBOW_LENGTH_ADJUSTMENT = .001f;
+ Vector3 GetAnimPosAdjustment(TextAnimInfo[] textAnimInfo, int charIndex, float fontSize, float time) {
+ float x = 0;
+ float y = 0;
+ for (int i = 0; i < textAnimInfo.Length; i++) {
+ TextAnimInfo info = textAnimInfo[i];
+ if (charIndex >= info.startIndex && charIndex < info.endIndex) {
+ if (info.type == TextAnimationType.shake) {
+ float scaleAdjust = fontSize * NOISE_MAGNITUDE_ADJUSTMENT;
+ x += (Mathf.PerlinNoise((charIndex + time) * NOISE_FREQUENCY_ADJUSTMENT, 0) - 0.5f) * scaleAdjust;
+ y += (Mathf.PerlinNoise((charIndex + time) * NOISE_FREQUENCY_ADJUSTMENT, 1000) - 0.5f) * scaleAdjust;
+ } else if (info.type == TextAnimationType.wave) {
+ y += Mathf.Sin((charIndex * 1.5f) + (time * 6)) * fontSize * WAVE_MAGNITUDE_ADJUSTMENT;
+ }
+ }
+ }
+ return new Vector3(x, y, 0);
+ }
+
+ Vector3 GetAnimVertexAdjustment(TextAnimInfo[] textAnimInfo, int charIndex, float fontSize, float time) {
+ float x = 0;
+ float y = 0;
+ for (int i = 0; i < textAnimInfo.Length; i++) {
+ TextAnimInfo info = textAnimInfo[i];
+ if (charIndex >= info.startIndex && charIndex < info.endIndex) {
+ if (info.type == TextAnimationType.wobble) {
+ float scaleAdjust = fontSize * NOISE_MAGNITUDE_ADJUSTMENT;
+ x = Mathf.Sin(time * 3.3f) * scaleAdjust * WOBBLE_MAGNITUDE_ADJUSTMENT;
+ y = Mathf.Cos(time * 2.5f) * scaleAdjust * WOBBLE_MAGNITUDE_ADJUSTMENT;
+ }
+ }
+ }
+ return new Vector3(x, y, 0);
+ }
+ Color GetAnimColorAdjustment(TextAnimInfo[] textAnimInfo, int charIndex, float time, Vector3 destinationVertice) {
+ Color color = Color.white;
+ for (int i = 0; i < textAnimInfo.Length; i++) {
+ TextAnimInfo info = textAnimInfo[i];
+ if (charIndex >= info.startIndex && charIndex < info.endIndex) {
+ if (info.type == TextAnimationType.rainbow) {
+ color = Color.HSVToRGB(Mathf.Repeat((time + destinationVertice.x * RAINBOW_LENGTH_ADJUSTMENT), 1f), .6f, 1);
+ }
+ }
+ }
+ return color;
+ }
+
+ static bool ShouldShowNextCharacter(float secondsPerCharacter, float timeOfLastCharacter) {
+ return (Time.unscaledTime - timeOfLastCharacter) > secondsPerCharacter;
+ }
+ public void SkipToEndOfCurrentMessage() {
+ if (textAnimating) {
+ stopAnimating = true;
+ }
+ }
+ public bool IsMessageAnimating() {
+ return textAnimating;
+ }
+
+ float timeUntilNextDialogueSound = 0;
+ float lastDialogueSound = 0;
+ void PlayDialogueSound() {
+ if (Time.unscaledTime - lastDialogueSound > timeUntilNextDialogueSound) {
+ timeUntilNextDialogueSound = UnityEngine.Random.Range(0.02f, 0.08f);
+ lastDialogueSound = Time.unscaledTime;
+ if (audioSourceGroup[0] != string.Empty)
+ AudioManager.AudioManager.instance.PlayRandomSound(audioSourceGroup);
+ }
+ }
+
+ TextAnimInfo[] SeparateOutTextAnimInfo(List commands) {
+ List tempResult = new List();
+ List animStartCommands = new List();
+ List animEndCommands = new List();
+ for (int i = 0; i < commands.Count; i++) {
+ DialogueCommand command = commands[i];
+ if (command.type == DialogueCommandType.AnimStart) {
+ animStartCommands.Add(command);
+ commands.RemoveAt(i);
+ i--;
+ } else if (command.type == DialogueCommandType.AnimEnd) {
+ animEndCommands.Add(command);
+ commands.RemoveAt(i);
+ i--;
+ }
+ }
+ if (animStartCommands.Count != animEndCommands.Count) {
+ Debug.LogError("Unequal number of start and end animation commands. Start Commands: " + animStartCommands.Count + " End Commands: " + animEndCommands.Count);
+ } else {
+ for (int i = 0; i < animStartCommands.Count; i++) {
+ DialogueCommand startCommand = animStartCommands[i];
+ DialogueCommand endCommand = animEndCommands[i];
+ tempResult.Add(new TextAnimInfo {
+ startIndex = startCommand.position,
+ endIndex = endCommand.position,
+ type = startCommand.textAnimValue
+ });
+ }
+ }
+ return tempResult.ToArray();
+ }
+ }
+
+ public struct TextAnimInfo {
+ public int startIndex;
+ public int endIndex;
+ public TextAnimationType type;
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs.meta b/SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs.meta
new file mode 100644
index 0000000..8f15ab6
--- /dev/null
+++ b/SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: dcef7fafd8716284392e9621424bfa6a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Editor.meta b/SimpleTools/Tools/Editor.meta
new file mode 100644
index 0000000..550a16f
--- /dev/null
+++ b/SimpleTools/Tools/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 53d517df853ee5d44b788e900f897c54
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Editor/Square.png b/SimpleTools/Tools/Editor/Square.png
new file mode 100644
index 0000000000000000000000000000000000000000..8eb1b1ecc13b6e1d2375151866134cd7a040340c
GIT binary patch
literal 78
zcmeAS@N?(olHy`uVBq!ia0vp^EFjFm1|(O0oL2{=L_J*`LpWrU|M0W$cr!i
aF)*;jval%k();
+ }
+
+ [MenuItem("GameObject/Simple Tools/Dialogue System", false, 10)]
+ static void CreateDialogueSystem(){
+ GameObject dialogueCanvas = new GameObject("DialogueCanvas");
+ dialogueCanvas.AddComponent();
+ Canvas canvas = dialogueCanvas.AddComponent();
+ canvas.renderMode = RenderMode.ScreenSpaceOverlay;
+ dialogueCanvas.AddComponent();
+ dialogueCanvas.AddComponent();
+
+ GameObject text = new GameObject("DialogueText");
+ text.transform.SetParent(dialogueCanvas.transform);
+ text.AddComponent().text = "Dialogue";
+ text.GetComponent().anchoredPosition = Vector2.zero;
+
+ GameObject name = new GameObject("NameText");
+ name.transform.SetParent(dialogueCanvas.transform);
+ name.AddComponent().text = "Name";
+ name.GetComponent().anchoredPosition = Vector2.up * 50f;
+
+ GameObject image = new GameObject("Image");
+ image.transform.SetParent(dialogueCanvas.transform);
+ image.AddComponent();
+ image.GetComponent().anchoredPosition = new Vector2(-150f, 25f);
+
+ DialogueManager dialogueManager = dialogueCanvas.AddComponent();
+ Debug.Log(dialogueManager.dialogueItems);
+ dialogueManager.dialogueItems.textBox = text.GetComponent();
+ dialogueManager.dialogueItems.characterName = name.GetComponent();
+ dialogueManager.dialogueItems.characterImage = image.GetComponent();
+ dialogueManager.dialogueItems.canvas = canvas;
+ //DialogueSystem dialogueSystem = dialogueCanvas.AddComponent();
+ //dialogueSystem.nameText = name.GetComponent();
+ //dialogueSystem.dialogue = text.GetComponent();
+ //dialogueSystem.faceImage = image.GetComponent();
+ //dialogueSystem.nameField = name;
+ }
+
+ [MenuItem("GameObject/Simple Tools/Camera Trigger/2D", false, 10)]
+ static void CreateCameraTrigger2D(){
+ GameObject cameraTrigger = new GameObject("CameraTrigger2D");
+ cameraTrigger.AddComponent();
+ cameraTrigger.AddComponent();
+
+ GameObject vCam = new GameObject("CM vcam1");
+ vCam.transform.SetParent(cameraTrigger.transform);
+ vCam.SetActive(false);
+ CinemachineVirtualCamera cam = vCam.AddComponent();
+ cam.m_Lens.Orthographic = true;
+ }
+
+ [MenuItem("GameObject/Simple Tools/Camera Trigger/3D", false, 10)]
+ static void CreateCameraTrigger3D(){
+ GameObject cameraTrigger = new GameObject("CameraTrigger3D");
+ cameraTrigger.AddComponent();
+ cameraTrigger.AddComponent();
+
+ GameObject vCam = new GameObject("CM vcam1");
+ vCam.transform.SetParent(cameraTrigger.transform);
+ vCam.SetActive(false);
+ CinemachineVirtualCamera cam = vCam.AddComponent();
+ cam.m_Lens.FieldOfView = 60f;
+ }
+
+#if CINEMACHINE_271_OR_NEWER
+ [MenuItem("GameObject/Simple Tools/ScreenShake Camera/2D", false, 10)]
+ static void CreateScreenShakeCamera2d(){
+ GameObject screenShakeCamera = new GameObject("ScreenShakeCamera");
+ CinemachineVirtualCamera vCam = screenShakeCamera.AddComponent();
+ vCam.m_Lens.ModeOverride = LensSettings.OverrideModes.Orthographic;
+
+ CinemachineBasicMultiChannelPerlin shake = vCam.AddCinemachineComponent();
+
+ NoiseSettings noise = (NoiseSettings)AssetDatabase.LoadAssetAtPath("Packages/com.unity.cinemachine/Presets/Noise/6D Shake.asset", typeof(NoiseSettings));
+
+ shake.m_NoiseProfile = noise;
+ shake.m_AmplitudeGain = 0f;
+ shake.m_FrequencyGain = 1f;
+ }
+ [MenuItem("GameObject/Simple Tools/ScreenShake Camera/3D", false, 10)]
+ static void CreateScreenShakeCamera3d(){
+ GameObject screenShakeCamera = new GameObject("ScreenShakeCamera");
+ CinemachineVirtualCamera vCam = screenShakeCamera.AddComponent();
+ vCam.m_Lens.ModeOverride = LensSettings.OverrideModes.Perspective;
+
+ CinemachineBasicMultiChannelPerlin shake = vCam.AddCinemachineComponent();
+
+ NoiseSettings noise = (NoiseSettings)AssetDatabase.LoadAssetAtPath("Packages/com.unity.cinemachine/Presets/Noise/6D Shake.asset", typeof(NoiseSettings));
+
+ shake.m_NoiseProfile = noise;
+ shake.m_AmplitudeGain = 0f;
+ shake.m_FrequencyGain = 1f;
+ }
+#else
+ [MenuItem("GameObject/Simple Tools/ScreenShake Camera", false, 10)]
+ static void CreateScreenShakeCamera2d(){
+ GameObject screenShakeCamera = new GameObject("ScreenShakeCamera");
+ CinemachineVirtualCamera vCam = screenShakeCamera.AddComponent();
+
+ CinemachineBasicMultiChannelPerlin shake = vCam.AddCinemachineComponent();
+
+ NoiseSettings noise = (NoiseSettings)AssetDatabase.LoadAssetAtPath("Packages/com.unity.cinemachine/Presets/Noise/6D Shake.asset", typeof(NoiseSettings));
+
+ shake.m_NoiseProfile = noise;
+ shake.m_AmplitudeGain = 0f;
+ shake.m_FrequencyGain = 1f;
+ }
+#endif
+
+ [MenuItem("Assets/Create/Simple Tools/Create Loading Scene")]
+ [MenuItem("Simple Tools/Create Loading Scene")]
+ static void CreateLoadingScene(){
+ EditorSceneManager.SaveOpenScenes();
+
+ Scene loadingScene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
+ loadingScene.name = "Loading";
+
+ GameObject loaderCallback = new GameObject("LoaderCallback");
+ loaderCallback.AddComponent();
+
+ GameObject canvasObj = new GameObject("Canvas");
+ Canvas canvas = canvasObj.AddComponent();
+ canvas.renderMode = RenderMode.ScreenSpaceOverlay;
+
+ CanvasScaler canvasScaler = canvasObj.AddComponent();
+ canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
+ canvasScaler.referenceResolution = new Vector2Int(951, 535);
+ canvasScaler.matchWidthOrHeight = 1f;
+
+ canvasObj.AddComponent();
+
+ TextMeshProUGUI loadingText = new GameObject("LoadingText").AddComponent();
+ loadingText.transform.SetParent(canvasObj.transform);
+ RectTransform loadingTextTransform = loadingText.GetComponent();
+ loadingTextTransform.anchoredPosition = new Vector2Int(-333, -212);
+ loadingTextTransform.sizeDelta = new Vector2Int(237, 52);
+ loadingText.text = "LOADING...";
+
+ Image bg = new GameObject("bg").AddComponent();
+ bg.transform.SetParent(canvasObj.transform);
+ RectTransform bgTransform = bg.GetComponent();
+ bgTransform.anchoredPosition = new Vector2Int(0, -235);
+ bgTransform.sizeDelta = new Vector2Int(900, 20);
+ bg.color = new Color(36f / 255f, 36f / 255f, 36f / 255f);
+
+ Image progressBar = new GameObject("ProgressBar").AddComponent();
+ progressBar.transform.SetParent(bg.transform);
+ RectTransform progressBarTransform = progressBar.GetComponent();
+ progressBarTransform.anchoredPosition = Vector2.zero;
+ progressBarTransform.sizeDelta = new Vector2Int(900, 20);
+
+ progressBar.sprite = (Sprite)AssetDatabase.LoadAssetAtPath("Packages/com.geri.simpletools/Simple Tools/Editor/Square.png", typeof(Sprite));
+ progressBar.type = Image.Type.Filled;
+ progressBar.fillMethod = Image.FillMethod.Horizontal;
+ progressBar.fillOrigin = (int)Image.OriginHorizontal.Left;
+ progressBar.fillAmount = 1f;
+ progressBar.gameObject.AddComponent();
+ }
+
+#if UNITY_2019_3_OR_NEWER
+ [MenuItem("Assets/Create/Simple Tools/Create Menu Scene")]
+ [MenuItem("Simple Tools/Create Menu Scene")]
+ static void CreateMenuScene(){
+ EditorSceneManager.SaveOpenScenes();
+
+ Scene menuScene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
+ menuScene.name = "Menu";
+
+ GameObject canvasObj = new GameObject("Canvas");
+ Canvas canvas = canvasObj.AddComponent();
+ canvas.renderMode = RenderMode.ScreenSpaceOverlay;
+
+ CreateEventSystem(false, null);
+
+ CanvasScaler canvasScaler = canvasObj.AddComponent();
+ canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
+ canvasScaler.referenceResolution = new Vector2Int(951, 535);
+ canvasScaler.matchWidthOrHeight = 1f;
+
+ canvasObj.AddComponent();
+
+ GameObject qualityDropdown = TMP_DefaultControls.CreateDropdown(GetStandardResources());
+ qualityDropdown.transform.SetParent(canvasObj.transform);
+ RectTransform qualityRectTransform = qualityDropdown.GetComponent();
+ qualityRectTransform.anchoredPosition = Vector2.up * 15f;
+ qualityDropdown.name = "QualityDropdown";
+
+ GameObject resolutionDropdown = TMP_DefaultControls.CreateDropdown(GetStandardResources());
+ resolutionDropdown.transform.SetParent(canvasObj.transform);
+ RectTransform resolutionRectTransform = resolutionDropdown.GetComponent();
+ resolutionRectTransform.anchoredPosition = Vector2.down * 15f;
+ resolutionDropdown.name = "ResolutionDropdown";
+
+ GameObject musicSlider;
+ using (new FactorySwapToEditor())
+ musicSlider = DefaultControls.CreateSlider(GetStandardUIResources());
+ musicSlider.transform.SetParent(canvasObj.transform);
+ RectTransform musicRectTransform = musicSlider.GetComponent();
+ musicRectTransform.anchoredPosition = Vector2.down * 40f;
+ musicSlider.name = "MusicSlider";
+
+ GameObject sfxSlider;
+ using (new FactorySwapToEditor())
+ sfxSlider = DefaultControls.CreateSlider(GetStandardUIResources());
+ sfxSlider.transform.SetParent(canvasObj.transform);
+ RectTransform sfxRectTransform = sfxSlider.GetComponent();
+ sfxRectTransform.anchoredPosition = Vector2.down * 60;
+ sfxSlider.name = "MusicSlider";
+
+ GameObject playButton = TMP_DefaultControls.CreateButton(GetStandardResources());
+ playButton.transform.SetParent(canvasObj.transform);
+ TMP_Text playTextComponent = playButton.GetComponentInChildren();
+ playTextComponent.fontSize = 24;
+ playTextComponent.text = "PLAY";
+ RectTransform playRectTransform = playButton.GetComponent();
+ playRectTransform.anchoredPosition = Vector2.up * 45f;
+ playButton.name = "PlayButton";
+
+ GameObject quitButton = TMP_DefaultControls.CreateButton(GetStandardResources());
+ quitButton.transform.SetParent(canvasObj.transform);
+ TMP_Text quitTextComponent = quitButton.GetComponentInChildren();
+ quitTextComponent.fontSize = 24;
+ quitTextComponent.text = "QUIT";
+ RectTransform quitRectTransform = quitButton.GetComponent();
+ quitRectTransform.anchoredPosition = Vector2.down * 85f;
+ quitButton.name = "QuitButton";
+
+ MenuController menuController = canvasObj.AddComponent();
+ Slider sliderMusic = menuController.musicSlider = musicSlider.GetComponent();
+ Slider sliderSfx = menuController.sfxSlider = sfxSlider.GetComponent();
+ TMP_Dropdown dropdownQuality = menuController.qualityDropdown = qualityDropdown.GetComponent();
+ TMP_Dropdown dropdownResolution = menuController.resolutionDropdown = resolutionDropdown.GetComponent();
+
+ sliderMusic.onValueChanged.AddListener(menuController.SetMusicVolume);
+ sliderSfx.onValueChanged.AddListener(menuController.SetSfxVolume);
+ dropdownQuality.onValueChanged.AddListener(menuController.SetQuality);
+ dropdownResolution.onValueChanged.AddListener(menuController.SetResolution);
+
+ playButton.GetComponent().onClick.AddListener(menuController.Play);
+ quitButton.GetComponent().onClick.AddListener(menuController.Quit);
+ }
+
+ #region CreateUISettings
+ const string kUILayerName = "UI";
+
+ const string kStandardSpritePath = "UI/Skin/UISprite.psd";
+ const string kBackgroundSpritePath = "UI/Skin/Background.psd";
+ const string kInputFieldBackgroundPath = "UI/Skin/InputFieldBackground.psd";
+ const string kKnobPath = "UI/Skin/Knob.psd";
+ const string kCheckmarkPath = "UI/Skin/Checkmark.psd";
+ const string kDropdownArrowPath = "UI/Skin/DropdownArrow.psd";
+ const string kMaskPath = "UI/Skin/UIMask.psd";
+
+ static TMP_DefaultControls.Resources s_StandardResources;
+
+ static TMP_DefaultControls.Resources GetStandardResources(){
+ if (s_StandardResources.standard == null){
+ s_StandardResources.standard = AssetDatabase.GetBuiltinExtraResource(kStandardSpritePath);
+ s_StandardResources.background = AssetDatabase.GetBuiltinExtraResource(kBackgroundSpritePath);
+ s_StandardResources.inputField = AssetDatabase.GetBuiltinExtraResource(kInputFieldBackgroundPath);
+ s_StandardResources.knob = AssetDatabase.GetBuiltinExtraResource(kKnobPath);
+ s_StandardResources.checkmark = AssetDatabase.GetBuiltinExtraResource(kCheckmarkPath);
+ s_StandardResources.dropdown = AssetDatabase.GetBuiltinExtraResource(kDropdownArrowPath);
+ s_StandardResources.mask = AssetDatabase.GetBuiltinExtraResource(kMaskPath);
+ }
+ return s_StandardResources;
+ }
+ static void SetPositionVisibleinSceneView(RectTransform canvasRTransform, RectTransform itemTransform){
+ // Find the best scene view
+ SceneView sceneView = SceneView.lastActiveSceneView;
+ if (sceneView == null && SceneView.sceneViews.Count > 0)
+ sceneView = SceneView.sceneViews[0] as SceneView;
+
+ // Couldn't find a SceneView. Don't set position.
+ if (sceneView == null || sceneView.camera == null)
+ return;
+
+ // Create world space Plane from canvas position.
+ Camera camera = sceneView.camera;
+ Vector3 position = Vector3.zero;
+ Vector2 localPlanePosition;
+
+ if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRTransform, new Vector2(camera.pixelWidth / 2, camera.pixelHeight / 2), camera, out localPlanePosition)){
+ // Adjust for canvas pivot
+ localPlanePosition.x = localPlanePosition.x + canvasRTransform.sizeDelta.x * canvasRTransform.pivot.x;
+ localPlanePosition.y = localPlanePosition.y + canvasRTransform.sizeDelta.y * canvasRTransform.pivot.y;
+
+ localPlanePosition.x = Mathf.Clamp(localPlanePosition.x, 0, canvasRTransform.sizeDelta.x);
+ localPlanePosition.y = Mathf.Clamp(localPlanePosition.y, 0, canvasRTransform.sizeDelta.y);
+
+ // Adjust for anchoring
+ position.x = localPlanePosition.x - canvasRTransform.sizeDelta.x * itemTransform.anchorMin.x;
+ position.y = localPlanePosition.y - canvasRTransform.sizeDelta.y * itemTransform.anchorMin.y;
+
+ Vector3 minLocalPosition;
+ minLocalPosition.x = canvasRTransform.sizeDelta.x * (0 - canvasRTransform.pivot.x) + itemTransform.sizeDelta.x * itemTransform.pivot.x;
+ minLocalPosition.y = canvasRTransform.sizeDelta.y * (0 - canvasRTransform.pivot.y) + itemTransform.sizeDelta.y * itemTransform.pivot.y;
+
+ Vector3 maxLocalPosition;
+ maxLocalPosition.x = canvasRTransform.sizeDelta.x * (1 - canvasRTransform.pivot.x) - itemTransform.sizeDelta.x * itemTransform.pivot.x;
+ maxLocalPosition.y = canvasRTransform.sizeDelta.y * (1 - canvasRTransform.pivot.y) - itemTransform.sizeDelta.y * itemTransform.pivot.y;
+
+ position.x = Mathf.Clamp(position.x, minLocalPosition.x, maxLocalPosition.x);
+ position.y = Mathf.Clamp(position.y, minLocalPosition.y, maxLocalPosition.y);
+ }
+
+ itemTransform.anchoredPosition = position;
+ itemTransform.localRotation = Quaternion.identity;
+ itemTransform.localScale = Vector3.one;
+ }
+ static GameObject CreateNewUI(){
+ // Root for the UI
+ var root = new GameObject("Canvas");
+ root.layer = LayerMask.NameToLayer(kUILayerName);
+ Canvas canvas = root.AddComponent();
+ canvas.renderMode = RenderMode.ScreenSpaceOverlay;
+ root.AddComponent();
+ root.AddComponent();
+
+ // Works for all stages.
+ StageUtility.PlaceGameObjectInCurrentStage(root);
+ bool customScene = false;
+ PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
+ if (prefabStage != null){
+ root.transform.SetParent(prefabStage.prefabContentsRoot.transform, false);
+ customScene = true;
+ }
+
+ Undo.RegisterCreatedObjectUndo(root, "Create " + root.name);
+
+ // If there is no event system add one...
+ // No need to place event system in custom scene as these are temporary anyway.
+ // It can be argued for or against placing it in the user scenes,
+ // but let's not modify scene user is not currently looking at.
+ if (!customScene)
+ CreateEventSystem(false);
+ return root;
+ }
+ static void CreateEventSystem(bool select){
+ CreateEventSystem(select, null);
+ }
+ static void CreateEventSystem(bool select, GameObject parent){
+ var esys = UnityEngine.Object.FindObjectOfType();
+ if (esys == null){
+ var eventSystem = new GameObject("EventSystem");
+ GameObjectUtility.SetParentAndAlign(eventSystem, parent);
+ esys = eventSystem.AddComponent();
+ eventSystem.AddComponent();
+
+ Undo.RegisterCreatedObjectUndo(eventSystem, "Create " + eventSystem.name);
+ }
+
+ if (select && esys != null){
+ Selection.activeGameObject = esys.gameObject;
+ }
+ }
+ // Helper function that returns a Canvas GameObject; preferably a parent of the selection, or other existing Canvas.
+ static GameObject GetOrCreateCanvasGameObject(){
+ GameObject selectedGo = Selection.activeGameObject;
+
+ // Try to find a gameobject that is the selected GO or one if its parents.
+ Canvas canvas = (selectedGo != null) ? selectedGo.GetComponentInParent() : null;
+ if (IsValidCanvas(canvas))
+ return canvas.gameObject;
+
+ // No canvas in selection or its parents? Then use any valid canvas.
+ // We have to find all loaded Canvases, not just the ones in main scenes.
+ Canvas[] canvasArray = StageUtility.GetCurrentStageHandle().FindComponentsOfType();
+ for (int i = 0; i < canvasArray.Length; i++)
+ if (IsValidCanvas(canvasArray[i]))
+ return canvasArray[i].gameObject;
+
+ // No canvas in the scene at all? Then create a new one.
+ return CreateNewUI();
+ }
+ static bool IsValidCanvas(Canvas canvas){
+ if (canvas == null || !canvas.gameObject.activeInHierarchy)
+ return false;
+
+ // It's important that the non-editable canvas from a prefab scene won't be rejected,
+ // but canvases not visible in the Hierarchy at all do. Don't check for HideAndDontSave.
+ if (EditorUtility.IsPersistent(canvas) || (canvas.hideFlags & HideFlags.HideInHierarchy) != 0)
+ return false;
+
+ if (StageUtility.GetStageHandle(canvas.gameObject) != StageUtility.GetCurrentStageHandle())
+ return false;
+
+ return true;
+ }
+
+ class FactorySwapToEditor : IDisposable{
+ DefaultControls.IFactoryControls factory;
+
+ public FactorySwapToEditor(){
+ factory = DefaultControls.factory;
+ DefaultControls.factory = DefaultEditorFactory.Default;
+ }
+
+ public void Dispose(){
+ DefaultControls.factory = factory;
+ }
+ }
+
+ const string kStandardSpritePathDefault = "UI/Skin/UISprite.psd";
+ const string kBackgroundSpritePathDefault = "UI/Skin/Background.psd";
+ const string kInputFieldBackgroundPathDefault = "UI/Skin/InputFieldBackground.psd";
+ const string kKnobPathDefault = "UI/Skin/Knob.psd";
+ const string kCheckmarkPathDefault = "UI/Skin/Checkmark.psd";
+ const string kDropdownArrowPathDefault = "UI/Skin/DropdownArrow.psd";
+ const string kMaskPathDefault = "UI/Skin/UIMask.psd";
+
+ static DefaultControls.Resources s_StandardResourcesDefault;
+ static DefaultControls.Resources GetStandardUIResources(){
+ if (s_StandardResourcesDefault.standard == null){
+ s_StandardResourcesDefault.standard = AssetDatabase.GetBuiltinExtraResource(kStandardSpritePathDefault);
+ s_StandardResourcesDefault.background = AssetDatabase.GetBuiltinExtraResource(kBackgroundSpritePathDefault);
+ s_StandardResourcesDefault.inputField = AssetDatabase.GetBuiltinExtraResource(kInputFieldBackgroundPathDefault);
+ s_StandardResourcesDefault.knob = AssetDatabase.GetBuiltinExtraResource(kKnobPathDefault);
+ s_StandardResourcesDefault.checkmark = AssetDatabase.GetBuiltinExtraResource(kCheckmarkPathDefault);
+ s_StandardResourcesDefault.dropdown = AssetDatabase.GetBuiltinExtraResource(kDropdownArrowPathDefault);
+ s_StandardResourcesDefault.mask = AssetDatabase.GetBuiltinExtraResource(kMaskPathDefault);
+ }
+ return s_StandardResourcesDefault;
+ }
+ static void PlaceUIElementRoot(GameObject element, MenuCommand menuCommand){
+ GameObject parent = menuCommand.context as GameObject;
+ bool explicitParentChoice = true;
+ if (parent == null){
+ parent = GetOrCreateCanvasGameObject();
+ explicitParentChoice = false;
+
+ // If in Prefab Mode, Canvas has to be part of Prefab contents,
+ // otherwise use Prefab root instead.
+ PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
+ if (prefabStage != null && !prefabStage.IsPartOfPrefabContents(parent))
+ parent = prefabStage.prefabContentsRoot;
+ }
+ if (parent.GetComponentsInParent(true).Length == 0){
+ // Create canvas under context GameObject,
+ // and make that be the parent which UI element is added under.
+ GameObject canvas = CreateNewUIDefault();
+ Undo.SetTransformParent(canvas.transform, parent.transform, "");
+ parent = canvas;
+ }
+
+ GameObjectUtility.EnsureUniqueNameForSibling(element);
+
+ SetParentAndAlign(element, parent);
+ if (!explicitParentChoice) // not a context click, so center in sceneview
+ SetPositionVisibleinSceneView(parent.GetComponent(), element.GetComponent());
+
+ // This call ensure any change made to created Objects after they where registered will be part of the Undo.
+ Undo.RegisterFullObjectHierarchyUndo(parent == null ? element : parent, "");
+
+ // We have to fix up the undo name since the name of the object was only known after reparenting it.
+ Undo.SetCurrentGroupName("Create " + element.name);
+
+ Selection.activeGameObject = element;
+ }
+ static GameObject CreateNewUIDefault(){
+ // Root for the UI
+ var root = ObjectFactory.CreateGameObject("Canvas", typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster));
+ root.layer = LayerMask.NameToLayer(kUILayerName);
+ Canvas canvas = root.GetComponent();
+ canvas.renderMode = RenderMode.ScreenSpaceOverlay;
+
+ // Works for all stages.
+ StageUtility.PlaceGameObjectInCurrentStage(root);
+ bool customScene = false;
+ PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
+ if (prefabStage != null){
+ Undo.SetTransformParent(root.transform, prefabStage.prefabContentsRoot.transform, "");
+ customScene = true;
+ }
+
+ Undo.SetCurrentGroupName("Create " + root.name);
+
+ // If there is no event system add one...
+ // No need to place event system in custom scene as these are temporary anyway.
+ // It can be argued for or against placing it in the user scenes,
+ // but let's not modify scene user is not currently looking at.
+ if (!customScene)
+ CreateEventSystem(false);
+ return root;
+ }
+ static void SetParentAndAlign(GameObject child, GameObject parent){
+ if (parent == null)
+ return;
+
+ Undo.SetTransformParent(child.transform, parent.transform, "");
+
+ RectTransform rectTransform = child.transform as RectTransform;
+ if (rectTransform){
+ rectTransform.anchoredPosition = Vector2.zero;
+ Vector3 localPosition = rectTransform.localPosition;
+ localPosition.z = 0;
+ rectTransform.localPosition = localPosition;
+ }else{
+ child.transform.localPosition = Vector3.zero;
+ }
+ child.transform.localRotation = Quaternion.identity;
+ child.transform.localScale = Vector3.one;
+
+ SetLayerRecursively(child, parent.layer);
+ }
+ static void SetLayerRecursively(GameObject go, int layer){
+ go.layer = layer;
+ Transform t = go.transform;
+ for (int i = 0; i < t.childCount; i++)
+ SetLayerRecursively(t.GetChild(i).gameObject, layer);
+ }
+ class DefaultEditorFactory : DefaultControls.IFactoryControls{
+ public static DefaultEditorFactory Default = new DefaultEditorFactory();
+
+ public GameObject CreateGameObject(string name, params Type[] components){
+ return ObjectFactory.CreateGameObject(name, components);
+ }
+ }
+ #endregion
+#endif
+}
+#endif
\ No newline at end of file
diff --git a/SimpleTools/Tools/Editor/ToolsEditor.cs.meta b/SimpleTools/Tools/Editor/ToolsEditor.cs.meta
new file mode 100644
index 0000000..ad2848c
--- /dev/null
+++ b/SimpleTools/Tools/Editor/ToolsEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2c0943954f274aa44b030be2d213a763
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Menu.meta b/SimpleTools/Tools/Menu.meta
new file mode 100644
index 0000000..673599a
--- /dev/null
+++ b/SimpleTools/Tools/Menu.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ce31707f0d21dca449c23caec3a42cb5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Menu/MenuController.cs b/SimpleTools/Tools/Menu/MenuController.cs
new file mode 100644
index 0000000..465f4fa
--- /dev/null
+++ b/SimpleTools/Tools/Menu/MenuController.cs
@@ -0,0 +1,110 @@
+using System.Collections.Generic;
+using UnityEngine;
+using System.Linq;
+using UnityEngine.UI;
+using TMPro;
+using UnityEngine.Audio;
+
+namespace SimpleTools.Menu {
+ [System.Serializable] public class OnPlay : UnityEngine.Events.UnityEvent { }
+ public class MenuController : MonoBehaviour {
+
+ [Header("Audio")]
+ [SerializeField] AudioMixer mainMixer = default;
+ [Tooltip("The music volume the first time you start the game")][SerializeField, Range(0, 1)] float defaultMusicValue = .75f;
+ [Tooltip("The SFX volume the first time you start the game")][SerializeField, Range(0, 1)] float defaultSfxValue = .75f;
+ public Slider musicSlider = default;
+ public Slider sfxSlider = default;
+
+ [Header("Visual")]
+ public TMP_Dropdown qualityDropdown = default;
+ int qualitySelected;
+
+ public TMP_Dropdown resolutionDropdown = default;
+ Resolution[] resolutions;
+ int currentResolutionIndex;
+
+ [Space]
+ [SerializeField] OnPlay onPlay = default;
+
+ void Awake() {
+ if (mainMixer) {
+ float musicVolume = PlayerPrefs.GetFloat("MusicVolume", defaultMusicValue);
+ float sfxVolume = PlayerPrefs.GetFloat("SFXVolume", defaultSfxValue);
+ mainMixer.SetFloat("Master", Mathf.Log10(musicVolume <= .0001f ? .0001f : musicVolume) * 20);
+ mainMixer.SetFloat("SFX", Mathf.Log10(sfxVolume <= .0001f ? .0001f : sfxVolume) * 20);
+ }
+
+ resolutions = Screen.resolutions.Select(resolution => new Resolution { width = resolution.width, height = resolution.height }).Distinct().ToArray();
+ resolutionDropdown.ClearOptions();
+
+ List options = new List();
+ for (int i = 0; i < resolutions.Length; i++) {
+ string option = resolutions[i].width + "x" + resolutions[i].height;
+ options.Add(option);
+
+ if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) {
+ currentResolutionIndex = i;
+ }
+ }
+
+ resolutions.Reverse();
+
+ resolutionDropdown.AddOptions(options);
+ resolutionDropdown.value = currentResolutionIndex;
+ resolutionDropdown.RefreshShownValue();
+
+ qualityDropdown.ClearOptions();
+ List qualityNames = new List();
+ for (int i = 0; i < QualitySettings.names.Length; i++) {
+ qualityNames.Add(QualitySettings.names[i]);
+ }
+ qualityDropdown.AddOptions(qualityNames);
+
+ qualitySelected = PlayerPrefs.HasKey("QualitySelected") ? PlayerPrefs.GetInt("QualitySelected") : QualitySettings.GetQualityLevel();
+ qualityDropdown.value = qualitySelected;
+ QualitySettings.SetQualityLevel(qualitySelected);
+ qualityDropdown.RefreshShownValue();
+ }
+
+ void OnValidate() {
+ if (musicSlider) musicSlider.minValue = musicSlider.minValue < .0001f ? .0001f : musicSlider.minValue;
+ if (sfxSlider) sfxSlider.minValue = sfxSlider.minValue < .0001f ? .0001f : sfxSlider.minValue;
+ }
+
+ void Start() {
+ musicSlider.value = PlayerPrefs.GetFloat("MusicVolume", defaultMusicValue);
+ sfxSlider.value = PlayerPrefs.GetFloat("SFXVolume", defaultSfxValue);
+ }
+
+ //Needs a slider between 0.0001 and 1
+ public void SetMusicVolume(float sliderValue) {
+ mainMixer.SetFloat("Master", Mathf.Log10(sliderValue) * 20);
+ PlayerPrefs.SetFloat("MusicVolume", sliderValue);
+ }
+
+ //Needs a slider between 0.0001 and 1
+ public void SetSfxVolume(float sliderValue) {
+ mainMixer.SetFloat("SFX", Mathf.Log10(sliderValue) * 20);
+ PlayerPrefs.SetFloat("SFXVolume", sliderValue);
+ }
+
+ public void SetQuality(int qualityIndex) {
+ QualitySettings.SetQualityLevel(qualityIndex);
+ PlayerPrefs.SetInt("QualitySelected", qualityIndex);
+ }
+
+ public void SetResolution(int resolutionIndex) {
+ Resolution resolution = resolutions[resolutionIndex];
+ Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
+ }
+
+ public void Play() {
+ onPlay.Invoke();
+ }
+
+ public void Quit() {
+ Application.Quit();
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/Menu/MenuController.cs.meta b/SimpleTools/Tools/Menu/MenuController.cs.meta
new file mode 100644
index 0000000..e141f5e
--- /dev/null
+++ b/SimpleTools/Tools/Menu/MenuController.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1e26602e8c04bfd488f5d150c29aed57
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/MonobehaviourExtensions.cs b/SimpleTools/Tools/MonobehaviourExtensions.cs
new file mode 100644
index 0000000..ed77a43
--- /dev/null
+++ b/SimpleTools/Tools/MonobehaviourExtensions.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+namespace SimpleTools {
+ public static class MonobehaviourExtensions {
+ public static void EnsureCoroutineStopped(this MonoBehaviour value, ref Coroutine routine) {
+ if (routine != null) {
+ value.StopCoroutine(routine);
+ routine = null;
+ }
+ }
+ }
+}
diff --git a/SimpleTools/Tools/MonobehaviourExtensions.cs.meta b/SimpleTools/Tools/MonobehaviourExtensions.cs.meta
new file mode 100644
index 0000000..f72769b
--- /dev/null
+++ b/SimpleTools/Tools/MonobehaviourExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 384cb39f98d5ca74f832bd42e32b3613
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/ObjectPooler.meta b/SimpleTools/Tools/ObjectPooler.meta
new file mode 100644
index 0000000..0daf9bd
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ec26cabd12646bb47bbe875cc4577e25
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/ObjectPooler/IPooledObject.cs b/SimpleTools/Tools/ObjectPooler/IPooledObject.cs
new file mode 100644
index 0000000..0b968e1
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler/IPooledObject.cs
@@ -0,0 +1,5 @@
+namespace SimpleTools.ObjectPooler {
+ public interface IPooledObject {
+ void OnObjectSpawn();
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/ObjectPooler/IPooledObject.cs.meta b/SimpleTools/Tools/ObjectPooler/IPooledObject.cs.meta
new file mode 100644
index 0000000..6bf79f6
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler/IPooledObject.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f901e5ecf80a03c43b4375b93741a3bf
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/ObjectPooler/ObjectPooler.png b/SimpleTools/Tools/ObjectPooler/ObjectPooler.png
new file mode 100644
index 0000000000000000000000000000000000000000..2f2e029b647b161dbd772ffdb1e2f4f6b7adc898
GIT binary patch
literal 4554
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
literal 0
HcmV?d00001
diff --git a/SimpleTools/Tools/ObjectPooler/ObjectPooler.png.meta b/SimpleTools/Tools/ObjectPooler/ObjectPooler.png.meta
new file mode 100644
index 0000000..ccac346
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler/ObjectPooler.png.meta
@@ -0,0 +1,96 @@
+fileFormatVersion: 2
+guid: 8a0a572e598bbe3439aa4dab4a39293f
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/ObjectPooler/Pool.cs b/SimpleTools/Tools/ObjectPooler/Pool.cs
new file mode 100644
index 0000000..6a36a71
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler/Pool.cs
@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace SimpleTools.ObjectPooler {
+ [CreateAssetMenu(fileName = "New Pool", menuName = "Simple Tools/Pool", order = 11)]
+ public class Pool : ScriptableObject {
+
+ public List pools;
+ [System.Serializable]
+ public class PoolPrefab {
+ public string tag;
+ public GameObject prefab;
+ public bool undetermined;
+ public int size;
+
+ [HideInInspector] public Queue determinedPool;
+ [HideInInspector] public List undeterminedPool;
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/ObjectPooler/Pool.cs.meta b/SimpleTools/Tools/ObjectPooler/Pool.cs.meta
new file mode 100644
index 0000000..999b2d4
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler/Pool.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b5ff40c8bb5e75d4fabf7bd1d6a59c68
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {fileID: 2800000, guid: 8a0a572e598bbe3439aa4dab4a39293f, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/ObjectPooler/Pooler.cs b/SimpleTools/Tools/ObjectPooler/Pooler.cs
new file mode 100644
index 0000000..da7c05b
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler/Pooler.cs
@@ -0,0 +1,371 @@
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+
+namespace SimpleTools.ObjectPooler {
+ public static class Pooler {
+
+ class PoolChecker : MonoBehaviour {
+ public string poolTag;
+ }
+
+ static Dictionary poolDictionary;
+ static Scene poolScene;
+
+ /// Generate a scene with the objects of the pools in it
+ /// If this isn't called, the pooler won't work
+ ///
+ public static void CreatePools(Pool pool) {
+ if (pool == null) {
+ Debug.LogWarning("You have to provide a pool.");
+ return;
+ }
+
+ poolDictionary = new Dictionary();
+ if (SceneManager.GetSceneByName("PoolScene").IsValid()) {
+ poolScene = SceneManager.GetSceneByName("PoolScene");
+ } else {
+ poolScene = SceneManager.CreateScene("PoolScene");
+ }
+
+ foreach (Pool.PoolPrefab p in pool.pools) {
+ if (!p.undetermined) {
+ if (p.determinedPool == null) {
+ p.determinedPool = new Queue();
+ }
+ for (int i = 0; i < p.size; i++) {
+ GameObject obj = Object.Instantiate(p.prefab);
+ obj.SetActive(false);
+ obj.AddComponent().poolTag = p.tag;
+ SceneManager.MoveGameObjectToScene(obj, poolScene);
+ p.determinedPool.Enqueue(obj);
+ }
+ } else {
+ if (p.undeterminedPool == null) {
+ p.undeterminedPool = new List();
+ }
+ }
+ poolDictionary.Add(p.tag, p);
+ }
+ }
+ /// Generate a scene with the objects of the pools in it
+ /// If this isn't called, the pooler won't work
+ ///
+ public static void CreatePools(Pool[] pools) {
+ if (pools == null) {
+ Debug.LogWarning("You have to provide a pool.");
+ return;
+ }
+
+ poolDictionary = new Dictionary();
+ if (SceneManager.GetSceneByName("PoolScene").IsValid()) {
+ poolScene = SceneManager.GetSceneByName("PoolScene");
+ } else {
+ poolScene = SceneManager.CreateScene("PoolScene");
+ }
+
+ for (int i = 0; i < pools.Length; i++) {
+ foreach (Pool.PoolPrefab p in pools[i].pools) {
+ if (!p.undetermined) {
+ if (p.determinedPool == null) {
+ p.determinedPool = new Queue();
+ }
+ for (int j = 0; j < p.size; j++) {
+ GameObject obj = Object.Instantiate(p.prefab);
+ obj.SetActive(false);
+ obj.AddComponent().poolTag = p.tag;
+ SceneManager.MoveGameObjectToScene(obj, poolScene);
+ p.determinedPool.Enqueue(obj);
+ }
+ } else {
+ if (p.undeterminedPool == null) {
+ p.undeterminedPool = new List();
+ }
+ }
+ poolDictionary.Add(p.tag, p);
+ }
+ }
+ }
+ /// Destroy an object and return it to the pool scene
+ ///
+ public static void Destroy(GameObject gameObject) {
+ PoolChecker poolChecker = gameObject.GetComponent();
+ if (poolChecker == null) {
+ Debug.LogWarning("GameObject: " + gameObject + " isn't from a pool", gameObject);
+ return;
+ }
+
+ gameObject.transform.SetParent(null);
+ SceneManager.MoveGameObjectToScene(gameObject, poolScene);
+
+ if (poolDictionary.ContainsKey(poolChecker.poolTag)) {
+ Pool.PoolPrefab pool = poolDictionary[poolChecker.poolTag];
+ if (pool.undetermined) {
+ gameObject.SetActive(false);
+ pool.undeterminedPool.Remove(gameObject);
+ } else {
+ gameObject.SetActive(false);
+ }
+ }
+ }
+
+ /// Spawn an object into a specific position
+ /// The CreatePools function must have been called before.
+ ///
+ public static GameObject SpawnFromPool(string tag, Vector3 position) {
+ if (!poolDictionary.ContainsKey(tag)) {
+ Debug.Log("Pool with tag " + tag + " doesn't exist.");
+ return null;
+ }
+
+ Pool.PoolPrefab pool = poolDictionary[tag];
+ GameObject objectToSpawn;
+ if (!pool.undetermined) {
+ objectToSpawn = pool.determinedPool.Dequeue();
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = Quaternion.identity;
+ objectToSpawn.SetActive(true);
+
+ pool.determinedPool.Enqueue(objectToSpawn);
+ } else {
+ if (pool.undeterminedPool.Count != 0) {
+ int lastIndex = pool.undeterminedPool.Count - 1;
+ objectToSpawn = pool.undeterminedPool[lastIndex];
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = Quaternion.identity;
+ objectToSpawn.SetActive(true);
+ } else {
+ objectToSpawn = Object.Instantiate(pool.prefab, position, Quaternion.identity);
+ SceneManager.MoveGameObjectToScene(objectToSpawn, poolScene);
+ objectToSpawn.AddComponent().poolTag = tag;
+ }
+ }
+
+ IPooledObject pooledObj = objectToSpawn.GetComponent();
+ if (pooledObj != null) {
+ pooledObj.OnObjectSpawn();
+ }
+ return objectToSpawn;
+ }
+ /// Spawn an object into a specific position and parent
+ /// The CreatePools function must have been called before.
+ ///
+ public static GameObject SpawnFromPool(string tag, Vector3 position, Transform parent) {
+ if (!poolDictionary.ContainsKey(tag)) {
+ Debug.Log("Pool with tag " + tag + " doesn't exist.");
+ return null;
+ }
+
+ Pool.PoolPrefab pool = poolDictionary[tag];
+ GameObject objectToSpawn;
+ if (!pool.undetermined) {
+ objectToSpawn = pool.determinedPool.Dequeue();
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = Quaternion.identity;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+
+ pool.determinedPool.Enqueue(objectToSpawn);
+ } else {
+ if (pool.undeterminedPool.Count != 0) {
+ int lastIndex = pool.undeterminedPool.Count - 1;
+ objectToSpawn = pool.undeterminedPool[lastIndex];
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = Quaternion.identity;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+ } else {
+ objectToSpawn = Object.Instantiate(pool.prefab, position, Quaternion.identity, parent);
+ objectToSpawn.AddComponent().poolTag = tag;
+ }
+ }
+
+ IPooledObject pooledObj = objectToSpawn.GetComponent();
+ if (pooledObj != null) {
+ pooledObj.OnObjectSpawn();
+ }
+ return objectToSpawn;
+ }
+ /// Spawn an object into a specific position, parent and set if it's in world space or not
+ /// The CreatePools function must have been called before.
+ ///
+ public static GameObject SpawnFromPool(string tag, Vector3 position, Transform parent, bool instantiateInWorldSpace) {
+ if (!poolDictionary.ContainsKey(tag)) {
+ Debug.Log("Pool with tag " + tag + " doesn't exist.");
+ return null;
+ }
+
+ if (!instantiateInWorldSpace) {
+ SpawnFromPool(tag, position, parent);
+ }
+
+ Pool.PoolPrefab pool = poolDictionary[tag];
+ GameObject objectToSpawn;
+ if (!pool.undetermined) {
+ objectToSpawn = pool.determinedPool.Dequeue();
+
+ objectToSpawn.transform.localPosition = position;
+ objectToSpawn.transform.localRotation = Quaternion.identity;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+
+ pool.determinedPool.Enqueue(objectToSpawn);
+ } else {
+ if (pool.undeterminedPool.Count != 0) {
+ int lastIndex = pool.undeterminedPool.Count - 1;
+ objectToSpawn = pool.undeterminedPool[lastIndex];
+
+ objectToSpawn.transform.localPosition = position;
+ objectToSpawn.transform.localRotation = Quaternion.identity;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+ } else {
+ objectToSpawn = Object.Instantiate(pool.prefab);
+ objectToSpawn.transform.localPosition = position;
+ objectToSpawn.transform.localRotation = Quaternion.identity;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.AddComponent().poolTag = tag;
+ }
+ }
+
+ IPooledObject pooledObj = objectToSpawn.GetComponent();
+ if (pooledObj != null) {
+ pooledObj.OnObjectSpawn();
+ }
+ return objectToSpawn;
+ }
+ /// Spawn an object into a specific position and rotation
+ /// The CreatePools function must have been called before.
+ ///
+ public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation) {
+ if (!poolDictionary.ContainsKey(tag)) {
+ Debug.Log("Pool with tag " + tag + " doesn't exist.");
+ return null;
+ }
+
+ Pool.PoolPrefab pool = poolDictionary[tag];
+ GameObject objectToSpawn;
+ if (!pool.undetermined) {
+ objectToSpawn = pool.determinedPool.Dequeue();
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = rotation;
+ objectToSpawn.SetActive(true);
+
+ pool.determinedPool.Enqueue(objectToSpawn);
+ } else {
+ if (pool.undeterminedPool.Count != 0) {
+ int lastIndex = pool.undeterminedPool.Count - 1;
+ objectToSpawn = pool.undeterminedPool[lastIndex];
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = rotation;
+ objectToSpawn.SetActive(true);
+ } else {
+ objectToSpawn = Object.Instantiate(pool.prefab, position, rotation);
+ SceneManager.MoveGameObjectToScene(objectToSpawn, poolScene);
+ objectToSpawn.AddComponent().poolTag = tag;
+ }
+ }
+
+ IPooledObject pooledObj = objectToSpawn.GetComponent();
+ if (pooledObj != null) {
+ pooledObj.OnObjectSpawn();
+ }
+ return objectToSpawn;
+ }
+ /// Spawn an object into a specific position, rotation and parent
+ /// The CreatePools function must have been called before.
+ ///
+ public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation, Transform parent) {
+ if (!poolDictionary.ContainsKey(tag)) {
+ Debug.Log("Pool with tag " + tag + " doesn't exist.");
+ return null;
+ }
+
+ Pool.PoolPrefab pool = poolDictionary[tag];
+ GameObject objectToSpawn;
+ if (!pool.undetermined) {
+ objectToSpawn = pool.determinedPool.Dequeue();
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = rotation;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+
+ pool.determinedPool.Enqueue(objectToSpawn);
+ } else {
+ if (pool.undeterminedPool.Count != 0) {
+ int lastIndex = pool.undeterminedPool.Count - 1;
+ objectToSpawn = pool.undeterminedPool[lastIndex];
+
+ objectToSpawn.transform.position = position;
+ objectToSpawn.transform.rotation = rotation;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+ } else {
+ objectToSpawn = Object.Instantiate(pool.prefab, position, rotation, parent);
+ objectToSpawn.AddComponent().poolTag = tag;
+ }
+ }
+
+ IPooledObject pooledObj = objectToSpawn.GetComponent();
+ if (pooledObj != null) {
+ pooledObj.OnObjectSpawn();
+ }
+ return objectToSpawn;
+ }
+ /// Spawn an object into a specific position, rotation, parent and set if it's in world space or not
+ /// The CreatePools function must have been called before.
+ ///
+ public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation, Transform parent, bool instantiateInWorldSpace) {
+ if (!poolDictionary.ContainsKey(tag)) {
+ Debug.Log("Pool with tag " + tag + " doesn't exist.");
+ return null;
+ }
+
+ if (!instantiateInWorldSpace) {
+ SpawnFromPool(tag, position, rotation, parent);
+ }
+
+ Pool.PoolPrefab pool = poolDictionary[tag];
+ GameObject objectToSpawn;
+ if (!pool.undetermined) {
+ objectToSpawn = pool.determinedPool.Dequeue();
+
+ objectToSpawn.transform.localPosition = position;
+ objectToSpawn.transform.localRotation = rotation;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+
+ pool.determinedPool.Enqueue(objectToSpawn);
+ } else {
+ if (pool.undeterminedPool.Count != 0) {
+ int lastIndex = pool.undeterminedPool.Count - 1;
+ objectToSpawn = pool.undeterminedPool[lastIndex];
+
+ objectToSpawn.transform.localPosition = position;
+ objectToSpawn.transform.localRotation = rotation;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.SetActive(true);
+ } else {
+ objectToSpawn = Object.Instantiate(pool.prefab);
+ objectToSpawn.transform.localPosition = position;
+ objectToSpawn.transform.localRotation = rotation;
+ objectToSpawn.transform.SetParent(parent);
+ objectToSpawn.AddComponent().poolTag = tag;
+ }
+ }
+
+ IPooledObject pooledObj = objectToSpawn.GetComponent();
+ if (pooledObj != null) {
+ pooledObj.OnObjectSpawn();
+ }
+ return objectToSpawn;
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/ObjectPooler/Pooler.cs.meta b/SimpleTools/Tools/ObjectPooler/Pooler.cs.meta
new file mode 100644
index 0000000..561ff15
--- /dev/null
+++ b/SimpleTools/Tools/ObjectPooler/Pooler.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 05981bd6149198c4594304b79460229f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/SceneManager.meta b/SimpleTools/Tools/SceneManager.meta
new file mode 100644
index 0000000..7f8e4d2
--- /dev/null
+++ b/SimpleTools/Tools/SceneManager.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7fab4cee4244fe944894c2ed51272d02
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/SceneManager/Loader.cs b/SimpleTools/Tools/SceneManager/Loader.cs
new file mode 100644
index 0000000..6c50972
--- /dev/null
+++ b/SimpleTools/Tools/SceneManager/Loader.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+
+namespace SimpleTools.SceneManagement {
+ public static class Loader {
+
+ class LoadingMonoBehaviour : MonoBehaviour { }
+
+ static Action onLoaderCallback;
+ static AsyncOperation loadingAsyncOperation;
+
+ /// Load a scene with a loading scene
+ /// It requires a scene called "Loading" where the loading screen is located.
+ ///
+ public static void Load(int scene) {
+ onLoaderCallback = () => {
+ GameObject loadingGameObject = new GameObject("LoadingGameObject");
+ loadingGameObject.AddComponent().StartCoroutine(LoadSceneAsync(scene));
+ };
+
+ SceneManager.LoadScene("Loading");
+ }
+ /// Load a scene with a loading scene
+ /// It requires a scene called "Loading" where the loading screen is located.
+ ///
+ public static void Load(string scene) {
+ onLoaderCallback = () => {
+ GameObject loadingGameObject = new GameObject("LoadingGameObject");
+ loadingGameObject.AddComponent().StartCoroutine(LoadSceneAsync(scene));
+ };
+
+ SceneManager.LoadScene("Loading");
+ }
+
+ static IEnumerator LoadSceneAsync(int scene) {
+ yield return null;
+ loadingAsyncOperation = SceneManager.LoadSceneAsync(scene);
+
+ while (!loadingAsyncOperation.isDone) {
+ yield return null;
+ }
+ }
+ static IEnumerator LoadSceneAsync(string scene) {
+ yield return null;
+ loadingAsyncOperation = SceneManager.LoadSceneAsync(scene);
+
+ while (!loadingAsyncOperation.isDone) {
+ yield return null;
+ }
+ }
+
+ /// Returns the loading progress
+ ///
+ public static float GetLoadingProgress() {
+ if (loadingAsyncOperation != null) {
+ return loadingAsyncOperation.progress;
+ } else {
+ return 0f;
+ }
+ }
+
+ public static void LoaderCallback() {
+ if (onLoaderCallback != null) {
+ onLoaderCallback();
+ onLoaderCallback = null;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/SceneManager/Loader.cs.meta b/SimpleTools/Tools/SceneManager/Loader.cs.meta
new file mode 100644
index 0000000..aabd88b
--- /dev/null
+++ b/SimpleTools/Tools/SceneManager/Loader.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f063a9d603510c141ab14838d5426a9b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/SceneManager/LoaderCallback.cs b/SimpleTools/Tools/SceneManager/LoaderCallback.cs
new file mode 100644
index 0000000..c22015d
--- /dev/null
+++ b/SimpleTools/Tools/SceneManager/LoaderCallback.cs
@@ -0,0 +1,16 @@
+using UnityEngine;
+
+namespace SimpleTools.SceneManagement {
+ public class LoaderCallback : MonoBehaviour {
+
+ bool isFirstUpdate = true;
+
+ // Update is called once per frame
+ void Update() {
+ if (isFirstUpdate) {
+ isFirstUpdate = false;
+ Loader.LoaderCallback();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/SceneManager/LoaderCallback.cs.meta b/SimpleTools/Tools/SceneManager/LoaderCallback.cs.meta
new file mode 100644
index 0000000..bb350e1
--- /dev/null
+++ b/SimpleTools/Tools/SceneManager/LoaderCallback.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 26cb7a3b5197df940891506a87636cf7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/SceneManager/LoadingProgressBar.cs b/SimpleTools/Tools/SceneManager/LoadingProgressBar.cs
new file mode 100644
index 0000000..5ac2939
--- /dev/null
+++ b/SimpleTools/Tools/SceneManager/LoadingProgressBar.cs
@@ -0,0 +1,19 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace SimpleTools.SceneManagement {
+ public class LoadingProgressBar : MonoBehaviour {
+
+ Image image;
+
+ // Start is called before the first frame update
+ void Awake() {
+ image = transform.GetComponent();
+ }
+
+ // Update is called once per frame
+ void Update() {
+ image.fillAmount = Loader.GetLoadingProgress();
+ }
+ }
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/SceneManager/LoadingProgressBar.cs.meta b/SimpleTools/Tools/SceneManager/LoadingProgressBar.cs.meta
new file mode 100644
index 0000000..c379409
--- /dev/null
+++ b/SimpleTools/Tools/SceneManager/LoadingProgressBar.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 79bedd11df41bee44a527b2e4e718d17
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Timer.meta b/SimpleTools/Tools/Timer.meta
new file mode 100644
index 0000000..4762356
--- /dev/null
+++ b/SimpleTools/Tools/Timer.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b904c9938b1a3df4e83b1103e3085400
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Timer/Timer.cs b/SimpleTools/Tools/Timer/Timer.cs
new file mode 100644
index 0000000..49a7e28
--- /dev/null
+++ b/SimpleTools/Tools/Timer/Timer.cs
@@ -0,0 +1,99 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System;
+using TMPro;
+
+namespace SimpleTools.Timer{
+ public class Timer : MonoBehaviour{
+
+ float elapsedTime;
+ public float ElapsedTime { get { return elapsedTime; } }
+ bool isPaused;
+ public bool IsPaused { get { return isPaused; } }
+ TimeSpan timePlaying;
+ public TimeSpan TimePlaying { get { return timePlaying; } }
+ TMP_Text timer;
+ public TMP_Text TimerText { get { return timer; } }
+ TimerType timerType;
+ public TimerType TimerType { get { return timerType; } }
+ TimerUpdate timerUpdate;
+ public TimerUpdate TimerUpdate { get { return timerUpdate; } }
+
+ float defaultTime;
+
+ ///
+ /// Setup the timer
+ ///
+ public void Setup(float elapsedTime, bool isPaused, TimeSpan timePlaying, TMP_Text timer, TimerType timerType, TimerUpdate timerUpdate, string text){
+ this.elapsedTime = defaultTime = elapsedTime;
+ this.isPaused = isPaused;
+ this.timePlaying = timePlaying;
+ this.timer = timer;
+ this.timerType = timerType;
+ this.timerUpdate = timerUpdate;
+ timer.text = text;
+ }
+
+ IEnumerator UpdateTimer(){
+ while (!isPaused){
+ if(timerType == TimerType.Clock){
+ timer.text = DateTime.Now.ToString("HH:mm:ss");
+ }else{
+ switch (timerType){
+ case TimerType.Countdown:
+ elapsedTime -= timerUpdate == TimerUpdate.UnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime;
+ if(elapsedTime < 0f){
+ elapsedTime = 0f;
+ isPaused = true;
+ }
+ break;
+ case TimerType.Stopwatch:
+ elapsedTime += timerUpdate == TimerUpdate.UnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime;
+ break;
+ }
+ timePlaying = TimeSpan.FromSeconds(elapsedTime);
+ timer.text = timePlaying.ToString("m':'ss'.'ff");
+ }
+ yield return null;
+ }
+ }
+
+ ///
+ /// Play or resume the timer
+ ///
+ public void Play(){
+ isPaused = false;
+ StartCoroutine(UpdateTimer());
+ }
+
+ ///
+ /// Pause the timer
+ ///
+ public void Stop(){
+ isPaused = true;
+ }
+
+ ///
+ /// Pause and sets the time to the defaultOne
+ ///
+ public void ResetTimer(){
+ isPaused = true;
+ elapsedTime = defaultTime;
+ timePlaying = TimeSpan.FromSeconds(elapsedTime);
+ timer.text = timePlaying.ToString("m':'ss'.'ff");
+ }
+
+ ///
+ /// Restarts the timer
+ ///
+ public void Restart(){
+ isPaused = false;
+ elapsedTime = defaultTime;
+ timePlaying = TimeSpan.FromSeconds(elapsedTime);
+ timer.text = timePlaying.ToString("m':'ss'.'ff");
+ StopAllCoroutines();
+ StartCoroutine(UpdateTimer());
+ }
+ }
+}
diff --git a/SimpleTools/Tools/Timer/Timer.cs.meta b/SimpleTools/Tools/Timer/Timer.cs.meta
new file mode 100644
index 0000000..af559b2
--- /dev/null
+++ b/SimpleTools/Tools/Timer/Timer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6daeed0a6935f484f85fc0ec1871344f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Timer/TimerType.cs b/SimpleTools/Tools/Timer/TimerType.cs
new file mode 100644
index 0000000..a758dbb
--- /dev/null
+++ b/SimpleTools/Tools/Timer/TimerType.cs
@@ -0,0 +1,7 @@
+namespace SimpleTools.Timer{
+ public enum TimerType{
+ Countdown,
+ Stopwatch,
+ Clock
+ }
+}
diff --git a/SimpleTools/Tools/Timer/TimerType.cs.meta b/SimpleTools/Tools/Timer/TimerType.cs.meta
new file mode 100644
index 0000000..3de6eec
--- /dev/null
+++ b/SimpleTools/Tools/Timer/TimerType.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f285456223780f946b49c6131d493c01
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Timer/TimerUpdate.cs b/SimpleTools/Tools/Timer/TimerUpdate.cs
new file mode 100644
index 0000000..8a95b13
--- /dev/null
+++ b/SimpleTools/Tools/Timer/TimerUpdate.cs
@@ -0,0 +1,6 @@
+namespace SimpleTools.Timer{
+ public enum TimerUpdate{
+ ScaledTime,
+ UnscaledTime,
+ }
+}
diff --git a/SimpleTools/Tools/Timer/TimerUpdate.cs.meta b/SimpleTools/Tools/Timer/TimerUpdate.cs.meta
new file mode 100644
index 0000000..930e415
--- /dev/null
+++ b/SimpleTools/Tools/Timer/TimerUpdate.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 977b7b3a05b17c04da63124856e9ff6f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/Timer/TimerUtility.cs b/SimpleTools/Tools/Timer/TimerUtility.cs
new file mode 100644
index 0000000..f25cf4d
--- /dev/null
+++ b/SimpleTools/Tools/Timer/TimerUtility.cs
@@ -0,0 +1,36 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System;
+using TMPro;
+
+namespace SimpleTools.Timer{
+ public static class TimerUtility {
+ ///
+ /// Setup the timer
+ ///
+ /// TMPro object that will contain the timer
+ /// What type of timer will it be (Countdown, Stopwatch, Clock)
+ /// The time that will have in case it is a countdown timer
+ ///
+ public static Timer SetupTimer(this TMP_Text container, TimerType timerType, TimerUpdate timerUpdate, float countdownTime = 60f){
+ Timer t = container.gameObject.AddComponent();
+ float elapsedTime = 0f;
+ string text = string.Empty;
+ TimeSpan timePlaying = TimeSpan.Zero;
+ switch (timerType){
+ case TimerType.Countdown:
+ elapsedTime = countdownTime;
+ timePlaying = TimeSpan.FromSeconds(elapsedTime);
+ text = timePlaying.ToString("m':'ss'.'ff");
+ break;
+ case TimerType.Clock:
+ text = DateTime.Now.ToString("HH:mm:ss");
+ break;
+ }
+ t.Setup(elapsedTime, true, timePlaying, container, timerType, timerUpdate, text);
+
+ return t;
+ }
+ }
+}
diff --git a/SimpleTools/Tools/Timer/TimerUtility.cs.meta b/SimpleTools/Tools/Timer/TimerUtility.cs.meta
new file mode 100644
index 0000000..1b46b33
--- /dev/null
+++ b/SimpleTools/Tools/Timer/TimerUtility.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 38076483429281e438cee653b26bb03d
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/Tools/geri.simpletools.editor.asmdef b/SimpleTools/Tools/geri.simpletools.editor.asmdef
new file mode 100644
index 0000000..21b4fa7
--- /dev/null
+++ b/SimpleTools/Tools/geri.simpletools.editor.asmdef
@@ -0,0 +1,24 @@
+{
+ "name": "SimpleTools",
+ "rootNamespace": "",
+ "references": [
+ "Cinemachine",
+ "TMP_Runtime-CSharp",
+ "Unity.TextMeshPro"
+ ],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": [],
+ "versionDefines": [
+ {
+ "name": "com.unity.cinemachine",
+ "expression": "2.7.1",
+ "define": "CINEMACHINE_271_OR_NEWER"
+ }
+ ],
+ "noEngineReferences": false
+}
\ No newline at end of file
diff --git a/SimpleTools/Tools/geri.simpletools.editor.asmdef.meta b/SimpleTools/Tools/geri.simpletools.editor.asmdef.meta
new file mode 100644
index 0000000..cd7c90e
--- /dev/null
+++ b/SimpleTools/Tools/geri.simpletools.editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ee6e31376ad94a04aa42bdea5f22b2ab
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SimpleTools/package.json b/SimpleTools/package.json
new file mode 100644
index 0000000..a1f46e7
--- /dev/null
+++ b/SimpleTools/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "com.geri.simpletools",
+ "version": "1.2.2",
+ "displayName": "Simple Tools",
+ "description": "This package contains simple tools to use in your project.",
+ "unity": "2018.4",
+ "unityRelease": "30f1",
+ "dependencies": {
+ "com.unity.cinemachine": "2.2.0",
+ "com.unity.textmeshpro": "1.4.1"
+ },
+ "keywords": [
+ "gamejam",
+ "simple",
+ "easy"
+ ],
+ "author": {
+ "name": "Geri",
+ "email": "ggasconmoline@gmail.com",
+ "url": "https://geri8.itch.io/"
+ },
+ "type": "commonjs"
+}
\ No newline at end of file
diff --git a/SimpleTools/package.json.meta b/SimpleTools/package.json.meta
new file mode 100644
index 0000000..ea7327a
--- /dev/null
+++ b/SimpleTools/package.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: d9e8f428943ed2045a746644f61eb664
+PackageManifestImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..ca3fb39
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,40 @@
+{
+ "dependencies": {
+ "com.unity.2d.sprite": "1.0.0",
+ "com.unity.cinemachine": "2.8.6",
+ "com.unity.ide.visualstudio": "2.0.16",
+ "com.unity.textmeshpro": "3.0.6",
+ "com.unity.ugui": "1.0.0",
+ "com.unity.modules.ai": "1.0.0",
+ "com.unity.modules.androidjni": "1.0.0",
+ "com.unity.modules.animation": "1.0.0",
+ "com.unity.modules.assetbundle": "1.0.0",
+ "com.unity.modules.audio": "1.0.0",
+ "com.unity.modules.cloth": "1.0.0",
+ "com.unity.modules.director": "1.0.0",
+ "com.unity.modules.imageconversion": "1.0.0",
+ "com.unity.modules.imgui": "1.0.0",
+ "com.unity.modules.jsonserialize": "1.0.0",
+ "com.unity.modules.particlesystem": "1.0.0",
+ "com.unity.modules.physics": "1.0.0",
+ "com.unity.modules.physics2d": "1.0.0",
+ "com.unity.modules.screencapture": "1.0.0",
+ "com.unity.modules.terrain": "1.0.0",
+ "com.unity.modules.terrainphysics": "1.0.0",
+ "com.unity.modules.tilemap": "1.0.0",
+ "com.unity.modules.ui": "1.0.0",
+ "com.unity.modules.uielements": "1.0.0",
+ "com.unity.modules.umbra": "1.0.0",
+ "com.unity.modules.unityanalytics": "1.0.0",
+ "com.unity.modules.unitywebrequest": "1.0.0",
+ "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
+ "com.unity.modules.unitywebrequestaudio": "1.0.0",
+ "com.unity.modules.unitywebrequesttexture": "1.0.0",
+ "com.unity.modules.unitywebrequestwww": "1.0.0",
+ "com.unity.modules.vehicles": "1.0.0",
+ "com.unity.modules.video": "1.0.0",
+ "com.unity.modules.vr": "1.0.0",
+ "com.unity.modules.wind": "1.0.0",
+ "com.unity.modules.xr": "1.0.0"
+ }
+}
diff --git a/packages-lock.json b/packages-lock.json
new file mode 100644
index 0000000..a862252
--- /dev/null
+++ b/packages-lock.json
@@ -0,0 +1,325 @@
+{
+ "dependencies": {
+ "com.geri.simpletools": {
+ "version": "file:SimpleTools",
+ "depth": 0,
+ "source": "embedded",
+ "dependencies": {
+ "com.unity.cinemachine": "2.2.0",
+ "com.unity.textmeshpro": "1.4.1"
+ }
+ },
+ "com.unity.2d.sprite": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.cinemachine": {
+ "version": "2.8.6",
+ "depth": 0,
+ "source": "registry",
+ "dependencies": {},
+ "url": "https://packages.unity.com"
+ },
+ "com.unity.ext.nunit": {
+ "version": "1.0.6",
+ "depth": 2,
+ "source": "registry",
+ "dependencies": {},
+ "url": "https://packages.unity.com"
+ },
+ "com.unity.ide.visualstudio": {
+ "version": "2.0.16",
+ "depth": 0,
+ "source": "registry",
+ "dependencies": {
+ "com.unity.test-framework": "1.1.9"
+ },
+ "url": "https://packages.unity.com"
+ },
+ "com.unity.test-framework": {
+ "version": "1.1.33",
+ "depth": 1,
+ "source": "registry",
+ "dependencies": {
+ "com.unity.ext.nunit": "1.0.6",
+ "com.unity.modules.imgui": "1.0.0",
+ "com.unity.modules.jsonserialize": "1.0.0"
+ },
+ "url": "https://packages.unity.com"
+ },
+ "com.unity.textmeshpro": {
+ "version": "3.0.6",
+ "depth": 0,
+ "source": "registry",
+ "dependencies": {
+ "com.unity.ugui": "1.0.0"
+ },
+ "url": "https://packages.unity.com"
+ },
+ "com.unity.ugui": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.ui": "1.0.0",
+ "com.unity.modules.imgui": "1.0.0"
+ }
+ },
+ "com.unity.modules.ai": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.androidjni": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.animation": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.assetbundle": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.audio": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.cloth": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.physics": "1.0.0"
+ }
+ },
+ "com.unity.modules.director": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.audio": "1.0.0",
+ "com.unity.modules.animation": "1.0.0"
+ }
+ },
+ "com.unity.modules.imageconversion": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.imgui": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.jsonserialize": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.particlesystem": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.physics": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.physics2d": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.screencapture": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.imageconversion": "1.0.0"
+ }
+ },
+ "com.unity.modules.subsystems": {
+ "version": "1.0.0",
+ "depth": 1,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.jsonserialize": "1.0.0"
+ }
+ },
+ "com.unity.modules.terrain": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.terrainphysics": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.physics": "1.0.0",
+ "com.unity.modules.terrain": "1.0.0"
+ }
+ },
+ "com.unity.modules.tilemap": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.physics2d": "1.0.0"
+ }
+ },
+ "com.unity.modules.ui": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.uielements": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.ui": "1.0.0",
+ "com.unity.modules.imgui": "1.0.0",
+ "com.unity.modules.jsonserialize": "1.0.0",
+ "com.unity.modules.uielementsnative": "1.0.0"
+ }
+ },
+ "com.unity.modules.uielementsnative": {
+ "version": "1.0.0",
+ "depth": 1,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.ui": "1.0.0",
+ "com.unity.modules.imgui": "1.0.0",
+ "com.unity.modules.jsonserialize": "1.0.0"
+ }
+ },
+ "com.unity.modules.umbra": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.unityanalytics": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.unitywebrequest": "1.0.0",
+ "com.unity.modules.jsonserialize": "1.0.0"
+ }
+ },
+ "com.unity.modules.unitywebrequest": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.unitywebrequestassetbundle": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.assetbundle": "1.0.0",
+ "com.unity.modules.unitywebrequest": "1.0.0"
+ }
+ },
+ "com.unity.modules.unitywebrequestaudio": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.unitywebrequest": "1.0.0",
+ "com.unity.modules.audio": "1.0.0"
+ }
+ },
+ "com.unity.modules.unitywebrequesttexture": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.unitywebrequest": "1.0.0",
+ "com.unity.modules.imageconversion": "1.0.0"
+ }
+ },
+ "com.unity.modules.unitywebrequestwww": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.unitywebrequest": "1.0.0",
+ "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
+ "com.unity.modules.unitywebrequestaudio": "1.0.0",
+ "com.unity.modules.audio": "1.0.0",
+ "com.unity.modules.assetbundle": "1.0.0",
+ "com.unity.modules.imageconversion": "1.0.0"
+ }
+ },
+ "com.unity.modules.vehicles": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.physics": "1.0.0"
+ }
+ },
+ "com.unity.modules.video": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.audio": "1.0.0",
+ "com.unity.modules.ui": "1.0.0",
+ "com.unity.modules.unitywebrequest": "1.0.0"
+ }
+ },
+ "com.unity.modules.vr": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.jsonserialize": "1.0.0",
+ "com.unity.modules.physics": "1.0.0",
+ "com.unity.modules.xr": "1.0.0"
+ }
+ },
+ "com.unity.modules.wind": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {}
+ },
+ "com.unity.modules.xr": {
+ "version": "1.0.0",
+ "depth": 0,
+ "source": "builtin",
+ "dependencies": {
+ "com.unity.modules.physics": "1.0.0",
+ "com.unity.modules.jsonserialize": "1.0.0",
+ "com.unity.modules.subsystems": "1.0.0"
+ }
+ }
+ }
+}
From 5575d911c8be5ac087dd894f158713267f1fcdb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?=
<52170489+GerardGascon@users.noreply.github.com>
Date: Thu, 22 Sep 2022 13:44:49 +0200
Subject: [PATCH 02/12] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index a529c25..1cc8b71 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,7 @@ Text commands:
--> Pauses during a period of time
--> Reproduces an animation
--> Changes reveal speed
+ --> Plays a sound from the Audio Manager
```
### SceneManager
From 0837786d010ca40c6dcb027a433fb1e00aeb6309 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?=
<52170489+GerardGascon@users.noreply.github.com>
Date: Thu, 22 Sep 2022 13:49:54 +0200
Subject: [PATCH 03/12] Revert "Update README.md"
This reverts commit 4151df922665c23da8614e734c16ac46b6b84ddc.
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 1cc8b71..9dca1c6 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,6 @@ This package will be updated once I find another useful tool or someone suggest
- Basic menu with **music and SFX sliders** as well as **resolution and quality dropdowns.**
- An **object pooler** with the ability to create pools with an undetermined size.
- A basic **scene manager** with a loading screen with progress bar.
-- A simple **timer** that is displayed inside a TextMeshPro object.
All of that comes with some editor menu items for creating all of that as fast as possible.
@@ -144,4 +143,4 @@ timer.Restart(); //Restarts the timer
You can easily set up some things by right clicking in your Project Tab and then selecting Tools and clicking on the one you want to create.
-Also you can right click in the Hierarchy for easily creating some GameObjects with the Tools in it.
+Also you can right click in the Hierarchy for easily creating some GameObjects with the Tools in it.
\ No newline at end of file
From 5dc6b69d49db907f15c5c9ef5968da5fc9ba3a70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?=
<52170489+GerardGascon@users.noreply.github.com>
Date: Thu, 22 Sep 2022 13:50:23 +0200
Subject: [PATCH 04/12] Revert "Revert "Update README.md""
This reverts commit 0837786d010ca40c6dcb027a433fb1e00aeb6309.
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 9dca1c6..1cc8b71 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ This package will be updated once I find another useful tool or someone suggest
- Basic menu with **music and SFX sliders** as well as **resolution and quality dropdowns.**
- An **object pooler** with the ability to create pools with an undetermined size.
- A basic **scene manager** with a loading screen with progress bar.
+- A simple **timer** that is displayed inside a TextMeshPro object.
All of that comes with some editor menu items for creating all of that as fast as possible.
@@ -143,4 +144,4 @@ timer.Restart(); //Restarts the timer
You can easily set up some things by right clicking in your Project Tab and then selecting Tools and clicking on the one you want to create.
-Also you can right click in the Hierarchy for easily creating some GameObjects with the Tools in it.
\ No newline at end of file
+Also you can right click in the Hierarchy for easily creating some GameObjects with the Tools in it.
From 1fde00e811c0f9b06c62a8959cc632fdb73222c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?=
<52170489+GerardGascon@users.noreply.github.com>
Date: Thu, 22 Sep 2022 13:50:33 +0200
Subject: [PATCH 05/12] Revert "Add files via upload"
This reverts commit 1df7a33ab065d1f27ec6d0f53ff1c1d5a2f2efca.
---
SimpleTools/LICENSE.md | 19 -
SimpleTools/LICENSE.md.meta | 7 -
SimpleTools/README.md | 145 -----
SimpleTools/README.md.meta | 7 -
SimpleTools/Tools.meta | 8 -
SimpleTools/Tools/AudioManager.meta | 8 -
.../Tools/AudioManager/AudioManager.cs | 271 ---------
.../Tools/AudioManager/AudioManager.cs.meta | 11 -
.../Tools/AudioManager/AudioManager.png | Bin 1644 -> 0 bytes
.../Tools/AudioManager/AudioManager.png.meta | 96 ---
SimpleTools/Tools/AudioManager/Sounds.cs | 53 --
SimpleTools/Tools/AudioManager/Sounds.cs.meta | 11 -
SimpleTools/Tools/Cinemachine.meta | 8 -
.../Tools/Cinemachine/CMCameraTrigger.cs | 40 --
.../Tools/Cinemachine/CMCameraTrigger.cs.meta | 11 -
SimpleTools/Tools/Cinemachine/ScreenShake.cs | 38 --
.../Tools/Cinemachine/ScreenShake.cs.meta | 11 -
SimpleTools/Tools/DialogueSystem.meta | 8 -
SimpleTools/Tools/DialogueSystem/Dialogue.cs | 16 -
.../Tools/DialogueSystem/Dialogue.cs.meta | 11 -
SimpleTools/Tools/DialogueSystem/Dialogue.png | Bin 2405 -> 0 bytes
.../Tools/DialogueSystem/Dialogue.png.meta | 96 ---
.../Tools/DialogueSystem/DialogueManager.cs | 111 ----
.../DialogueSystem/DialogueManager.cs.meta | 11 -
.../Tools/DialogueSystem/DialogueUtility.cs | 170 ------
.../DialogueSystem/DialogueUtility.cs.meta | 11 -
.../DialogueSystem/DialogueVertexAnimator.cs | 265 ---------
.../DialogueVertexAnimator.cs.meta | 11 -
SimpleTools/Tools/Editor.meta | 8 -
SimpleTools/Tools/Editor/Square.png | Bin 78 -> 0 bytes
SimpleTools/Tools/Editor/Square.png.meta | 104 ----
SimpleTools/Tools/Editor/ToolsEditor.cs | 548 ------------------
SimpleTools/Tools/Editor/ToolsEditor.cs.meta | 11 -
SimpleTools/Tools/Menu.meta | 8 -
SimpleTools/Tools/Menu/MenuController.cs | 110 ----
SimpleTools/Tools/Menu/MenuController.cs.meta | 11 -
SimpleTools/Tools/MonobehaviourExtensions.cs | 12 -
.../Tools/MonobehaviourExtensions.cs.meta | 11 -
SimpleTools/Tools/ObjectPooler.meta | 8 -
.../Tools/ObjectPooler/IPooledObject.cs | 5 -
.../Tools/ObjectPooler/IPooledObject.cs.meta | 11 -
.../Tools/ObjectPooler/ObjectPooler.png | Bin 4554 -> 0 bytes
.../Tools/ObjectPooler/ObjectPooler.png.meta | 96 ---
SimpleTools/Tools/ObjectPooler/Pool.cs | 20 -
SimpleTools/Tools/ObjectPooler/Pool.cs.meta | 11 -
SimpleTools/Tools/ObjectPooler/Pooler.cs | 371 ------------
SimpleTools/Tools/ObjectPooler/Pooler.cs.meta | 11 -
SimpleTools/Tools/SceneManager.meta | 8 -
SimpleTools/Tools/SceneManager/Loader.cs | 71 ---
SimpleTools/Tools/SceneManager/Loader.cs.meta | 11 -
.../Tools/SceneManager/LoaderCallback.cs | 16 -
.../Tools/SceneManager/LoaderCallback.cs.meta | 11 -
.../Tools/SceneManager/LoadingProgressBar.cs | 19 -
.../SceneManager/LoadingProgressBar.cs.meta | 11 -
SimpleTools/Tools/Timer.meta | 8 -
SimpleTools/Tools/Timer/Timer.cs | 99 ----
SimpleTools/Tools/Timer/Timer.cs.meta | 11 -
SimpleTools/Tools/Timer/TimerType.cs | 7 -
SimpleTools/Tools/Timer/TimerType.cs.meta | 11 -
SimpleTools/Tools/Timer/TimerUpdate.cs | 6 -
SimpleTools/Tools/Timer/TimerUpdate.cs.meta | 11 -
SimpleTools/Tools/Timer/TimerUtility.cs | 36 --
SimpleTools/Tools/Timer/TimerUtility.cs.meta | 11 -
.../Tools/geri.simpletools.editor.asmdef | 24 -
.../Tools/geri.simpletools.editor.asmdef.meta | 7 -
SimpleTools/package.json | 23 -
SimpleTools/package.json.meta | 7 -
manifest.json | 40 --
packages-lock.json | 325 -----------
69 files changed, 3583 deletions(-)
delete mode 100644 SimpleTools/LICENSE.md
delete mode 100644 SimpleTools/LICENSE.md.meta
delete mode 100644 SimpleTools/README.md
delete mode 100644 SimpleTools/README.md.meta
delete mode 100644 SimpleTools/Tools.meta
delete mode 100644 SimpleTools/Tools/AudioManager.meta
delete mode 100644 SimpleTools/Tools/AudioManager/AudioManager.cs
delete mode 100644 SimpleTools/Tools/AudioManager/AudioManager.cs.meta
delete mode 100644 SimpleTools/Tools/AudioManager/AudioManager.png
delete mode 100644 SimpleTools/Tools/AudioManager/AudioManager.png.meta
delete mode 100644 SimpleTools/Tools/AudioManager/Sounds.cs
delete mode 100644 SimpleTools/Tools/AudioManager/Sounds.cs.meta
delete mode 100644 SimpleTools/Tools/Cinemachine.meta
delete mode 100644 SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs
delete mode 100644 SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs.meta
delete mode 100644 SimpleTools/Tools/Cinemachine/ScreenShake.cs
delete mode 100644 SimpleTools/Tools/Cinemachine/ScreenShake.cs.meta
delete mode 100644 SimpleTools/Tools/DialogueSystem.meta
delete mode 100644 SimpleTools/Tools/DialogueSystem/Dialogue.cs
delete mode 100644 SimpleTools/Tools/DialogueSystem/Dialogue.cs.meta
delete mode 100644 SimpleTools/Tools/DialogueSystem/Dialogue.png
delete mode 100644 SimpleTools/Tools/DialogueSystem/Dialogue.png.meta
delete mode 100644 SimpleTools/Tools/DialogueSystem/DialogueManager.cs
delete mode 100644 SimpleTools/Tools/DialogueSystem/DialogueManager.cs.meta
delete mode 100644 SimpleTools/Tools/DialogueSystem/DialogueUtility.cs
delete mode 100644 SimpleTools/Tools/DialogueSystem/DialogueUtility.cs.meta
delete mode 100644 SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs
delete mode 100644 SimpleTools/Tools/DialogueSystem/DialogueVertexAnimator.cs.meta
delete mode 100644 SimpleTools/Tools/Editor.meta
delete mode 100644 SimpleTools/Tools/Editor/Square.png
delete mode 100644 SimpleTools/Tools/Editor/Square.png.meta
delete mode 100644 SimpleTools/Tools/Editor/ToolsEditor.cs
delete mode 100644 SimpleTools/Tools/Editor/ToolsEditor.cs.meta
delete mode 100644 SimpleTools/Tools/Menu.meta
delete mode 100644 SimpleTools/Tools/Menu/MenuController.cs
delete mode 100644 SimpleTools/Tools/Menu/MenuController.cs.meta
delete mode 100644 SimpleTools/Tools/MonobehaviourExtensions.cs
delete mode 100644 SimpleTools/Tools/MonobehaviourExtensions.cs.meta
delete mode 100644 SimpleTools/Tools/ObjectPooler.meta
delete mode 100644 SimpleTools/Tools/ObjectPooler/IPooledObject.cs
delete mode 100644 SimpleTools/Tools/ObjectPooler/IPooledObject.cs.meta
delete mode 100644 SimpleTools/Tools/ObjectPooler/ObjectPooler.png
delete mode 100644 SimpleTools/Tools/ObjectPooler/ObjectPooler.png.meta
delete mode 100644 SimpleTools/Tools/ObjectPooler/Pool.cs
delete mode 100644 SimpleTools/Tools/ObjectPooler/Pool.cs.meta
delete mode 100644 SimpleTools/Tools/ObjectPooler/Pooler.cs
delete mode 100644 SimpleTools/Tools/ObjectPooler/Pooler.cs.meta
delete mode 100644 SimpleTools/Tools/SceneManager.meta
delete mode 100644 SimpleTools/Tools/SceneManager/Loader.cs
delete mode 100644 SimpleTools/Tools/SceneManager/Loader.cs.meta
delete mode 100644 SimpleTools/Tools/SceneManager/LoaderCallback.cs
delete mode 100644 SimpleTools/Tools/SceneManager/LoaderCallback.cs.meta
delete mode 100644 SimpleTools/Tools/SceneManager/LoadingProgressBar.cs
delete mode 100644 SimpleTools/Tools/SceneManager/LoadingProgressBar.cs.meta
delete mode 100644 SimpleTools/Tools/Timer.meta
delete mode 100644 SimpleTools/Tools/Timer/Timer.cs
delete mode 100644 SimpleTools/Tools/Timer/Timer.cs.meta
delete mode 100644 SimpleTools/Tools/Timer/TimerType.cs
delete mode 100644 SimpleTools/Tools/Timer/TimerType.cs.meta
delete mode 100644 SimpleTools/Tools/Timer/TimerUpdate.cs
delete mode 100644 SimpleTools/Tools/Timer/TimerUpdate.cs.meta
delete mode 100644 SimpleTools/Tools/Timer/TimerUtility.cs
delete mode 100644 SimpleTools/Tools/Timer/TimerUtility.cs.meta
delete mode 100644 SimpleTools/Tools/geri.simpletools.editor.asmdef
delete mode 100644 SimpleTools/Tools/geri.simpletools.editor.asmdef.meta
delete mode 100644 SimpleTools/package.json
delete mode 100644 SimpleTools/package.json.meta
delete mode 100644 manifest.json
delete mode 100644 packages-lock.json
diff --git a/SimpleTools/LICENSE.md b/SimpleTools/LICENSE.md
deleted file mode 100644
index 58c3550..0000000
--- a/SimpleTools/LICENSE.md
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2021 Geri
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/SimpleTools/LICENSE.md.meta b/SimpleTools/LICENSE.md.meta
deleted file mode 100644
index de5ec90..0000000
--- a/SimpleTools/LICENSE.md.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 535f36a1918d4d2479031f3ca2725323
-TextScriptImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/README.md b/SimpleTools/README.md
deleted file mode 100644
index b9678df..0000000
--- a/SimpleTools/README.md
+++ /dev/null
@@ -1,145 +0,0 @@
-# Simple Tools
-
-This package contains simple tools to use in your project.
-
-This package will be updated once I find another useful tool or someone suggest me one.
-
-## Features
-
-- **AudioManager** with Play, Pause and most of the other basic things, as well as some effects like FadeIn or FadeOut.
-- Some Cinemachine tools for making a **camera trigger** and an easy way for creating a **screen shake camera.**
-- Basic **dialogue system** that works with TextMeshPro.
-- Basic menu with **music and SFX sliders** as well as **resolution and quality dropdowns.**
-- An **object pooler** with the ability to create pools with an undetermined size.
-- A basic **scene manager** with a loading screen with progress bar.
-
-All of that comes with some editor menu items for creating all of that as fast as possible.
-
-## How to install
-
-First install the TextMeshPro and Cinemachine into your Unity project
-
-### Git Installation (Best way to get latest version)
-
-If you have git in your computer, you can open Package Manager inside Unity, select "Add package from Git url...", and paste link [https://github.com/GerardGascon/SimpleTools.git](https://github.com/GerardGascon/SimpleTools.git)
-
-or
-
-Open the manifest.json file of your Unity project. Add "com.geri.simpletools": "[https://github.com/GerardGascon/SimpleTools.git](https://github.com/GerardGascon/SimpleTools.git)"
-
-### Manual Installation
-
-Download latest package from the Release section Import SimpleTools.unitypackage to your Unity Project
-
-## Usage
-
-### AudioManager
-
-```csharp
-using SimpleTools.AudioManager;
-
-AudioManager.instance.Play("Name"); //Plays the sound with that name
-AudioManager.instance.Play("Name", 1f); //Starts playing the sound "Name" in 1 second
-AudioManager.instance.PlayOneShot("Name"); //Plays one shot of that sound (Useful for repeated sounds)
-AudioManager.instance.PlayWithIntro("Intro", "Loop"); //Plays the intro and then the loop
-
-AudioManager.instance.Pause("Name"); //Pauses the sound
-AudioManager.instance.UnPause("Name"); //Unpauses the sound
-
-AudioManager.instance.Stop("Name"); //Stops the sound
-AudioManager.instance.StopAll(); //Stops all the sounds that are being played
-
-AudioManager.instance.GetSource("Name"); //Gets the AudioSource with that name
-
-AudioManager.instance.FadeIn("Name", 1f); //Fade In the source with a specific duration
-AudioManager.instance.FadeOut("Name", 1f); //Fade Out the source with a specific duration
-
-AudioManager.instance.PlayMuted("Name"); //Play a sound muted
-AudioManager.instance.FadeMutedIn("Name", 1f); //Fade In a muted sound with a specific duration
-AudioManager.instance.FadeMutedOut("Name", 1f); //Fade Out a sound without stopping it
-```
-
-### ObjectPooler
-
-The SpawnFromPool function always return a GameObject
-
-```csharp
-using SimpleTools.ObjectPooler;
-
-Pool pool; //The pool scriptable object goes here
-Pooler.CreatePools(pool); //Create the pool, without creating it you cannot spawn it
-Pool[] pools;
-Pooler.CreatePools(pools); //Create multiple pools
-Pooler.Destroy(gameObject); //Destroys a GameObject and returns it into the pool scene
-
-Pooler.SpawnFromPool("Name", Vector3.zero); //Spawns an object into a specific position
-Pooler.SpawnFromPool("Name", Vector3.zero, Quaternion.identity); //Spawn into a specific position and rotation
-Pooler.SpawnFromPool("Name", Vector3.zero, transform); //Spawn into a specific position and parent
-Pooler.SpawnFromPool("Name", Vector3.zero, Quaternion.identity, transform); //Spawn into a specific position, rotation and parent
-Pooler.SpawnFromPool("Name", Vector3.zero, transform, true); //Spawn into a specific position, parent and instantiate in worldSpace or not
-Pooler.SpawnFromPool("Name", Vector3.zero, Quaternion.identity, transform, true); //Spawn into a specific position, rotation, parent and instantiate in worldSpace or not
-```
-
-### Dialogue System
-
-The Dialogue function returns a bool (true if it's talking, false if it has ended)
-
-```csharp
-using SimpleTools.DialogueSystem;
-
-Dialogue dialogue; //The dialogue scriptable object goes here
-DialogueSystem.instance.Dialogue(dialogue); //Start/Continue the dialogue
-DialogueSystem.instance.Dialogue(dialogue, "Sound1", "Sound2"); //Start/Continue the dialogue with a random set of sounds for the text reveal
-```
-
-Text commands:
-
-```html
- --> Sets font color within tags
- --> Sets font size within tags
- --> Draws a sprite from the TextMeshPro
- --> Pauses during a period of time
- --> Reproduces an animation
- --> Changes reveal speed
-```
-
-### SceneManager
-
-```csharp
-using SimpleTools.SceneManagement;
-
-Loader.Load(0); //Loads a scene with a specific build index
-Loader.Load("Scene"); //Loads a scene with a specific name
-```
-
-### ScreenShake
-
-```csharp
-using SimpleTools.Cinemachine;
-
-ScreenShake.Shake(1f, .25f); //Shakes the camera with an intensity and duration
-```
-
-### Timer
-
-```csharp
-using SimpleTools.Timer;
-
-//Setup a stopwatch that updates at an unscaled time
-Timer timer = textMeshProText.SetupTimer(TimerType.Stopwatch, TimerUpdate.UnscaledTime);
-//Setup a clock
-Timer timer = textMeshProText.SetupTimer(TimerType.Clock, TimerUpdate.UnscaledTime);
-//Setup a countdown with the default time of 60 seconds
-Timer timer = textMeshProText.SetupTimer(TimerType.Countdown, TimerUpdate.UnscaledTime, 60f);
-
-timer.Play(); //Play or resume the timer
-timer.Stop(); //Pause the timer
-timer.ResetTimer(); //Pause and sets the time to the default one
-timer.Restart(); //Restarts the timer
-```
-
-### Editor
-
-You can easily set up some things by right clicking in your Project Tab and then selecting Tools and clicking on the one you want to create.
-
-Also you can right click in the Hierarchy for easily creating some GameObjects with the Tools in it.
\ No newline at end of file
diff --git a/SimpleTools/README.md.meta b/SimpleTools/README.md.meta
deleted file mode 100644
index 3c5c492..0000000
--- a/SimpleTools/README.md.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: ee23fd1b6b87e954f836c97747d4c083
-TextScriptImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools.meta b/SimpleTools/Tools.meta
deleted file mode 100644
index b32c30e..0000000
--- a/SimpleTools/Tools.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 78a1b199ab0716542b34cc9a3dd3a9df
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/AudioManager.meta b/SimpleTools/Tools/AudioManager.meta
deleted file mode 100644
index f12a26c..0000000
--- a/SimpleTools/Tools/AudioManager.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 1d98cf7b5d008ba4a832612b94195e04
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/AudioManager/AudioManager.cs b/SimpleTools/Tools/AudioManager/AudioManager.cs
deleted file mode 100644
index 7ce5230..0000000
--- a/SimpleTools/Tools/AudioManager/AudioManager.cs
+++ /dev/null
@@ -1,271 +0,0 @@
-using System.Collections;
-using UnityEngine;
-using System;
-
-namespace SimpleTools.AudioManager {
- public class AudioManager : MonoBehaviour {
-
- public static AudioManager instance;
-
- [SerializeField] Sounds soundList = default;
-
- void Awake() {
- if (instance == null) {
- instance = this;
- } else {
- Destroy(gameObject);
- return;
- }
- DontDestroyOnLoad(gameObject);
-
- foreach (Sounds.List s in soundList.sounds) {
- if (string.IsNullOrEmpty(s.name) || string.IsNullOrWhiteSpace(s.name)) {
- Debug.LogWarning("The name one sound is empty");
- continue;
- }
-
- GameObject sound = new GameObject(s.name);
- sound.transform.parent = transform;
- s.source = sound.AddComponent();
-
- if (soundList.mainMixer && soundList.sfxMixer) {
- if (s.type == Sounds.List.Type.Music)
- s.source.outputAudioMixerGroup = soundList.mainMixer;
- else
- s.source.outputAudioMixerGroup = soundList.sfxMixer;
- }
-
- s.source.clip = s.clip;
-
- s.source.volume = s.volume;
- s.source.pitch = s.pitch;
- s.source.loop = s.loop;
- }
- }
-
- #region Play
- /// Use this to play a sound with a specific name
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void Play(string name) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = s.RandomVolume;
- s.source.Play();
- }
- /// Use this to play a sound with a specific name and with a certain delay
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void Play(string name, float delay) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = s.RandomVolume;
- s.source.PlayDelayed(delay);
- }
- /// Use this to play one shot of a sound with a specific name
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void PlayOneShot(string name) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = s.RandomVolume;
- s.source.PlayOneShot(s.clip);
- }
- /// Use this to play an intro song and then start playing the song loop
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void PlayWithIntro(string intro, string song) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == intro);
- if (s == null) {
- Debug.LogWarning("Sound: " + intro + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = s.RandomVolume;
- s.source.Play();
-
- float introDuration = s.clip.length;
- Play(song, introDuration);
- }
- /// Use this to play one shot of a random sound within a list
- /// They have to be in the Sound asset referenced in the AudioManager instance
- ///
- public void PlayRandomSound(params string[] names) {
- int random = UnityEngine.Random.Range(0, names.Length);
- PlayOneShot(names[random]);
- }
- #endregion
- #region Pause
- /// Use this to pause a sound with a specific name
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void Pause(string name) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = s.RandomVolume;
- s.source.Pause();
- }
- /// Use this to unpause a sound with a specific name
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void UnPause(string name) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = s.RandomVolume;
- s.source.UnPause();
- }
- #endregion
- #region Stop
- /// Use this to stop a sound with a specific name
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void Stop(string name) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = s.RandomVolume;
- s.source.Stop();
- }
- /// Use this to stop all the sounds
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void StopAll() {
- foreach (Sounds.List s in soundList.sounds) {
- if (s.source) {
- s.source.Stop();
- }
- }
- }
- #endregion
- /// This function returns the AudioSource that contains a specific sound
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public AudioSource GetSource(string name) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return null;
- }
- return s.source;
- }
- #region Fades
- /// Use this to start playing a sound with a fade in
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void FadeIn(string name, float duration) {
- StartCoroutine(FadeInCoroutine(name, duration));
- }
- IEnumerator FadeInCoroutine(string name, float fadeTime) {
- AudioSource audioSource = GetSource(name);
- if (audioSource != null && !audioSource.isPlaying) {
- float volume = audioSource.volume;
- audioSource.volume = 0;
- audioSource.Play();
- while (audioSource.volume < volume) {
- audioSource.volume += Time.deltaTime / fadeTime;
- yield return null;
- }
-
- audioSource.volume = volume;
- }
- }
- /// Use this to stop playing a sound with a fade out
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void FadeOut(string name, float duration) {
- StartCoroutine(FadeOutCoroutine(name, duration));
- }
- IEnumerator FadeOutCoroutine(string name, float fadeTime) {
- AudioSource audioSource = GetSource(name);
-
- if (audioSource && audioSource.isPlaying) {
- float startVolume = audioSource.volume;
-
- while (audioSource.volume > 0) {
- audioSource.volume -= startVolume * Time.deltaTime / fadeTime;
- yield return null;
- }
-
- audioSource.Stop();
- audioSource.volume = startVolume;
- }
- }
-
- /// Use this to start playing a sound muted
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void PlayMuted(string name) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- return;
- }
- s.source.pitch = s.RandomPitch;
- s.source.volume = 0f;
- s.source.Play();
- }
- /// Use this to fade in a sound that is currently muted
- /// It has to be in the Sound asset referenced in the AudioManager instance
- /// WARNING: If the PlayMuted hasn't been called before, this function won't work
- ///
- public void FadeMutedIn(string name, float duration) {
- StartCoroutine(FadeMutedInCoroutine(name, duration));
- }
- IEnumerator FadeMutedInCoroutine(string name, float fadeTime) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- yield break;
- }
-
- while (s.source.volume < s.volume) {
- s.source.volume += Time.deltaTime / fadeTime;
- yield return null;
- }
- s.source.volume = s.volume;
- }
- /// Use this to fade out a sound and keep playing that muted
- /// It has to be in the Sound asset referenced in the AudioManager instance
- ///
- public void FadeMutedOut(string name, float duration) {
- StartCoroutine(FadeMutedOutCoroutine(name, duration));
- }
- IEnumerator FadeMutedOutCoroutine(string name, float fadeTime) {
- Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
- if (s == null) {
- Debug.LogWarning("Sound: " + name + " not found!");
- yield break;
- }
-
- while (s.source.volume > 0) {
- s.source.volume -= Time.deltaTime / fadeTime;
- yield return null;
- }
- s.source.volume = 0;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/SimpleTools/Tools/AudioManager/AudioManager.cs.meta b/SimpleTools/Tools/AudioManager/AudioManager.cs.meta
deleted file mode 100644
index 4a77e93..0000000
--- a/SimpleTools/Tools/AudioManager/AudioManager.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7d2879f3876727040b4f0cc799ec7ada
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/AudioManager/AudioManager.png b/SimpleTools/Tools/AudioManager/AudioManager.png
deleted file mode 100644
index 712262f738675eb46063dce66b4855e7118a2d82..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1644
zcmb`I`9IqS1INF)5XLJNM+l0DRD&WBY2yfr#?=Tb)tG2{sM1BWiKmors*GB-R`>lx|un>!_nE4Ueg`?rU*2iyGzW{)gv>&*%O6yxxDnCx;pAr>$wM2>^gLAeXDu>V$=W{XCAr*c`UP&Se
zXSc_9rvB-#DBapx7OwPFk}z2@n7YB*q2&c)dIPt(3g@Tw+Aspv2I+&n%P}1b>P$&F
zkVII)58wVI+LX>`&CA>O!q~_@Xk+)iiKn{R7L+R>{_Vld8*ClhBBD2?1X$hYz)|1*
znz-uDYvl(%-xmdTf+S+vES+P-d&~;-w21=W{IYpa_+d;Z@Po-wp1??Fdm~wA$27Zt-tfgZ6$s{S)CpKBTb>EBeK#x
zCUw!k=)*=178kMazPN!4y?FDLeKmhYEf096WOvD>uu*MC$o7M=>w;tY%cE8jo7
zc)@z_z`yd30H@fdHm`m|z$5N(9Q3ydEhF~}??t0`fuv?J88SIwgJz&XAyz!HAMMoz
zBRS)mtU}gGab2i`Y56u2+7^~1$lyfi!K)`dAemgKULKN3wWd#$0RPV+OGvEmEp!Rg
zJ@B`>+L84$EwW!)6o@vRkG_KG2zTw)7rJ7k3TF5G4vG-&kD(Tx1Wq{+=g5ch%BSYy#vJLLf;Y%zXP8
zI9n)xy6}Sy`0IAd>|n?fv5hp5@}}6m3|g-cBz*J<1!Dw_gMOi427jTpVnB~`e~{Lq
z6RY{U;;73^?j1k{XTr#c`R+T#J3$muc^Nc5%$7!Z%RiTmWLD;7A?`H$hJwydF0x>M
zoqmyM5UaTwV_zwg5*R*jyvc|N-CD%N@uE;J8Ig<~5l5uiK8hTuwE=0Hx%#~~pFbWu
z=6tRlHQ2~bi>*?p%*f0WAXVM*^m;oHrcG=oHDK)Ag4u74bOesB8(Ms&RlTPs4>eZC
zpzU~SK!#60uSm=S)X=a6tJr|Tm1UsCx{}PZaGD;5O>xZ<>zqnZm!Tn-H+hFY|@K`
z%=+cws1k)CPcp6CrFzL-V7TeC5-Mxdp<`)2QG;jtz=D1y>GY>bC2$EJaGjRb>ITaK
z!ilNGcJ<}kZr`vM%f77Yy>BYH6MxCOOW5NWsrn+Wu>AKQbDf6$FOT|sCn5hOs{B!A
zadw5sr>gY?O_@JQ-6(X<4&pn%wIz%!X*WeSn(qbLeJ^ChV0`0%bimlTKhuMxo%i`g
O0ESQS;YKgc)&BuiP1UIY
diff --git a/SimpleTools/Tools/AudioManager/AudioManager.png.meta b/SimpleTools/Tools/AudioManager/AudioManager.png.meta
deleted file mode 100644
index 61ce9f6..0000000
--- a/SimpleTools/Tools/AudioManager/AudioManager.png.meta
+++ /dev/null
@@ -1,96 +0,0 @@
-fileFormatVersion: 2
-guid: af0857324620d1d4b8b6bf41b6cdecfc
-TextureImporter:
- internalIDToNameTable: []
- externalObjects: {}
- serializedVersion: 11
- mipmaps:
- mipMapMode: 0
- enableMipMap: 1
- sRGBTexture: 1
- linearTexture: 0
- fadeOut: 0
- borderMipMap: 0
- mipMapsPreserveCoverage: 0
- alphaTestReferenceValue: 0.5
- mipMapFadeDistanceStart: 1
- mipMapFadeDistanceEnd: 3
- bumpmap:
- convertToNormalMap: 0
- externalNormalMap: 0
- heightScale: 0.25
- normalMapFilter: 0
- isReadable: 0
- streamingMipmaps: 0
- streamingMipmapsPriority: 0
- vTOnly: 0
- grayScaleToAlpha: 0
- generateCubemap: 6
- cubemapConvolution: 0
- seamlessCubemap: 0
- textureFormat: 1
- maxTextureSize: 2048
- textureSettings:
- serializedVersion: 2
- filterMode: -1
- aniso: -1
- mipBias: -100
- wrapU: -1
- wrapV: -1
- wrapW: -1
- nPOTScale: 1
- lightmap: 0
- compressionQuality: 50
- spriteMode: 0
- spriteExtrude: 1
- spriteMeshType: 1
- alignment: 0
- spritePivot: {x: 0.5, y: 0.5}
- spritePixelsToUnits: 100
- spriteBorder: {x: 0, y: 0, z: 0, w: 0}
- spriteGenerateFallbackPhysicsShape: 1
- alphaUsage: 1
- alphaIsTransparency: 0
- spriteTessellationDetail: -1
- textureType: 0
- textureShape: 1
- singleChannelComponent: 0
- flipbookRows: 1
- flipbookColumns: 1
- maxTextureSizeSet: 0
- compressionQualitySet: 0
- textureFormatSet: 0
- ignorePngGamma: 0
- applyGammaDecoding: 0
- platformSettings:
- - serializedVersion: 3
- buildTarget: DefaultTexturePlatform
- maxTextureSize: 2048
- resizeAlgorithm: 0
- textureFormat: -1
- textureCompression: 1
- compressionQuality: 50
- crunchedCompression: 0
- allowsAlphaSplitting: 0
- overridden: 0
- androidETC2FallbackOverride: 0
- forceMaximumCompressionQuality_BC6H_BC7: 0
- spriteSheet:
- serializedVersion: 2
- sprites: []
- outline: []
- physicsShape: []
- bones: []
- spriteID:
- internalID: 0
- vertices: []
- indices:
- edges: []
- weights: []
- secondaryTextures: []
- spritePackingTag:
- pSDRemoveMatte: 0
- pSDShowRemoveMatteOption: 0
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/AudioManager/Sounds.cs b/SimpleTools/Tools/AudioManager/Sounds.cs
deleted file mode 100644
index 35e2dd0..0000000
--- a/SimpleTools/Tools/AudioManager/Sounds.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using UnityEngine;
-using UnityEngine.Audio;
-
-namespace SimpleTools.AudioManager {
- [CreateAssetMenu(fileName = "Sounds", menuName = "Simple Tools/Sounds", order = 11)]
- public class Sounds : ScriptableObject {
-
- [Tooltip("The music mixer.")]
- public AudioMixerGroup mainMixer = default;
- [Tooltip("The SFX mixer.")]
- public AudioMixerGroup sfxMixer = default;
-
- public List[] sounds;
-
- [System.Serializable]
- public class List {
- [Tooltip("Name of the sound. Each name has to be different between each other.")]
- public string name;
-
- public AudioClip clip;
-
- [System.Serializable] public enum Type { Music, SFX }
- [Space]
- [Tooltip("Is it part of the music or the SFX?")] public Type type;
-
- [Space]
- [Tooltip("Default volume of the sound."), Range(0f, 1f)] public float volume;
- [Tooltip("Variance percentage of the volume"), Range(0f, 1f)] public float volumeVariance;
- [Tooltip("Default pitch of the sound."), Range(.1f, 3f)] public float pitch;
- [Tooltip("Variance percentage of the pitch"), Range(0f, 1f)] public float pitchVariance;
-
- public bool loop;
-
- [HideInInspector] public AudioSource source;
-
- float randomVolume;
- public float RandomVolume {
- get {
- randomVolume = volume * (1f + Random.Range(-volumeVariance / 2f, volumeVariance / 2f));
- return randomVolume;
- }
- }
-
- float randomPitch;
- public float RandomPitch {
- get {
- randomPitch = pitch * (1f + Random.Range(-pitchVariance / 2f, pitchVariance / 2f));
- return randomPitch;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/SimpleTools/Tools/AudioManager/Sounds.cs.meta b/SimpleTools/Tools/AudioManager/Sounds.cs.meta
deleted file mode 100644
index a22e5ea..0000000
--- a/SimpleTools/Tools/AudioManager/Sounds.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 6ded47588579f3047b1c3cd72cd87044
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {fileID: 2800000, guid: af0857324620d1d4b8b6bf41b6cdecfc, type: 3}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/Cinemachine.meta b/SimpleTools/Tools/Cinemachine.meta
deleted file mode 100644
index 608d7cd..0000000
--- a/SimpleTools/Tools/Cinemachine.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 5a2ff5ceb779d824d811d139fa608262
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs b/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs
deleted file mode 100644
index 8afd47a..0000000
--- a/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using UnityEngine;
-using Cinemachine;
-
-namespace SimpleTools.Cinemachine {
- public class CMCameraTrigger : MonoBehaviour {
-
- CinemachineVirtualCamera vcam;
-
- void Awake() {
- vcam = GetComponentInChildren(true);
- vcam.gameObject.SetActive(false);
- }
-
- #region 3D
- void OnTriggerEnter(Collider col) {
- if (col.CompareTag("Player")) {
- vcam.gameObject.SetActive(true);
- }
- }
- void OnTriggerExit(Collider col) {
- if (col.CompareTag("Player")) {
- vcam.gameObject.SetActive(true);
- }
- }
- #endregion
-
- #region 2D
- void OnTriggerEnter2D(Collider2D col) {
- if (col.CompareTag("Player")) {
- vcam.gameObject.SetActive(true);
- }
- }
- void OnTriggerExit2D(Collider2D col) {
- if (col.CompareTag("Player")) {
- vcam.gameObject.SetActive(false);
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs.meta b/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs.meta
deleted file mode 100644
index 7d3bb42..0000000
--- a/SimpleTools/Tools/Cinemachine/CMCameraTrigger.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 368758c1440a4cb4c867e140e8934c09
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/Cinemachine/ScreenShake.cs b/SimpleTools/Tools/Cinemachine/ScreenShake.cs
deleted file mode 100644
index 5d4aaa5..0000000
--- a/SimpleTools/Tools/Cinemachine/ScreenShake.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Cinemachine;
-using UnityEngine;
-
-namespace SimpleTools.Cinemachine {
- public static class ScreenShake {
-
- static CinemachineVirtualCamera vCam;
- static ScreenShakeUpdate shakeUpdate;
-
- class ScreenShakeUpdate : MonoBehaviour {
- [HideInInspector] public float shakeTimer;
- [HideInInspector] public float shakeTimerTotal;
- [HideInInspector] public float startingIntensity;
-
- void Update() {
- if (shakeTimer > 0) {
- shakeTimer -= Time.deltaTime;
- CinemachineBasicMultiChannelPerlin multiChannelPerlin = vCam.GetCinemachineComponent();
- multiChannelPerlin.m_AmplitudeGain = Mathf.Lerp(startingIntensity, 0f, 1 - (shakeTimer / shakeTimerTotal));
- }
- }
- }
-
- /// Shake the camera
- /// It needs a cinemachine camera with a noise profile in it.
- ///
- public static void Shake(float intensity, float time) {
- if (vCam == null) {
- vCam = Camera.main.GetComponent().ActiveVirtualCamera.VirtualCameraGameObject.GetComponent();
- }
- if (shakeUpdate == null) {
- shakeUpdate = new GameObject("ShakeUpdate").AddComponent();
- }
- shakeUpdate.startingIntensity = intensity;
- shakeUpdate.shakeTimer = shakeUpdate.shakeTimerTotal = time;
- }
- }
-}
\ No newline at end of file
diff --git a/SimpleTools/Tools/Cinemachine/ScreenShake.cs.meta b/SimpleTools/Tools/Cinemachine/ScreenShake.cs.meta
deleted file mode 100644
index 048e505..0000000
--- a/SimpleTools/Tools/Cinemachine/ScreenShake.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 181034c7ad5ece241a2737ab35d47c5c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem.meta b/SimpleTools/Tools/DialogueSystem.meta
deleted file mode 100644
index b94d838..0000000
--- a/SimpleTools/Tools/DialogueSystem.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 645cca644899cc74882ea9bc1d9c5aa9
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.cs b/SimpleTools/Tools/DialogueSystem/Dialogue.cs
deleted file mode 100644
index 7b9ce5a..0000000
--- a/SimpleTools/Tools/DialogueSystem/Dialogue.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using UnityEngine;
-
-namespace SimpleTools.DialogueSystem {
- [CreateAssetMenu(fileName = "New Dialogue", menuName = "Simple Tools/Dialogue", order = 11)]
- public class Dialogue : ScriptableObject {
- public DialogueBox[] sentences;
- }
-
- [System.Serializable]
- public class DialogueBox {
- public bool displayName;
- public string characterName;
- public Sprite characterImage;
- [TextArea(5, 10)] public string sentence;
- }
-}
\ No newline at end of file
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.cs.meta b/SimpleTools/Tools/DialogueSystem/Dialogue.cs.meta
deleted file mode 100644
index 63ccf99..0000000
--- a/SimpleTools/Tools/DialogueSystem/Dialogue.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: bd553cd05b84d614b998afe62e37c17c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {fileID: 2800000, guid: 4dfc626116fd10c4f972c17720d957ac, type: 3}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.png b/SimpleTools/Tools/DialogueSystem/Dialogue.png
deleted file mode 100644
index 3bff2d35af56bc93cbb250520d3bfcca02168d49..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2405
zcmV-r37YnaP)
z3G5w39mhZa2Noz6S_qd?ZUj=LfK)l<2uFbcLQ-f6(JDwnF~NcXBPJ*z9EA!RLO4R9
zB>@x&P*TX>fZT`LDzOJpX@GE4u7Xf1El17N-y@I5|Lx4a-I<-){e6;`9&dKvZ+5=B
zJM)|Q{RTx*6h%=KrFjgTzv$CEl^z8g0_+8R3)mdk5cmqPT0V7TKn
zn4fZeT?H@>m;xLRY~bIlq<9**9+;7$@h!{un*cL`zXFrB@rT4b4Q~LR1&)o-zD%+N
zU@Eg1_(24Arohg?-N3ae8Qn_&Ka6`U?bod
zOSvc1AJCIQXCZ)edEv&h7F_%;NhoULzxb11x2(1C|A{CuPpG*uFck
zacuQ70vKZ{b7LS|Qs-r0Zblu<5P8?w>e#Y$PL>0I4`@&7JZ!OlbZqrA0{Cji_pbsU
z2ec=3UbomkBDVUqEY6?h0d1)RA6n`#EVeqfEUS3d3TR6muwAduVymNVL5NawQ~(V}
z1<-I*01Zb4&~Q`$4Mzpga8v*dM+MMuQ~(V}1yC-w;MnMbXH@{@@`mMXZ^mY@>oV}z
z*;>NY$4EHah>no%P^<*LZTYP;B+|NQ*w}!4%!=&yfmdX)?%ceqv{M$qX28k71mL?7
z*yF-}^6|yLfd_y;0{6Q7MvAY1^<+8r5(&CUrSU_sx!e@9C8Ymo+i#{OfbkNt{tICJ
z2<(ZOaUuj0m9%azJ5v(CxxoFvmJ!&J5|e;M63O%>QW1c8^
zI8z?^N->55Pjx5#h+P1C#vE9gAREdk;d5di2Ik3EFi+z2o|WNHT~pR|Vmf!*$c=I&
zu&Ki_##b@5od_gm0i5L+QEPG({0ew5fK4$oT+;ho=#Z%6x02cH{a9ZCMwq{GD0elm
zw>JJ7OcKkBB>e0(hw^4rWlignD~)K0Ot3^OAz4b!sK~yUSs<^36&4#!;?IGWrIC9&
z5Il2|<@7H}mJ(%XOdset%e671frE_z{+m(g>lIw!VGbedQv%tNGJgUdv)F$`%Q8hd
zYAEM{XU159D3^*yP_bhhLho(_@VuqaguoZtmU(MVAUo=S30MClqaIru0X%7`=+wX$
z!j?s2NgzAwz%t8-U}Vc7x6McyGls&pSmM1#HDPhy$vDF>Gv0ntHa{4bQSiqyya>)|^{`Z9I!47Ma=%ZoXV$*T82+Y@*`aG&Kw#(T7tq(1c-=Wc7Lyw0mzW%W>9
zFbvXJDWb1vXS$1I@Ri3=8)V_qso
zbt}y{k!AsZsQ3a`<<0a(sZZZd0W6Zo%cVJv-%UQfc)1S&{3mC5r2yS`?X;5f0>0J9
zG24~+`-+93ItZr6e^W&lZX$4AMZeuhdi4;0BqM{6Oq3pb*;CZts9D37nr=30L5N8q
z|ETzr$Cmk{L(pz~ADkzXT6ORP40JE)DvE7I(8JQn`-#lG`w)W9#y9-VKT>
z2;qCuQ8d$xZ6exHGXtEbrq!4jl8N7K*&44
zZrQ|26?7E|B5aLs8~^8B6nUJ)1=OK$v5pLr^N@AD20{zK<<2iVF5sD*d4)!xU)${$yK2QkmsGB70YJWsRVnP!lsryOUptCAa93nvE}=t3fj{o4zY|H
zUh*w~etP>R&D*;f-)}5YOp2YeEG6do6hOa2y-yq_J9MF^orwth5I`ADo_icRgU8Co2)gaf7dcS&3b6T8*5nT=`{I@9;XBu%
zjLBd0oc0OUFdCRHuTNW!#g%2HitTjTlxEH@Nbh8secAu0A80BKvh2-
z+IQi7mX2)}yGl$(ce1BXC7asUWY?6#bIcP=5fKy?K)Zquc=GKZ?U2Q+%?=J3#;W2K
z>5%mkEp4K*ep;g44@#ERH59!=#>lYk(BgIt$zlmUNuAM>+b7E_*NZY&NWI$aM=2_R
zJAm&LJco^0va~F9w(L^`Wn~0eDzA!_o&Q->0P}(61<&Ea^qS-b?pFjw`G?60Dt)6b
zkkSxphNQClX9TtsA+!j75A4w^SypOe=(!T2evV^K{8$Mg0+TFyf7x@XC#gD7E|XkB
zlYzS&oJKL?Lj-2TbQQ3d3=1E(9gyf
zgRP3xKn38JP$K9X6@Y)D7J&*N3`IoXHLyhm5RQICK*yh6PyvJ`uLw*U|9yR0r~(Mj
zLYY8w5y5zyC$A_ffNEHfLj+z?0aQm6B2WQTOXVU^0aQ<=B2WRuL1iLP0mMTkB2WRu
zMOy?Pg|bQo5FZP~SrkMBDu6f%CIS^eyaW+}3LtL0i$DbsKVC(k0!RaIB2WROgBKB~
z0Mep#5vTytqwOqeXFe^I0aXQ%Ci5lI7YWhto4N#sG!c^m_ZW$SQWQl|6h%=KM}YqU
X65^Z_x-SEH00000NkvXXu0mjf!ZT!a
diff --git a/SimpleTools/Tools/DialogueSystem/Dialogue.png.meta b/SimpleTools/Tools/DialogueSystem/Dialogue.png.meta
deleted file mode 100644
index 4991597..0000000
--- a/SimpleTools/Tools/DialogueSystem/Dialogue.png.meta
+++ /dev/null
@@ -1,96 +0,0 @@
-fileFormatVersion: 2
-guid: 4dfc626116fd10c4f972c17720d957ac
-TextureImporter:
- internalIDToNameTable: []
- externalObjects: {}
- serializedVersion: 11
- mipmaps:
- mipMapMode: 0
- enableMipMap: 1
- sRGBTexture: 1
- linearTexture: 0
- fadeOut: 0
- borderMipMap: 0
- mipMapsPreserveCoverage: 0
- alphaTestReferenceValue: 0.5
- mipMapFadeDistanceStart: 1
- mipMapFadeDistanceEnd: 3
- bumpmap:
- convertToNormalMap: 0
- externalNormalMap: 0
- heightScale: 0.25
- normalMapFilter: 0
- isReadable: 0
- streamingMipmaps: 0
- streamingMipmapsPriority: 0
- vTOnly: 0
- grayScaleToAlpha: 0
- generateCubemap: 6
- cubemapConvolution: 0
- seamlessCubemap: 0
- textureFormat: 1
- maxTextureSize: 2048
- textureSettings:
- serializedVersion: 2
- filterMode: -1
- aniso: -1
- mipBias: -100
- wrapU: -1
- wrapV: -1
- wrapW: -1
- nPOTScale: 1
- lightmap: 0
- compressionQuality: 50
- spriteMode: 0
- spriteExtrude: 1
- spriteMeshType: 1
- alignment: 0
- spritePivot: {x: 0.5, y: 0.5}
- spritePixelsToUnits: 100
- spriteBorder: {x: 0, y: 0, z: 0, w: 0}
- spriteGenerateFallbackPhysicsShape: 1
- alphaUsage: 1
- alphaIsTransparency: 0
- spriteTessellationDetail: -1
- textureType: 0
- textureShape: 1
- singleChannelComponent: 0
- flipbookRows: 1
- flipbookColumns: 1
- maxTextureSizeSet: 0
- compressionQualitySet: 0
- textureFormatSet: 0
- ignorePngGamma: 0
- applyGammaDecoding: 0
- platformSettings:
- - serializedVersion: 3
- buildTarget: DefaultTexturePlatform
- maxTextureSize: 2048
- resizeAlgorithm: 0
- textureFormat: -1
- textureCompression: 1
- compressionQuality: 50
- crunchedCompression: 0
- allowsAlphaSplitting: 0
- overridden: 0
- androidETC2FallbackOverride: 0
- forceMaximumCompressionQuality_BC6H_BC7: 0
- spriteSheet:
- serializedVersion: 2
- sprites: []
- outline: []
- physicsShape: []
- bones: []
- spriteID:
- internalID: 0
- vertices: []
- indices:
- edges: []
- weights: []
- secondaryTextures: []
- spritePackingTag:
- pSDRemoveMatte: 0
- pSDShowRemoveMatteOption: 0
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueManager.cs b/SimpleTools/Tools/DialogueSystem/DialogueManager.cs
deleted file mode 100644
index 4b025a9..0000000
--- a/SimpleTools/Tools/DialogueSystem/DialogueManager.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System.Collections.Generic;
-using TMPro;
-using UnityEngine;
-using UnityEngine.UI;
-
-namespace SimpleTools.DialogueSystem {
- public class DialogueManager : MonoBehaviour {
-
- DialogueVertexAnimator dialogueVertexAnimator;
-
- Queue sentences;
- Queue displayNames;
- Queue characterNames;
- Queue characterImages;
- bool talking;
-
- public DialogueItems dialogueItems;
-
- public static DialogueManager instance;
- void Awake() {
- instance = this;
- sentences = new Queue();
- displayNames = new Queue();
- characterNames = new Queue();
- characterImages = new Queue();
-
- dialogueVertexAnimator = new DialogueVertexAnimator(dialogueItems.textBox);
- }
-
- public bool Dialogue(Dialogue dialogue) {
- return Dialogue(dialogue, string.Empty);
- }
-
- public bool Dialogue(Dialogue dialogue, params string[] sounds) {
- dialogueVertexAnimator.SetAudioSourceGroup(sounds);
-
- if (!talking) {
- sentences.Clear();
- if (dialogue.sentences.Length != 0) {
- foreach (DialogueBox sentence in dialogue.sentences) {
- sentences.Enqueue(sentence.sentence);
- displayNames.Enqueue(sentence.displayName);
- characterNames.Enqueue(sentence.characterName);
- characterImages.Enqueue(sentence.characterImage);
- }
- } else {
- sentences.Enqueue("I am error. No text has been added");
- }
- talking = true;
-
- if (sentences.Count == 0) {
- talking = false;
- return false;
- }
-
- string sentenceToShow = sentences.Peek();
- bool displayName = displayNames.Peek();
- string characterName = characterNames.Peek();
- Sprite characterImage = characterImages.Peek();
- if (PlayDialogue(sentenceToShow, displayName, characterName, characterImage)) {
- sentences.Dequeue();
- displayNames.Dequeue();
- characterNames.Dequeue();
- characterImages.Dequeue();
- }
- return true;
- } else {
- if (sentences.Count == 0) {
- talking = false;
- return false;
- }
-
- string sentenceToShow = sentences.Peek();
- bool displayName = displayNames.Peek();
- string characterName = characterNames.Peek();
- Sprite characterImage = characterImages.Peek();
- if (PlayDialogue(sentenceToShow, displayName, characterName, characterImage)) {
- sentences.Dequeue();
- displayNames.Dequeue();
- characterNames.Dequeue();
- characterImages.Dequeue();
- }
- return true;
- }
- }
-
- private Coroutine typeRoutine = null;
- bool PlayDialogue(string message, bool displayName = false, string characterName = "", Sprite characterImage = null) {
- if (dialogueVertexAnimator.IsMessageAnimating()) {
- dialogueVertexAnimator.SkipToEndOfCurrentMessage();
- return false; //Next message hasn't been shown because the current one is still animating.
- }
- this.EnsureCoroutineStopped(ref typeRoutine);
- dialogueVertexAnimator.textAnimating = false;
- List commands = DialogueUtility.ProcessInputString(message, out string totalTextMessage);
- typeRoutine = StartCoroutine(dialogueVertexAnimator.AnimateTextIn(commands, totalTextMessage, null));
-
- dialogueItems.characterImage.sprite = characterImage;
- dialogueItems.characterName.text = displayName ? characterName : "???";
- return true; //Next message shown successfully
- }
- }
-
- [System.Serializable]
- public struct DialogueItems {
- public Image characterImage;
- public TMP_Text characterName;
- public TMP_Text textBox;
- public Canvas canvas;
- }
-}
\ No newline at end of file
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueManager.cs.meta b/SimpleTools/Tools/DialogueSystem/DialogueManager.cs.meta
deleted file mode 100644
index 1cc6cbc..0000000
--- a/SimpleTools/Tools/DialogueSystem/DialogueManager.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 23d6a059fd2bc464a9cba3a5ced1724d
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs b/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs
deleted file mode 100644
index 98a67c3..0000000
--- a/SimpleTools/Tools/DialogueSystem/DialogueUtility.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-using UnityEngine;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-using System;
-
-namespace SimpleTools.DialogueSystem {
- public class DialogueUtility : MonoBehaviour {
-
- // grab the remainder of the text until ">" or end of string
- const string REMAINDER_REGEX = "(.*?((?=>)|(/|$)))";
- const string PAUSE_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
- static readonly Regex pauseRegex = new Regex(PAUSE_REGEX_STRING);
- const string SOUND_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
- static readonly Regex soundRegex = new Regex(SOUND_REGEX_STRING);
- const string SPEED_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
- static readonly Regex speedRegex = new Regex(SPEED_REGEX_STRING);
- const string ANIM_START_REGEX_STRING = "" + REMAINDER_REGEX + ")>";
- static readonly Regex animStartRegex = new Regex(ANIM_START_REGEX_STRING);
- const string ANIM_END_REGEX_STRING = "";
- static readonly Regex animEndRegex = new Regex(ANIM_END_REGEX_STRING);
-
- static readonly Dictionary pauseDictionary = new Dictionary{
- { "tiny", .1f },
- { "short", .25f },
- { "normal", 0.666f },
- { "long", 1f },
- { "read", 2f },
- };
-
- public static List ProcessInputString(string message, out string processedMessage) {
- List