Add files via upload
Some first day fug fixes.
This commit is contained in:
parent
7046716893
commit
a29bc6aba4
7 changed files with 123 additions and 10 deletions
|
@ -66,6 +66,8 @@ Pool pool; //The pool scriptable object goes here
|
||||||
Pooler.CreatePools(pool); //Create the pool, without creating it you cannot spawn it
|
Pooler.CreatePools(pool); //Create the pool, without creating it you cannot spawn it
|
||||||
Pool[] pools;
|
Pool[] pools;
|
||||||
Pooler.CreatePools(pools); //Create multiple 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); //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, 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, transform); //Spawn into a specific position and parent
|
||||||
|
|
|
@ -43,6 +43,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Play
|
#region Play
|
||||||
|
/// <summary>Use this to play a sound with a specific name
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void Play(string name){
|
public void Play(string name){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if(s == null){
|
if(s == null){
|
||||||
|
@ -53,6 +56,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
s.source.volume = s.RandomVolume;
|
s.source.volume = s.RandomVolume;
|
||||||
s.source.Play();
|
s.source.Play();
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to play a sound with a specific name and with a certain delay
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void Play(string name, float delay){
|
public void Play(string name, float delay){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -63,6 +69,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
s.source.volume = s.RandomVolume;
|
s.source.volume = s.RandomVolume;
|
||||||
s.source.PlayDelayed(delay);
|
s.source.PlayDelayed(delay);
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to play one shot of a sound with a specific name
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void PlayOneShot(string name){
|
public void PlayOneShot(string name){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -73,6 +82,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
s.source.volume = s.RandomVolume;
|
s.source.volume = s.RandomVolume;
|
||||||
s.source.PlayOneShot(s.clip);
|
s.source.PlayOneShot(s.clip);
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to play an intro song and then start playing the song loop
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void PlayWithIntro(string intro, string song){
|
public void PlayWithIntro(string intro, string song){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == intro);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == intro);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -88,6 +100,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Pause
|
#region Pause
|
||||||
|
/// <summary>Use this to pause a sound with a specific name
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void Pause(string name){
|
public void Pause(string name){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -98,6 +113,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
s.source.volume = s.RandomVolume;
|
s.source.volume = s.RandomVolume;
|
||||||
s.source.Pause();
|
s.source.Pause();
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to unpause a sound with a specific name
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void UnPause(string name){
|
public void UnPause(string name){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -110,6 +128,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Stop
|
#region Stop
|
||||||
|
/// <summary>Use this to stop a sound with a specific name
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void Stop(string name){
|
public void Stop(string name){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -120,6 +141,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
s.source.volume = s.RandomVolume;
|
s.source.volume = s.RandomVolume;
|
||||||
s.source.Stop();
|
s.source.Stop();
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to stop all the sounds
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void StopAll(){
|
public void StopAll(){
|
||||||
foreach (Sounds.List s in soundList.sounds){
|
foreach (Sounds.List s in soundList.sounds){
|
||||||
if (s.source){
|
if (s.source){
|
||||||
|
@ -128,6 +152,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
/// <summary>This function returns the AudioSource that contains a specific sound
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public AudioSource GetSource(string name){
|
public AudioSource GetSource(string name){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -137,6 +164,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
return s.source;
|
return s.source;
|
||||||
}
|
}
|
||||||
#region Fades
|
#region Fades
|
||||||
|
/// <summary>Use this to start playing a sound with a fade in
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void FadeIn(string name, float duration){
|
public void FadeIn(string name, float duration){
|
||||||
StartCoroutine(FadeInCoroutine(name, duration));
|
StartCoroutine(FadeInCoroutine(name, duration));
|
||||||
}
|
}
|
||||||
|
@ -154,6 +184,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
audioSource.volume = volume;
|
audioSource.volume = volume;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to stop playing a sound with a fade out
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void FadeOut(string name, float duration){
|
public void FadeOut(string name, float duration){
|
||||||
StartCoroutine(FadeOutCoroutine(name, duration));
|
StartCoroutine(FadeOutCoroutine(name, duration));
|
||||||
}
|
}
|
||||||
|
@ -173,6 +206,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Use this to start playing a sound muted
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void PlayMuted(string name){
|
public void PlayMuted(string name){
|
||||||
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
Sounds.List s = Array.Find(soundList.sounds, sound => sound.name == name);
|
||||||
if (s == null){
|
if (s == null){
|
||||||
|
@ -183,6 +219,10 @@ public class AudioManager : MonoBehaviour{
|
||||||
s.source.volume = 0f;
|
s.source.volume = 0f;
|
||||||
s.source.Play();
|
s.source.Play();
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to fade in a sound that is currently muted
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// <para>WARNING: If the PlayMuted hasn't been called before, this function won't work</para>
|
||||||
|
/// </summary>
|
||||||
public void FadeMutedIn(string name, float duration){
|
public void FadeMutedIn(string name, float duration){
|
||||||
StartCoroutine(FadeMutedInCoroutine(name, duration));
|
StartCoroutine(FadeMutedInCoroutine(name, duration));
|
||||||
}
|
}
|
||||||
|
@ -199,6 +239,9 @@ public class AudioManager : MonoBehaviour{
|
||||||
}
|
}
|
||||||
s.source.volume = s.volume;
|
s.source.volume = s.volume;
|
||||||
}
|
}
|
||||||
|
/// <summary>Use this to fade out a sound and keep playing that muted
|
||||||
|
/// <para>It has to be in the Sound asset referenced in the AudioManager instance</para>
|
||||||
|
/// </summary>
|
||||||
public void FadeMutedOut(string name, float duration){
|
public void FadeMutedOut(string name, float duration){
|
||||||
StartCoroutine(FadeMutedOutCoroutine(name, duration));
|
StartCoroutine(FadeMutedOutCoroutine(name, duration));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,14 @@ public static class ScreenShake{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Shake the camera
|
||||||
|
/// <para>It needs a cinemachine camera with a noise profile in it.</para>
|
||||||
|
/// </summary>
|
||||||
public static void Shake(float intensity, float time){
|
public static void Shake(float intensity, float time){
|
||||||
if(vCam == null || shakeUpdate == null){
|
if(vCam == null){
|
||||||
vCam = Camera.main.GetComponent<CinemachineBrain>().ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVirtualCamera>();
|
vCam = Camera.main.GetComponent<CinemachineBrain>().ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVirtualCamera>();
|
||||||
|
}
|
||||||
|
if(shakeUpdate == null){
|
||||||
shakeUpdate = new GameObject("ShakeUpdate").AddComponent<ScreenShakeUpdate>();
|
shakeUpdate = new GameObject("ShakeUpdate").AddComponent<ScreenShakeUpdate>();
|
||||||
}
|
}
|
||||||
shakeUpdate.startingIntensity = intensity;
|
shakeUpdate.startingIntensity = intensity;
|
||||||
|
|
|
@ -22,6 +22,9 @@ public class DialogueSystem : MonoBehaviour{
|
||||||
anim = GetComponent<Animator>();
|
anim = GetComponent<Animator>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Start or continue the dialogue
|
||||||
|
/// <para>This function returns false if the dialogue has ended.</para>
|
||||||
|
/// </summary>
|
||||||
public bool Dialogue(Dialogue dialogue){
|
public bool Dialogue(Dialogue dialogue){
|
||||||
if(!talking){
|
if(!talking){
|
||||||
if (dialogue.displayName){
|
if (dialogue.displayName){
|
||||||
|
|
|
@ -11,13 +11,27 @@ public static class Pooler{
|
||||||
static Dictionary<string, Pool.PoolPrefab> poolDictionary;
|
static Dictionary<string, Pool.PoolPrefab> poolDictionary;
|
||||||
static Scene poolScene;
|
static Scene poolScene;
|
||||||
|
|
||||||
|
/// <summary>Generate a scene with the objects of the pools in it
|
||||||
|
/// <para>If this isn't called, the pooler won't work</para>
|
||||||
|
/// </summary>
|
||||||
public static void CreatePools(Pool pool){
|
public static void CreatePools(Pool pool){
|
||||||
poolDictionary = new Dictionary<string, Pool.PoolPrefab>();
|
if(pool == null){
|
||||||
poolScene = SceneManager.CreateScene("PoolScene");
|
Debug.LogWarning("You have to provide a pool.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach(Pool.PoolPrefab p in pool.pools){
|
poolDictionary = new Dictionary<string, Pool.PoolPrefab>();
|
||||||
|
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.undetermined){
|
||||||
p.determinedPool = new Queue<GameObject>();
|
if(p.determinedPool == null){
|
||||||
|
p.determinedPool = new Queue<GameObject>();
|
||||||
|
}
|
||||||
for (int i = 0; i < p.size; i++){
|
for (int i = 0; i < p.size; i++){
|
||||||
GameObject obj = Object.Instantiate(p.prefab);
|
GameObject obj = Object.Instantiate(p.prefab);
|
||||||
obj.SetActive(false);
|
obj.SetActive(false);
|
||||||
|
@ -26,19 +40,35 @@ public static class Pooler{
|
||||||
p.determinedPool.Enqueue(obj);
|
p.determinedPool.Enqueue(obj);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
p.undeterminedPool = new List<GameObject>();
|
if(p.undeterminedPool == null){
|
||||||
|
p.undeterminedPool = new List<GameObject>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
poolDictionary.Add(p.tag, p);
|
poolDictionary.Add(p.tag, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>Generate a scene with the objects of the pools in it
|
||||||
|
/// <para>If this isn't called, the pooler won't work</para>
|
||||||
|
/// </summary>
|
||||||
public static void CreatePools(Pool[] pools){
|
public static void CreatePools(Pool[] pools){
|
||||||
|
if (pools == null){
|
||||||
|
Debug.LogWarning("You have to provide a pool.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
poolDictionary = new Dictionary<string, Pool.PoolPrefab>();
|
poolDictionary = new Dictionary<string, Pool.PoolPrefab>();
|
||||||
poolScene = SceneManager.CreateScene("PoolScene");
|
if (SceneManager.GetSceneByName("PoolScene").IsValid()){
|
||||||
|
poolScene = SceneManager.GetSceneByName("PoolScene");
|
||||||
|
}else{
|
||||||
|
poolScene = SceneManager.CreateScene("PoolScene");
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pools.Length; i++){
|
for (int i = 0; i < pools.Length; i++){
|
||||||
foreach (Pool.PoolPrefab p in pools[i].pools){
|
foreach (Pool.PoolPrefab p in pools[i].pools){
|
||||||
if (!p.undetermined){
|
if (!p.undetermined){
|
||||||
p.determinedPool = new Queue<GameObject>();
|
if (p.determinedPool == null){
|
||||||
|
p.determinedPool = new Queue<GameObject>();
|
||||||
|
}
|
||||||
for (int j = 0; j < p.size; j++){
|
for (int j = 0; j < p.size; j++){
|
||||||
GameObject obj = Object.Instantiate(p.prefab);
|
GameObject obj = Object.Instantiate(p.prefab);
|
||||||
obj.SetActive(false);
|
obj.SetActive(false);
|
||||||
|
@ -47,12 +77,16 @@ public static class Pooler{
|
||||||
p.determinedPool.Enqueue(obj);
|
p.determinedPool.Enqueue(obj);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
p.undeterminedPool = new List<GameObject>();
|
if (p.undeterminedPool == null){
|
||||||
|
p.undeterminedPool = new List<GameObject>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
poolDictionary.Add(p.tag, p);
|
poolDictionary.Add(p.tag, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>Destroy an object and return it to the pool scene
|
||||||
|
/// </summary>
|
||||||
public static void Destroy(GameObject gameObject){
|
public static void Destroy(GameObject gameObject){
|
||||||
PoolChecker poolChecker = gameObject.GetComponent<PoolChecker>();
|
PoolChecker poolChecker = gameObject.GetComponent<PoolChecker>();
|
||||||
if (poolChecker == null){
|
if (poolChecker == null){
|
||||||
|
@ -74,6 +108,9 @@ public static class Pooler{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Spawn an object into a specific position
|
||||||
|
/// <para>The CreatePools function must have been called before.</para>
|
||||||
|
/// </summary>
|
||||||
public static GameObject SpawnFromPool(string tag, Vector3 position){
|
public static GameObject SpawnFromPool(string tag, Vector3 position){
|
||||||
if (!poolDictionary.ContainsKey(tag)){
|
if (!poolDictionary.ContainsKey(tag)){
|
||||||
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
||||||
|
@ -111,6 +148,9 @@ public static class Pooler{
|
||||||
}
|
}
|
||||||
return objectToSpawn;
|
return objectToSpawn;
|
||||||
}
|
}
|
||||||
|
/// <summary>Spawn an object into a specific position and parent
|
||||||
|
/// <para>The CreatePools function must have been called before.</para>
|
||||||
|
/// </summary>
|
||||||
public static GameObject SpawnFromPool(string tag, Vector3 position, Transform parent){
|
public static GameObject SpawnFromPool(string tag, Vector3 position, Transform parent){
|
||||||
if (!poolDictionary.ContainsKey(tag)){
|
if (!poolDictionary.ContainsKey(tag)){
|
||||||
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
||||||
|
@ -149,6 +189,9 @@ public static class Pooler{
|
||||||
}
|
}
|
||||||
return objectToSpawn;
|
return objectToSpawn;
|
||||||
}
|
}
|
||||||
|
/// <summary>Spawn an object into a specific position, parent and set if it's in world space or not
|
||||||
|
/// <para>The CreatePools function must have been called before.</para>
|
||||||
|
/// </summary>
|
||||||
public static GameObject SpawnFromPool(string tag, Vector3 position, Transform parent, bool instantiateInWorldSpace){
|
public static GameObject SpawnFromPool(string tag, Vector3 position, Transform parent, bool instantiateInWorldSpace){
|
||||||
if (!poolDictionary.ContainsKey(tag)){
|
if (!poolDictionary.ContainsKey(tag)){
|
||||||
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
||||||
|
@ -194,6 +237,9 @@ public static class Pooler{
|
||||||
}
|
}
|
||||||
return objectToSpawn;
|
return objectToSpawn;
|
||||||
}
|
}
|
||||||
|
/// <summary>Spawn an object into a specific position and rotation
|
||||||
|
/// <para>The CreatePools function must have been called before.</para>
|
||||||
|
/// </summary>
|
||||||
public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation){
|
public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation){
|
||||||
if (!poolDictionary.ContainsKey(tag)){
|
if (!poolDictionary.ContainsKey(tag)){
|
||||||
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
||||||
|
@ -231,6 +277,9 @@ public static class Pooler{
|
||||||
}
|
}
|
||||||
return objectToSpawn;
|
return objectToSpawn;
|
||||||
}
|
}
|
||||||
|
/// <summary>Spawn an object into a specific position, rotation and parent
|
||||||
|
/// <para>The CreatePools function must have been called before.</para>
|
||||||
|
/// </summary>
|
||||||
public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation, Transform parent){
|
public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation, Transform parent){
|
||||||
if (!poolDictionary.ContainsKey(tag)){
|
if (!poolDictionary.ContainsKey(tag)){
|
||||||
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
||||||
|
@ -269,6 +318,9 @@ public static class Pooler{
|
||||||
}
|
}
|
||||||
return objectToSpawn;
|
return objectToSpawn;
|
||||||
}
|
}
|
||||||
|
/// <summary>Spawn an object into a specific position, rotation, parent and set if it's in world space or not
|
||||||
|
/// <para>The CreatePools function must have been called before.</para>
|
||||||
|
/// </summary>
|
||||||
public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation, Transform parent, bool instantiateInWorldSpace){
|
public static GameObject SpawnFromPool(string tag, Vector3 position, Quaternion rotation, Transform parent, bool instantiateInWorldSpace){
|
||||||
if (!poolDictionary.ContainsKey(tag)){
|
if (!poolDictionary.ContainsKey(tag)){
|
||||||
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
Debug.Log("Pool with tag " + tag + " doesn't exist.");
|
||||||
|
|
|
@ -10,6 +10,9 @@ public static class Loader{
|
||||||
static Action onLoaderCallback;
|
static Action onLoaderCallback;
|
||||||
static AsyncOperation loadingAsyncOperation;
|
static AsyncOperation loadingAsyncOperation;
|
||||||
|
|
||||||
|
/// <summary>Load a scene with a loading scene
|
||||||
|
/// <para>It requires a scene called "Loading" where the loading screen is located.</para>
|
||||||
|
/// </summary>
|
||||||
public static void Load(int scene){
|
public static void Load(int scene){
|
||||||
onLoaderCallback = () => {
|
onLoaderCallback = () => {
|
||||||
GameObject loadingGameObject = new GameObject("LoadingGameObject");
|
GameObject loadingGameObject = new GameObject("LoadingGameObject");
|
||||||
|
@ -18,6 +21,9 @@ public static class Loader{
|
||||||
|
|
||||||
SceneManager.LoadScene("Loading");
|
SceneManager.LoadScene("Loading");
|
||||||
}
|
}
|
||||||
|
/// <summary>Load a scene with a loading scene
|
||||||
|
/// <para>It requires a scene called "Loading" where the loading screen is located.</para>
|
||||||
|
/// </summary>
|
||||||
public static void Load(string scene){
|
public static void Load(string scene){
|
||||||
onLoaderCallback = () => {
|
onLoaderCallback = () => {
|
||||||
GameObject loadingGameObject = new GameObject("LoadingGameObject");
|
GameObject loadingGameObject = new GameObject("LoadingGameObject");
|
||||||
|
@ -44,6 +50,8 @@ public static class Loader{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Returns the loading progress
|
||||||
|
/// </summary>
|
||||||
public static float GetLoadingProgress(){
|
public static float GetLoadingProgress(){
|
||||||
if(loadingAsyncOperation != null){
|
if(loadingAsyncOperation != null){
|
||||||
return loadingAsyncOperation.progress;
|
return loadingAsyncOperation.progress;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "com.geri.simpletools",
|
"name": "com.geri.simpletools",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"displayName": "Simple Tools",
|
"displayName": "Simple Tools",
|
||||||
"description": "This package contains simple tools to use in your project.",
|
"description": "This package contains simple tools to use in your project.",
|
||||||
"unity": "2018.4",
|
"unity": "2018.4",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue