From 7046716893e45c7749f82361b578cdd6b7f043b5 Mon Sep 17 00:00:00 2001 From: Geri <52170489+Geri8@users.noreply.github.com> Date: Fri, 8 Jan 2021 18:01:14 +0100 Subject: [PATCH] Add files via upload --- README.md | 17 ++++++++++++++--- README.md.meta | 2 +- Tools/AudioManager/AudioManager.cs | 13 +++++++++++++ Tools/Editor/ToolsEditor.cs | 2 ++ package.json | 2 +- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6ef300a..e69e2dd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # 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. @@ -17,11 +21,11 @@ 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/IntoTheDev/Save-System-for-Unity.git](https://github.com/IntoTheDev/Save-System-for-Unity.git) +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/Geri8/SimpleTools.git](https://github.com/Geri8/SimpleTools.git) or -Open the manifest.json file of your Unity project. Add "com.geri.simpletools": "[https://github.com/IntoTheDev/Save-System-for-Unity.git](https://github.com/IntoTheDev/Save-System-for-Unity.git)" +Open the manifest.json file of your Unity project. Add "com.geri.simpletools": "[https://github.com/Geri8/SimpleTools.git](https://github.com/Geri8/SimpleTools.git)" ### Manual Installation @@ -35,6 +39,7 @@ Download latest package from the Release section Import SimpleTools.unitypackage 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 @@ -89,4 +94,10 @@ Loader.Load("Scene"); //Loads a scene with a specific name ```csharp ScreenShake.Shake(1f, .25f); //Shakes the camera with an intensity and duration -``` \ No newline at end of file +``` + +### 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/README.md.meta b/README.md.meta index c9d9e2a..3c5c492 100644 --- a/README.md.meta +++ b/README.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e9c1d398f3d17184a97bce327ff06621 +guid: ee23fd1b6b87e954f836c97747d4c083 TextScriptImporter: externalObjects: {} userData: diff --git a/Tools/AudioManager/AudioManager.cs b/Tools/AudioManager/AudioManager.cs index c35fa6f..6edfa34 100644 --- a/Tools/AudioManager/AudioManager.cs +++ b/Tools/AudioManager/AudioManager.cs @@ -73,6 +73,19 @@ public class AudioManager : MonoBehaviour{ s.source.volume = s.RandomVolume; s.source.PlayOneShot(s.clip); } + 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); + } #endregion #region Pause public void Pause(string name){ diff --git a/Tools/Editor/ToolsEditor.cs b/Tools/Editor/ToolsEditor.cs index 3569126..9e6dc73 100644 --- a/Tools/Editor/ToolsEditor.cs +++ b/Tools/Editor/ToolsEditor.cs @@ -170,6 +170,7 @@ public class ToolsEditor{ progressBar.gameObject.AddComponent(); } +#if UNITY_2019_3_OR_NEWER [MenuItem("Assets/Create/Tools/Create Menu Scene")] static void CreateMenuScene(){ EditorSceneManager.SaveOpenScenes(); @@ -528,4 +529,5 @@ public class ToolsEditor{ } } #endregion +#endif } diff --git a/package.json b/package.json index 5079312..c429f59 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "unityRelease": "30f1", "dependencies": { "com.unity.cinemachine": "2.2.0", - "com.unity.textmeshpro": "1.0.21" + "com.unity.textmeshpro": "1.4.1" }, "keywords": [ "gamejam",