diff --git a/Assets/Scripts/Audio.meta b/Assets/Scripts/Audio.meta deleted file mode 100644 index 86b4c6a1468e6956bd69a680255008b2a295fd9a..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Audio.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 07fd754c257269c4eb3e588e72f9c53d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Audio/MixLevels.cs b/Assets/Scripts/Audio/MixLevels.cs deleted file mode 100644 index cc51e6356c7a61c73669d4f19000bb44e805c1b7..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Audio/MixLevels.cs +++ /dev/null @@ -1,18 +0,0 @@ -using UnityEngine; -using System.Collections; -using UnityEngine.Audio; - -public class MixLevels : MonoBehaviour { - - public AudioMixer masterMixer; - - public void SetSfxLvl(float sfxLvl) - { - masterMixer.SetFloat("sfxVol", sfxLvl); - } - - public void SetMusicLvl (float musicLvl) - { - masterMixer.SetFloat ("musicVol", musicLvl); - } -} diff --git a/Assets/Scripts/Audio/MixLevels.cs.meta b/Assets/Scripts/Audio/MixLevels.cs.meta deleted file mode 100644 index 2a003bc9ae3c262280c9028a5ee0e07415e5fb8a..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Audio/MixLevels.cs.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 19ed055c6eb86c94ba753f5adfd3bf80 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: diff --git a/Assets/Scripts/Helpers/Kocak.cs b/Assets/Scripts/Helpers/Kocak.cs deleted file mode 100644 index aa308635701a6f8e9a1dff092ec980ea7395e6b9..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Helpers/Kocak.cs +++ /dev/null @@ -1,44 +0,0 @@ -using UnityEngine; -using System.Collections; - - -public class Kocak : MonoBehaviour -{ - [Range(0, 50)] - public int segments = 50; - [Range(0, 5)] - public float radius = 5; - LineRenderer line; - public float lineWidth = 0.1f; // Adjust this value to change line width - - [System.Obsolete] - void Start() - { - line = gameObject.GetComponent<LineRenderer>(); - - line.SetVertexCount(segments + 1); - line.useWorldSpace = false; - line.startWidth = lineWidth; // Set the start width - line.endWidth = lineWidth; // Set the end width - CreatePoints(); - } - - void CreatePoints() - { - float x; - float y = 0.2f; - float z; - - float angle = 20f; - - for (int i = 0; i < (segments + 1); i++) - { - x = Mathf.Sin(Mathf.Deg2Rad * angle) * radius; - z = Mathf.Cos(Mathf.Deg2Rad * angle) * radius; - - line.SetPosition(i, new Vector3(x, y, z)); - - angle += (360f / segments); - } - } -} diff --git a/Assets/Scripts/Helpers/Kocak.cs.meta b/Assets/Scripts/Helpers/Kocak.cs.meta deleted file mode 100644 index 514e08752572801fd3fd63fd48f692425b787b50..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Helpers/Kocak.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e43626427c9d92c4e84fe52a9ffbb200 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/AsyncLoad.cs b/Assets/Scripts/Managers/AsyncLoad.cs deleted file mode 100644 index d25e9363cebd67a934be11ecd03eb035e9f07daa..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Managers/AsyncLoad.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections; -using UnityEngine; -using UnityEngine.SceneManagement; - -public class AsyncLoad : MonoBehaviour -{ - public string levelToLoad; - AsyncOperation loadSync; - - private void Update() - { - if (Input.GetKeyDown(KeyCode.A)) - { - StartCoroutine("ASyncLoad"); - } - } - - private IEnumerator ASyncLoad() - { - loadSync = SceneManager.LoadSceneAsync(levelToLoad); - loadSync.allowSceneActivation = false; - yield return loadSync; - } - - public void ActivateScene() - { - loadSync.allowSceneActivation = true; - } -} \ No newline at end of file diff --git a/Assets/Scripts/Managers/AsyncLoad.cs.meta b/Assets/Scripts/Managers/AsyncLoad.cs.meta deleted file mode 100644 index a957c2459d95447bcc68460ffb5d91e5e2d23d4d..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Managers/AsyncLoad.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 808e6bd2f94265743af762dca16a7895 -timeCreated: 1519408502 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/CinematicController.cs b/Assets/Scripts/Managers/CinematicController.cs deleted file mode 100644 index 21f653abeb7ef2661b4bbc99b0f35fd167ebc436..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Managers/CinematicController.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Playables; -using UnityEngine.Video; - -namespace Nightmare -{ - public class CinematicController : MonoBehaviour - { - public enum CinematicType - { - Realtime, - PreRendered - } - - private PlayableDirector cinematicTimeline; - private Camera cineCam; - private Camera mainCam; - private VideoPlayer videoPlayer; - private int currentCinematic; - - // Use this for initialization - void Start() - { - cinematicTimeline = this.GetComponent<PlayableDirector>(); - cineCam = this.GetComponentInChildren<Camera>(); - videoPlayer = this.GetComponentInChildren<VideoPlayer>(); - - mainCam = Camera.main; - videoPlayer.targetCamera = mainCam; - videoPlayer.loopPointReached += VideoEnded; - - RealtimeCameraMode(false); - } - - // Update is called once per frame - void Update() - { - if (currentCinematic >= 0) - { - if (Input.GetKeyDown(KeyCode.Space)) - { - SkipCinematic(); - } - - if (currentCinematic == 0 && cinematicTimeline.state != PlayState.Playing) - { - RestorePlay(); - } - } - } - - public void StartCinematic(CinematicType type) - { - if (type < 0) - return; - - currentCinematic = (int)type; - - if (type == CinematicType.Realtime) - { - EventManager.TriggerEvent("Pause", true); - RealtimeCameraMode(true); - cinematicTimeline.Play(); - } - else - { - if (videoPlayer.source == VideoSource.VideoClip && videoPlayer.clip == null) - Debug.LogWarning("Pre-rendered video clip not set!"); - else - { - EventManager.TriggerEvent("Pause", true); - videoPlayer.Play(); - } - } - } - - void SkipCinematic() - { - if (currentCinematic == 0) - { - cinematicTimeline.Stop(); - } - else - { - videoPlayer.Stop(); - } - - RestorePlay(); - } - - void RestorePlay() - { - currentCinematic = -1; - RealtimeCameraMode(false); - EventManager.TriggerEvent("Pause", false); - } - - private void RealtimeCameraMode(bool isCinematic) - { - cineCam.enabled = isCinematic; - mainCam.enabled = !isCinematic; - } - - private void VideoEnded(VideoPlayer player) - { - player.Stop(); - RestorePlay(); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Managers/CinematicController.cs.meta b/Assets/Scripts/Managers/CinematicController.cs.meta deleted file mode 100644 index c9dc0ba3026302cfcb9045f14c66a9342335419f..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Managers/CinematicController.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 2855f85fe6f5e82469cf6b859402a4a8 -timeCreated: 1519405116 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Managers/PoolManager.cs b/Assets/Scripts/Managers/PoolManager.cs deleted file mode 100644 index 00b175ec74bb22d1c184ce5d3f0c56482ff381ec..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Managers/PoolManager.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class PoolManager : MonoBehaviour -{ - public Pool[] pools; - - private static Dictionary<string, Pool> cache; - private static PoolManager poolManager; - - public static PoolManager instance - { - get - { - if (!poolManager) - { - poolManager = FindObjectOfType(typeof(PoolManager)) as PoolManager; - - if (!poolManager) - { - Debug.LogError("There needs to be one active PoolManger script on a GameObject in your scene."); - } - else - { - poolManager.Init(); - } - } - - return poolManager; - } - } - - void Init() - { - if (cache == null) - { - cache = new Dictionary<string, Pool>(); - } - } - - void Start () - { - if (pools != null) - { - cache = new Dictionary<string, Pool>(pools.Length); - - for (int i = 0; i < pools.Length; i++) - { - Pool tempPool = pools[i]; - cache[tempPool.key] = new Pool(tempPool.key, tempPool.poolObject, tempPool.size, tempPool.parentingGroup, tempPool.expandable); - } - } - } - - /// <summary> - /// Grabs the next item from the pool. - /// </summary> - /// <param name="key">Name of the pool to draw from.</param> - /// <returns>Next free item. Null if none available.</returns> - public static GameObject Pull(string key) - { - return (cache[key].Pull()); - } - - public static GameObject Pull(string key, Vector3 position, Quaternion rotation) - { - GameObject clone = cache[key].Pull(); - clone.transform.position = position; - clone.transform.rotation = rotation; - return clone; - } -} - -[System.Serializable] -public class Pool -{ - public string key; - public GameObject poolObject; - public int size; - public Transform parentingGroup; - public bool expandable; - - private List<GameObject> pool; - - public Pool(string keyName, GameObject obj, int count, Transform parent = null, bool dynamicExpansion = false) - { - key = keyName; - poolObject = obj; - size = count; - expandable = dynamicExpansion; - parentingGroup = parent; - pool = new List<GameObject>(); - - for (int i = 0; i < count; i++) - { - AddItem(); - } - } - - public GameObject Pull() - { - // Is there one ready? - for (int i = 0; i < pool.Count; i++) - { - if (!pool[i].activeInHierarchy) - { - pool[i].SetActive(true); - return pool[i]; - } - } - - // Can one be added? - if (expandable) - { - return AddItem(true); - } - else - { - Debug.LogWarning("No available item from pool with key: " + key); - return null; - } - } - - private GameObject AddItem(bool keepActive = false) - { - int index = pool.Count; - pool.Add(UnityEngine.Object.Instantiate(poolObject)); - pool[index].name = poolObject.name + "_" + index.ToString().PadLeft(4, '0'); - pool[index].SetActive(keepActive); - if (parentingGroup != null) - { - pool[index].transform.parent = parentingGroup; - } - return pool[index]; - } -} \ No newline at end of file diff --git a/Assets/Scripts/Managers/PoolManager.cs.meta b/Assets/Scripts/Managers/PoolManager.cs.meta deleted file mode 100644 index 65c334d52f053243aba6d7b153b83f181eb2af23..0000000000000000000000000000000000000000 --- a/Assets/Scripts/Managers/PoolManager.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 1e8b0ee512cbdf947aa46e044aaada96 -timeCreated: 1519405221 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Player/PlayerCoin.cs b/Assets/Scripts/Player/PlayerCoin.cs index 5ab888285a3bfa128e24b4cdcbf0eeb4913f3b4c..8c0dc29d177729563d27a2670af00e2e37e95432 100644 --- a/Assets/Scripts/Player/PlayerCoin.cs +++ b/Assets/Scripts/Player/PlayerCoin.cs @@ -1,29 +1,18 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -public class PlayerCoin : MonoBehaviour, IDataPersistence -{ - public float coin = 0; - - public void AddCoins(float coins) - { - coin += coins; - } - - public void SpendCoins(float coins) +namespace Nightmare { + public class PlayerCoin : MonoBehaviour, IDataPersistence { - coin -= coins; - if (coin < 0) coin = 0; - } + public float coin = 0; - public void LoadData(GameData data) - { - this.coin = data.coin; - } + public void LoadData(GameData data) + { + this.coin = data.coin; + } - public void SaveData(ref GameData data) - { - data.coin = this.coin; + public void SaveData(ref GameData data) + { + data.coin = this.coin; + } } } diff --git a/Assets/Scripts/ShopKeeper/ShopManager.cs b/Assets/Scripts/ShopKeeper/ShopManager.cs index f745d9118b01b61411626babeb0c6202005d90c9..d9c1bc9fde0daebcab4f263f11336a38037db71d 100644 --- a/Assets/Scripts/ShopKeeper/ShopManager.cs +++ b/Assets/Scripts/ShopKeeper/ShopManager.cs @@ -5,7 +5,7 @@ using UnityEngine.UI; using TMPro; using Nightmare; -public class ShopManager : MonoBehaviour, IDataPersistence +public class ShopManager : MonoBehaviour { public PlayerCoin coins; public TMP_Text coinUI; @@ -29,14 +29,10 @@ public class ShopManager : MonoBehaviour, IDataPersistence CheckPurchaseable(); } - public void LoadData(GameData gameData) + private void Update() { - this.coins.coin = gameData.coin; - } - - public void SaveData(ref GameData gameData) - { - gameData.coin = this.coins.coin; + UpdateCoinsUI(); + CheckPurchaseable(); } public void CheckPurchaseable()