├── .gitattributes ├── .gitignore ├── Assets ├── PoolManager.meta ├── PoolManager │ ├── Scripts.meta │ └── Scripts │ │ ├── Factories.meta │ │ ├── Factories │ │ ├── FixedFactory.cs │ │ ├── FixedFactory.cs.meta │ │ ├── IFactory.cs │ │ ├── IFactory.cs.meta │ │ ├── ProportionFactory.cs │ │ └── ProportionFactory.cs.meta │ │ ├── GarbageCollectors.meta │ │ ├── GarbageCollectors │ │ ├── FixedGarbageCollector.cs │ │ ├── FixedGarbageCollector.cs.meta │ │ ├── IGarbageCollector.cs │ │ ├── IGarbageCollector.cs.meta │ │ ├── ProportionGarbageCollector.cs │ │ └── ProportionGarbageCollector.cs.meta │ │ ├── ObjectPool.meta │ │ ├── ObjectPool │ │ ├── IObjectPool.cs │ │ ├── IObjectPool.cs.meta │ │ ├── ObjectPool.cs │ │ └── ObjectPool.cs.meta │ │ ├── PoolElement.meta │ │ ├── PoolElement │ │ ├── IPoolElement.cs │ │ ├── IPoolElement.cs.meta │ │ ├── PoolElement.cs │ │ └── PoolElement.cs.meta │ │ ├── PoolManager.cs │ │ └── PoolManager.cs.meta ├── Procedural2DTileWorld.meta ├── Procedural2DTileWorld │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── Chunk.prefab │ │ ├── Chunk.prefab.meta │ │ ├── Environment.meta │ │ ├── Environment │ │ │ ├── Dead Bush.prefab │ │ │ ├── Dead Bush.prefab.meta │ │ │ ├── Flower.prefab │ │ │ ├── Flower.prefab.meta │ │ │ ├── Mushroom.prefab │ │ │ ├── Mushroom.prefab.meta │ │ │ ├── Tall Grass.prefab │ │ │ ├── Tall Grass.prefab.meta │ │ │ ├── Tree.prefab │ │ │ ├── Tree.prefab.meta │ │ │ ├── Water Lily.prefab │ │ │ └── Water Lily.prefab.meta │ │ ├── Terrain.meta │ │ └── Terrain │ │ │ ├── Cobblestone.prefab │ │ │ ├── Cobblestone.prefab.meta │ │ │ ├── Dirt.prefab │ │ │ ├── Dirt.prefab.meta │ │ │ ├── Grass.prefab │ │ │ ├── Grass.prefab.meta │ │ │ ├── Gravel.prefab │ │ │ ├── Gravel.prefab.meta │ │ │ ├── Podzol.prefab │ │ │ ├── Podzol.prefab.meta │ │ │ ├── Sand.prefab │ │ │ ├── Sand.prefab.meta │ │ │ ├── Sandstone.prefab │ │ │ ├── Sandstone.prefab.meta │ │ │ ├── Water.prefab │ │ │ └── Water.prefab.meta │ ├── Scenes.meta │ ├── Scenes │ │ ├── Main.unity │ │ └── Main.unity.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── Chunk.cs │ │ ├── Chunk.cs.meta │ │ ├── PlayerController.cs │ │ ├── PlayerController.cs.meta │ │ ├── World.cs │ │ └── World.cs.meta │ ├── Sprites.meta │ └── Sprites │ │ ├── Environment.meta │ │ ├── Environment │ │ ├── Dead Bush.png │ │ ├── Dead Bush.png.meta │ │ ├── Flower.png │ │ ├── Flower.png.meta │ │ ├── Mushroom.png │ │ ├── Mushroom.png.meta │ │ ├── Tall Grass.png │ │ ├── Tall Grass.png.meta │ │ ├── Tree.png │ │ ├── Tree.png.meta │ │ ├── Water Lily.png │ │ └── Water Lily.png.meta │ │ ├── SOURCE │ │ ├── SOURCE.meta │ │ ├── Terrain.meta │ │ └── Terrain │ │ ├── Cobblestone.png │ │ ├── Cobblestone.png.meta │ │ ├── Dirt.png │ │ ├── Dirt.png.meta │ │ ├── Grass.png │ │ ├── Grass.png.meta │ │ ├── Gravel.png │ │ ├── Gravel.png.meta │ │ ├── Podzol.png │ │ ├── Podzol.png.meta │ │ ├── Sand.png │ │ ├── Sand.png.meta │ │ ├── Sandstone.png │ │ ├── Sandstone.png.meta │ │ ├── Water.png │ │ └── Water.png.meta ├── UnityVS.meta └── UnityVS │ ├── Editor.meta │ └── Editor │ ├── SyntaxTree.VisualStudio.Unity.Bridge.dll │ ├── SyntaxTree.VisualStudio.Unity.Bridge.dll.meta │ ├── SyntaxTree.VisualStudio.Unity.Messaging.dll │ └── SyntaxTree.VisualStudio.Unity.Messaging.dll.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityAdsSettings.asset └── UnityConnectSettings.asset └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | 21 | 22 | # Unity3D generated meta files 23 | *.pidb.meta 24 | 25 | # Unity3D Generated File On Crash Reports 26 | sysinfo.txt 27 | 28 | # Builds 29 | *.apk 30 | *.unitypackage 31 | 32 | # ========================= 33 | # Operating System Files 34 | # ========================= 35 | 36 | # OSX 37 | # ========================= 38 | 39 | .DS_Store 40 | .AppleDouble 41 | .LSOverride 42 | 43 | # Thumbnails 44 | ._* 45 | 46 | # Files that might appear in the root of a volume 47 | .DocumentRevisions-V100 48 | .fseventsd 49 | .Spotlight-V100 50 | .TemporaryItems 51 | .Trashes 52 | .VolumeIcon.icns 53 | 54 | # Directories potentially created on remote AFP share 55 | .AppleDB 56 | .AppleDesktop 57 | Network Trash Folder 58 | Temporary Items 59 | .apdisk 60 | 61 | # Windows 62 | # ========================= 63 | 64 | # Windows image file caches 65 | Thumbs.db 66 | ehthumbs.db 67 | 68 | # Folder config file 69 | Desktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msm 78 | *.msp 79 | 80 | # Windows shortcuts 81 | *.lnk 82 | -------------------------------------------------------------------------------- /Assets/PoolManager.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c39d3d04ffe69e6438f9d90de5000072 3 | folderAsset: yes 4 | timeCreated: 1468181052 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3258f692a6690c3428a6e007f20c0e02 3 | folderAsset: yes 4 | timeCreated: 1468181059 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/Factories.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b39f199b1d44754bad7ebe0cfe47423 3 | folderAsset: yes 4 | timeCreated: 1468372987 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/Factories/FixedFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | 5 | namespace PoolingSystem.Factories 6 | { 7 | [Serializable] 8 | public class FixedFactory : IFactory 9 | { 10 | private FactoryParameters _factoryParameters; 11 | 12 | public void Setup(FactoryParameters factoryParameters) 13 | { 14 | _factoryParameters = factoryParameters; 15 | } 16 | 17 | public void Run() 18 | { 19 | var count = 0u; 20 | foreach (var objectPool in PoolManager.Instance) 21 | { 22 | while (NextRatio(objectPool) > objectPool.Ratio) 23 | { 24 | if (objectPool.Instantiate()) 25 | { 26 | if (++count == _factoryParameters.FixedAmmount) 27 | return; 28 | } 29 | else 30 | break; 31 | } 32 | } 33 | } 34 | 35 | private static float NextRatio(IObjectPool objectPool) 36 | { 37 | return (float) objectPool.ActiveCount/(objectPool.Count + 1); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/Factories/FixedFactory.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05b820f4bbe803e46ba2407214954253 3 | timeCreated: 1468372957 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/Factories/IFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | 5 | namespace PoolingSystem.Factories 6 | { 7 | public interface IFactory : ITaskRunner 8 | { 9 | new void Setup(FactoryParameters factoryParameters); 10 | new void Run(); 11 | } 12 | 13 | [Serializable] 14 | public struct FactoryParameters 15 | { 16 | [SerializeField] [Range(1, 999)] [Tooltip("How many instances to create per round.\nOnly for FixedFactory.")] public uint 17 | FixedAmmount; 18 | 19 | [SerializeField] [Range(0.1f, 1.0f)] [Tooltip("Proportion of instances to create per round.\nOnly for ProportionFactory.")] public 20 | float Proportion; 21 | } 22 | 23 | public enum FactoryProviders 24 | { 25 | FixedFactory, 26 | ProportionFactory 27 | } 28 | 29 | public static class Providers 30 | { 31 | private static readonly FixedFactory FixedFactory = new FixedFactory(); 32 | private static readonly ProportionFactory ProportionFactory = new ProportionFactory(); 33 | 34 | public static IFactory GetInstance(this FactoryProviders factoryProvider) 35 | { 36 | switch (factoryProvider) 37 | { 38 | case FactoryProviders.FixedFactory: 39 | return FixedFactory; 40 | case FactoryProviders.ProportionFactory: 41 | return ProportionFactory; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/Factories/IFactory.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8d5685d3e6ab914394ce566ea7d0beb 3 | timeCreated: 1468374283 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/Factories/ProportionFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | 5 | namespace PoolingSystem.Factories 6 | { 7 | [Serializable] 8 | public class ProportionFactory : IFactory 9 | { 10 | private FactoryParameters _factoryParameters; 11 | 12 | public void Setup(FactoryParameters factoryParameters) 13 | { 14 | _factoryParameters = factoryParameters; 15 | } 16 | 17 | public void Run() 18 | { 19 | foreach (var objectPool in PoolManager.Instance) 20 | { 21 | var ammount = CalcAmmount(objectPool)*_factoryParameters.Proportion; 22 | for (var i = 0; i < ammount; i++) 23 | { 24 | if (!objectPool.Instantiate()) 25 | break; 26 | } 27 | } 28 | } 29 | 30 | private static int CalcAmmount(IObjectPool objectPool) 31 | { 32 | return Mathf.FloorToInt(objectPool.ActiveCount/objectPool.Ratio) - objectPool.Count; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/Factories/ProportionFactory.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3effca7cca8b75846b7488a9d8faeca2 3 | timeCreated: 1468387521 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/GarbageCollectors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94837d43a8632ba4faf9f97f39c3e10f 3 | folderAsset: yes 4 | timeCreated: 1468372995 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/GarbageCollectors/FixedGarbageCollector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | 5 | namespace PoolingSystem.GarbageCollectors 6 | { 7 | [Serializable] 8 | public class FixedGarbageCollector : IGarbageCollector 9 | { 10 | private GarbageCollectorParameters _garbageCollectorParameters; 11 | 12 | public void Setup(GarbageCollectorParameters garbageCollectorParameters) 13 | { 14 | _garbageCollectorParameters = garbageCollectorParameters; 15 | } 16 | 17 | public void Run() 18 | { 19 | var count = 0u; 20 | foreach (var objectPool in PoolManager.Instance) 21 | { 22 | while (PreviousRatio(objectPool) < objectPool.Ratio) 23 | { 24 | if (objectPool.Destroy()) 25 | { 26 | if (++count == _garbageCollectorParameters.FixedAmmount) 27 | return; 28 | } 29 | else 30 | break; 31 | } 32 | } 33 | } 34 | 35 | private static float PreviousRatio(IObjectPool objectPool) 36 | { 37 | return (float) objectPool.ActiveCount/ (objectPool.Count - 1); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/GarbageCollectors/FixedGarbageCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73092dd6b20cd4f41aeef79c706af860 3 | timeCreated: 1468372973 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/GarbageCollectors/IGarbageCollector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | 5 | namespace PoolingSystem.GarbageCollectors 6 | { 7 | public interface IGarbageCollector : ITaskRunner 8 | { 9 | new void Setup(GarbageCollectorParameters garbageCollectorParameters); 10 | new void Run(); 11 | } 12 | 13 | [Serializable] 14 | public struct GarbageCollectorParameters 15 | { 16 | [SerializeField] [Range(1, 999)] [Tooltip("How many instances to destroy per round.\nOnly for FixedFactory.")] public uint 17 | FixedAmmount; 18 | 19 | [SerializeField] [Range(0.1f, 1.0f)] [Tooltip("Proportion of instances to destroy per round.\nOnly for ProportionFactory.")] public 20 | float Proportion; 21 | } 22 | 23 | public enum GarbageCollectorProviders 24 | { 25 | FixedGarbageCollector, 26 | ProportionGarbageCollector 27 | } 28 | 29 | public static class Providers 30 | { 31 | private static readonly FixedGarbageCollector FixedGarbageCollector = new FixedGarbageCollector(); 32 | private static readonly ProportionGarbageCollector ProportionGarbageCollector = new ProportionGarbageCollector(); 33 | 34 | public static IGarbageCollector GetInstance(this GarbageCollectorProviders factoryProvider) 35 | { 36 | switch (factoryProvider) 37 | { 38 | case GarbageCollectorProviders.FixedGarbageCollector: 39 | return FixedGarbageCollector; 40 | case GarbageCollectorProviders.ProportionGarbageCollector: 41 | return ProportionGarbageCollector; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/GarbageCollectors/IGarbageCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ac1ce4ced2c946419b0d67dd89210df 3 | timeCreated: 1468374293 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/GarbageCollectors/ProportionGarbageCollector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | 5 | namespace PoolingSystem.GarbageCollectors 6 | { 7 | [Serializable] 8 | public class ProportionGarbageCollector : IGarbageCollector 9 | { 10 | private GarbageCollectorParameters _garbageCollectorParameters; 11 | 12 | public void Setup(GarbageCollectorParameters garbageCollectorParameters) 13 | { 14 | _garbageCollectorParameters = garbageCollectorParameters; 15 | } 16 | 17 | public void Run() 18 | { 19 | foreach (var objectPool in PoolManager.Instance) 20 | { 21 | var ammount = CalcAmmount(objectPool)*_garbageCollectorParameters.Proportion; 22 | for (var i = 0; i < ammount; i++) 23 | { 24 | if (!objectPool.Instantiate()) 25 | break; 26 | } 27 | } 28 | } 29 | 30 | private static int CalcAmmount(IObjectPool objectPool) 31 | { 32 | return objectPool.Count - Mathf.FloorToInt(objectPool.ActiveCount/objectPool.Ratio); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/GarbageCollectors/ProportionGarbageCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 071a5a58bd31afe46b28f437947ecc0e 3 | timeCreated: 1468387540 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/ObjectPool.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e28b2f93d37e5ab47b38c542be27a292 3 | folderAsset: yes 4 | timeCreated: 1468539838 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/ObjectPool/IObjectPool.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace PoolingSystem 5 | { 6 | public interface IObjectPool 7 | { 8 | /// 9 | /// The prefab that defines the pool. 10 | /// 11 | GameObject Prefab { get; } 12 | 13 | /// 14 | /// The minimum number of instances to keep. 15 | /// 16 | uint Min { get; set; } 17 | 18 | /// 19 | /// The maximum number of instances to keep. 20 | /// 21 | uint Max { get; set; } 22 | 23 | /// 24 | /// The target usage ratio. 25 | /// 26 | float Ratio { get; set; } 27 | 28 | /// 29 | /// The ammount of elements currently allocated. 30 | /// 31 | int Count { get; } 32 | 33 | /// 34 | /// The ammount of elements currently active. 35 | /// 36 | int ActiveCount { get; } 37 | 38 | /// 39 | /// The ammount of elements currently inactive. 40 | /// 41 | int InactiveCount { get; } 42 | 43 | /// 44 | /// The current usage ratio. 45 | /// 46 | float CurrentRatio { get; } 47 | 48 | /// 49 | /// Retrieves or instantiates a new one if the pool is empty and the limit is not exceeded. 50 | /// Internally called by the other Spawn() methods. 51 | /// 52 | /// A prefab instance ready to use. 53 | GameObject Spawn(); 54 | 55 | /// 56 | /// Retrieves or instantiates a new one if the pool is empty and the limit is not exceeded. 57 | /// 58 | /// The transform with position and rotation to set. 59 | /// A prefab instance ready to use 60 | GameObject Spawn(Transform transform); 61 | 62 | /// 63 | /// Retrieves or instantiates a new one if the pool is empty and the limit is not exceeded. 64 | /// 65 | /// The transform with position and rotation to set. 66 | /// The parent transform in the scene to set. 67 | /// A prefab instance ready to use 68 | GameObject Spawn(Transform transform, Transform parent); 69 | 70 | /// 71 | /// Retrieves or instantiates a new one if the pool is empty and the limit is not exceeded. 72 | /// 73 | /// The position to set. 74 | /// The rotation to set. 75 | /// A prefab instance ready to use 76 | GameObject Spawn(Vector3 position, Quaternion rotation); 77 | 78 | /// 79 | /// Retrieves or instantiates a new one if the pool is empty and the limit is not exceeded. 80 | /// 81 | /// The position to set. 82 | /// The rotation to set. 83 | /// The parent transform in the scene to set. 84 | /// A prefab instance ready to use 85 | GameObject Spawn(Vector3 position, Quaternion rotation, Transform parent); 86 | 87 | /// 88 | /// Forcedly despawn an active instance. 89 | /// 90 | void Despawn(); 91 | 92 | /// 93 | /// Despawn the selected instance. 94 | /// 95 | /// The instance to despawn 96 | void Despawn(GameObject instance); 97 | 98 | /// 99 | /// Forcedly create a new instance. 100 | /// 101 | bool Instantiate(); 102 | 103 | /// 104 | /// Forcedly destroy an inactive instance. 105 | /// 106 | bool Destroy(); 107 | } 108 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/ObjectPool/IObjectPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ac03943d04a8d34fae6545d66009534 3 | timeCreated: 1468534596 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/ObjectPool/ObjectPool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | 6 | namespace PoolingSystem 7 | { 8 | public class ObjectPool : MonoBehaviour, IObjectPool 9 | { 10 | [SerializeField] [Tooltip("The base prefab of this pool.")] private GameObject _prefab; 11 | [SerializeField] [Tooltip("The minimum number of instances to keep.")] private uint _min; 12 | [SerializeField] [Tooltip("The maximum number of instances to keep.")] private uint _max; 13 | [SerializeField] [Range(0.1f, 1.0f)] [Tooltip("The target usage ratio.")] private float _usageRatio; 14 | private readonly HashSet _active = new HashSet(); 15 | private readonly Stack _inactive = new Stack(); 16 | 17 | public GameObject Prefab 18 | { 19 | get { return _prefab; } 20 | } 21 | 22 | public uint Min 23 | { 24 | get { return _min; } 25 | set { _min = value; } 26 | } 27 | 28 | public uint Max 29 | { 30 | get { return _max; } 31 | set { _max = value; } 32 | } 33 | 34 | public float Ratio 35 | { 36 | get { return _usageRatio; } 37 | set { _usageRatio = value; } 38 | } 39 | 40 | public int Count 41 | { 42 | get { return _active.Count + _inactive.Count; } 43 | } 44 | 45 | public int ActiveCount 46 | { 47 | get { return _active.Count; } 48 | } 49 | 50 | public int InactiveCount 51 | { 52 | get { return _inactive.Count; } 53 | } 54 | 55 | public float CurrentRatio 56 | { 57 | get { return (float) ActiveCount/Count; } 58 | } 59 | 60 | public bool IsPredefined { get; private set; } 61 | 62 | /// 63 | /// Create a new pool from a PredefinedObjectPool. 64 | /// 65 | /// The parameters to set. 66 | /// A new GameObject with an ObjectPool component. 67 | public static ObjectPool FromPredefined(PredefinedObjectPool predefinedPool) 68 | { 69 | var objectPool = new GameObject(predefinedPool.Prefab.name + " Pool").AddComponent(); 70 | objectPool.IsPredefined = true; 71 | objectPool._prefab = predefinedPool.Prefab; 72 | objectPool._min = predefinedPool.Min; 73 | objectPool._max = predefinedPool.Max; 74 | objectPool._usageRatio = predefinedPool.UsageRatio; 75 | objectPool._active.Clear(); 76 | objectPool._inactive.Clear(); 77 | objectPool.Validate(); 78 | return objectPool; 79 | } 80 | 81 | /// 82 | /// Create a new pool from a PredefinedObjectPool. 83 | /// 84 | /// The prefab parameter to set. 85 | /// A new GameObject with an ObjectPool component. 86 | public static ObjectPool FromPrefab(GameObject prefab) 87 | { 88 | var objectPool = new GameObject(prefab.name + " Pool").AddComponent(); 89 | objectPool.IsPredefined = false; 90 | objectPool._prefab = prefab; 91 | objectPool._min = 0; 92 | objectPool._max = 0; 93 | objectPool._usageRatio = 1.0f; 94 | objectPool._active.Clear(); 95 | objectPool._inactive.Clear(); 96 | objectPool.Validate(); 97 | return objectPool; 98 | } 99 | 100 | public GameObject Spawn() 101 | { 102 | GameObject instance; 103 | if (_inactive.Count > 0) 104 | instance = _inactive.Pop(); 105 | else if (_max == 0 || Count < _max) 106 | { 107 | instance = Instantiate(_prefab); 108 | instance.AddComponent().Pool = this; 109 | } 110 | else 111 | return null; 112 | _active.Add(instance); 113 | instance.transform.parent = null; 114 | instance.SendMessage("OnSpawn", null, SendMessageOptions.DontRequireReceiver); 115 | instance.SetActive(true); 116 | return instance; 117 | } 118 | 119 | public GameObject Spawn(Transform transform) 120 | { 121 | return Spawn(transform, null); 122 | } 123 | 124 | public GameObject Spawn(Transform transform, Transform parent) 125 | { 126 | return Spawn(transform.position, transform.rotation, parent); 127 | } 128 | 129 | public GameObject Spawn(Vector3 position, Quaternion rotation) 130 | { 131 | return Spawn(position, rotation, null); 132 | } 133 | 134 | public GameObject Spawn(Vector3 position, Quaternion rotation, Transform parent) 135 | { 136 | var instance = Spawn(); 137 | if (!instance) 138 | return instance; 139 | instance.transform.position = position; 140 | instance.transform.rotation = rotation; 141 | instance.transform.parent = parent; 142 | return instance; 143 | } 144 | 145 | public void Despawn() 146 | { 147 | foreach (var instance in _active) 148 | { 149 | Despawn(instance); 150 | break; 151 | } 152 | } 153 | 154 | public void Despawn(GameObject instance) 155 | { 156 | if (!_active.Contains(instance)) 157 | return; 158 | 159 | _active.Remove(instance); 160 | _inactive.Push(instance); 161 | instance.SetActive(false); 162 | instance.SendMessage("OnDespawn", null, SendMessageOptions.DontRequireReceiver); 163 | instance.transform.parent = transform; 164 | } 165 | 166 | public bool Instantiate() 167 | { 168 | if (_max == 0 || Count < _max) 169 | { 170 | var instance = Instantiate(_prefab); 171 | instance.AddComponent().Pool = this; 172 | instance.SetActive(false); 173 | instance.transform.parent = transform; 174 | _inactive.Push(instance); 175 | return true; 176 | } 177 | return false; 178 | } 179 | 180 | public bool Destroy() 181 | { 182 | if (_inactive.Count > 0 && _inactive.Count > _min) 183 | { 184 | Destroy(_inactive.Pop()); 185 | return true; 186 | } 187 | return false; 188 | } 189 | 190 | private bool Validate() 191 | { 192 | if (_max > 0 && _max < _min) 193 | { 194 | Debug.LogError(this + ": Invalid values (Max < Min)."); 195 | return false; 196 | } 197 | return true; 198 | } 199 | 200 | // Awake is called when the script instance is being loaded 201 | public void Awake() 202 | { 203 | Validate(); 204 | } 205 | } 206 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/ObjectPool/ObjectPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4833b82ed0854b74e8035f636406a12d 3 | timeCreated: 1468193521 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/PoolElement.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 951fea55c1dffed4e90386ca480128d9 3 | folderAsset: yes 4 | timeCreated: 1469485308 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/PoolElement/IPoolElement.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | 5 | namespace PoolingSystem 6 | { 7 | public interface IPoolElement 8 | { 9 | /// 10 | /// OnSpawn is called when the PoolElement is being spawned. 11 | /// 12 | void OnSpawn(); 13 | 14 | /// 15 | /// OnSpawn is called when the PoolElement is being despawned. 16 | /// 17 | void OnDespawn(); 18 | } 19 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/PoolElement/IPoolElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81fc3e730990d674382ae7a33a496ebf 3 | timeCreated: 1469485348 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/PoolElement/PoolElement.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace PoolingSystem 5 | { 6 | public class PoolElement : MonoBehaviour 7 | { 8 | /// 9 | /// The pool which this PoolElement belongs. 10 | /// 11 | public IObjectPool Pool; 12 | 13 | /// 14 | /// The base prefab of this PoolElement. 15 | /// 16 | public GameObject Prefab 17 | { 18 | get { return Pool.Prefab; } 19 | } 20 | 21 | /// 22 | /// Despawn this PoolElement. 23 | /// 24 | public void Despawn() 25 | { 26 | Pool.Despawn(gameObject); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/PoolElement/PoolElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f186dcf90aacb3449835c335f776a93d 3 | timeCreated: 1469485326 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/PoolManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using PoolingSystem.Factories; 6 | using PoolingSystem.GarbageCollectors; 7 | 8 | namespace PoolingSystem 9 | { 10 | public class PoolManager : MonoBehaviour, IEnumerable 11 | { 12 | private static PoolManager _instance; 13 | 14 | /// 15 | /// The singleton instance of pool manager in this scene. 16 | /// 17 | public static PoolManager Instance 18 | { 19 | get 20 | { 21 | if (!_instance) 22 | { 23 | _instance = FindObjectOfType(); 24 | _instance.Setup(); 25 | } 26 | if (!_instance) 27 | { 28 | _instance = new GameObject().AddComponent(); 29 | _instance.Setup(); 30 | } 31 | return _instance; 32 | } 33 | } 34 | 35 | /// 36 | /// The singleton instance of pool manager in this scene. 37 | /// 38 | public static PoolManager Pools 39 | { 40 | get { return Instance; } 41 | } 42 | 43 | [SerializeField] [Tooltip("Predefined pools.")] private PredefinedObjectPool[] _predefinedPools; 44 | private bool _initialized; 45 | private readonly Dictionary _pools = new Dictionary(); 46 | [SerializeField] private PoolingSetting poolingSetting; 47 | private IEnumerator _worker; 48 | 49 | /// 50 | /// Access to an specified pool. 51 | /// 52 | /// The prefab that defines the pool. 53 | /// The pool asociated with the prefab. 54 | public IObjectPool this[GameObject prefab] 55 | { 56 | get { return _pools[prefab]; } 57 | set { _pools[prefab] = value; } 58 | } 59 | 60 | /// 61 | /// Load all the pools defined in the inspector. 62 | /// 63 | private void LoadPredefined() 64 | { 65 | foreach (var poolManager in FindObjectsOfType()) 66 | { 67 | if (poolManager._predefinedPools == null) 68 | continue; 69 | foreach (var predefinedPool in poolManager._predefinedPools) 70 | { 71 | var pool = ObjectPool.FromPredefined(predefinedPool); 72 | pool.transform.parent = transform; 73 | this[pool.Prefab] = pool; 74 | } 75 | poolManager._predefinedPools = null; 76 | } 77 | } 78 | 79 | /// 80 | /// Initialize, set name and tag. 81 | /// 82 | private void Setup() 83 | { 84 | if (_initialized) 85 | return; 86 | name = "Pool Manager"; 87 | tag = "Pool Manager"; 88 | LoadPredefined(); 89 | _initialized = true; 90 | } 91 | 92 | /// 93 | /// Runs the selected Factory and GarbageCollector. 94 | /// 95 | /// 96 | private IEnumerator Worker() 97 | { 98 | poolingSetting.Factory.GetInstance().Setup(poolingSetting.FactoryParameters); 99 | poolingSetting.GarbageCollector.GetInstance().Setup(poolingSetting.GarbageCollectorParameters); 100 | while (true) 101 | { 102 | poolingSetting.Factory.GetInstance().Run(); 103 | poolingSetting.GarbageCollector.GetInstance().Run(); 104 | yield return null; 105 | } 106 | } 107 | 108 | public IEnumerator GetEnumerator() 109 | { 110 | return _pools.Values.GetEnumerator(); 111 | } 112 | 113 | IEnumerator IEnumerable.GetEnumerator() 114 | { 115 | return GetEnumerator(); 116 | } 117 | 118 | // Awake is called when the script instance is being loaded 119 | public void Awake() 120 | { 121 | if (_instance) 122 | return; 123 | 124 | _instance = this; 125 | Setup(); 126 | } 127 | 128 | // Start is called just before any of the Update methods is called the first time 129 | public void Start() 130 | { 131 | if (this != _instance) 132 | Destroy(this); 133 | 134 | _worker = Worker(); 135 | StartCoroutine(_worker); 136 | } 137 | 138 | // This function is called when the MonoBehaviour will be destroyed 139 | public void OnDestroy() 140 | { 141 | if (_instance != this) 142 | return; 143 | 144 | _instance = null; 145 | StopCoroutine(_worker); 146 | } 147 | } 148 | 149 | [Serializable] 150 | public struct PoolingSetting 151 | { 152 | [SerializeField] [Tooltip("Wich Factory to use.")] public FactoryProviders Factory; 153 | [SerializeField] [Tooltip("Wich Garbage Collector to use.")] public GarbageCollectorProviders GarbageCollector; 154 | [SerializeField] [Tooltip("Parameters for the Factory.")] public FactoryParameters FactoryParameters; 155 | 156 | [SerializeField] [Tooltip("Parameters for the Garbage Collector.")] public GarbageCollectorParameters 157 | GarbageCollectorParameters; 158 | } 159 | 160 | [Serializable] 161 | public struct PredefinedObjectPool 162 | { 163 | [SerializeField] [Tooltip("The base prefab of this pool.")] public GameObject Prefab; 164 | [SerializeField] [Tooltip("The minimum number of instances to keep.")] public uint Min; 165 | [SerializeField] [Tooltip("The maximum number of instances to keep.\n(0 = No limit.).")] public uint Max; 166 | [SerializeField] [Range(0.1f, 1.0f)] [Tooltip("The target usage ratio.")] public float UsageRatio; 167 | } 168 | 169 | public interface ITaskRunner 170 | { 171 | void Setup(T parameters); 172 | void Run(); 173 | } 174 | } -------------------------------------------------------------------------------- /Assets/PoolManager/Scripts/PoolManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dfb6d59fa4dd0414f951d6a549302ff4 3 | timeCreated: 1468181073 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98770a87facba59419f90ff552c47a8e 3 | folderAsset: yes 4 | timeCreated: 1466381888 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 114ca671f83507a4e9aa50549dc4a12b 3 | folderAsset: yes 4 | timeCreated: 1466279812 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Chunk.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Chunk.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Chunk.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64d2b9721f9943b4692cd67be916fac8 3 | timeCreated: 1466535965 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13d1e475700400f4d86008f9b0c6dc01 3 | folderAsset: yes 4 | timeCreated: 1466402212 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Dead Bush.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Environment/Dead Bush.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Dead Bush.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6da42ff20310e61479e9a778bd927d4d 3 | timeCreated: 1466402234 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Flower.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Environment/Flower.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Flower.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b1855da31b365940ba33a126bcca1a9 3 | timeCreated: 1466402239 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Mushroom.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Environment/Mushroom.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Mushroom.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f9402d3918f7274189a337aae7a68c1 3 | timeCreated: 1466402245 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Tall Grass.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Environment/Tall Grass.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Tall Grass.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d796aa7ffa3fb324cbbfeb78270d70ed 3 | timeCreated: 1466402249 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Tree.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Environment/Tree.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Tree.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 198dbd1a55ee275419e5febe9bdf0738 3 | timeCreated: 1466402256 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Water Lily.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Environment/Water Lily.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Environment/Water Lily.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e02f0a06d590f54c88d9e70fe7f5f3b 3 | timeCreated: 1466402259 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16726b12d863a074db63329d62896d85 3 | folderAsset: yes 4 | timeCreated: 1466402218 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Cobblestone.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Cobblestone.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Cobblestone.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e888b63b152be61489cf8d02d59ee3a6 3 | timeCreated: 1466402349 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Dirt.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Dirt.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Dirt.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fcce3d6acb750d244ac00b653423c571 3 | timeCreated: 1466402318 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Grass.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Grass.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Grass.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e010e6d08ec2fc64ca12ac31bac7daef 3 | timeCreated: 1466402321 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Gravel.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Gravel.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Gravel.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc8c5d4fe1ee4bb4f841108a8f88b465 3 | timeCreated: 1466402324 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Podzol.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Podzol.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Podzol.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d703d1cec15847d418db3e6991ce1d69 3 | timeCreated: 1466402326 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Sand.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Sand.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Sand.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93b6d73bdf5cde04aba9b5938e3c073e 3 | timeCreated: 1466402328 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Sandstone.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Sandstone.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Sandstone.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90eb3c1b83619364fad8d0a1a64fa180 3 | timeCreated: 1466402332 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Water.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Prefabs/Terrain/Water.prefab -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Prefabs/Terrain/Water.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fbd70dcfb5d302478b16d8467fdb23e 3 | timeCreated: 1466402334 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 767e88e2ca9bd8a42afca6a37303f1df 3 | folderAsset: yes 4 | timeCreated: 1466381442 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scenes/Main.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Scenes/Main.unity -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scenes/Main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e20e68accc1d3949bff27339ea9bb15 3 | timeCreated: 1466299890 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8bd8305944f9d9489977d1623e96cb3 3 | folderAsset: yes 4 | timeCreated: 1466277269 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scripts/Chunk.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using PoolingSystem; 4 | 5 | namespace Procedural2DTileWorld 6 | { 7 | public class Chunk : MonoBehaviour 8 | { 9 | [Tooltip("Wich tiled world this chunk belongs")] [SerializeField] private World _world; 10 | [Tooltip("(X,Y) Position in tiled world.")] [SerializeField] private Vector2 _position; 11 | [Tooltip("Size of the chunk.")] [Range(1, 256)] [SerializeField] private uint _size; 12 | 13 | private GameObject[,] _terrain; 14 | private GameObject[,] _environment; 15 | 16 | public World World 17 | { 18 | get { return _world; } 19 | set { _world = value; } 20 | } 21 | 22 | public Vector2 Position 23 | { 24 | get { return _position; } 25 | set 26 | { 27 | _position = value; 28 | transform.position = _position*_size; 29 | } 30 | } 31 | 32 | public uint Size 33 | { 34 | get { return _size; } 35 | set 36 | { 37 | Clear(); 38 | if (value < 1) 39 | _size = 1; 40 | else if (value > 256) 41 | _size = 256; 42 | else 43 | _size = value; 44 | Setup(); 45 | } 46 | } 47 | 48 | /// 49 | /// Setup the chunk. 50 | /// 51 | private void Setup() 52 | { 53 | _terrain = new GameObject[_size, _size]; 54 | _environment = new GameObject[_size, _size]; 55 | } 56 | 57 | /// 58 | /// Clear all the tiles. 59 | /// 60 | public void Clear() 61 | { 62 | for (var x = 0; x < _size; x++) 63 | { 64 | for (var y = 0; y < _size; y++) 65 | { 66 | Clear(x, y); 67 | } 68 | } 69 | } 70 | 71 | /// 72 | /// Clear the tile in (X,Y) 73 | /// 74 | /// X position. 75 | /// Y position. 76 | private void Clear(int x, int y) 77 | { 78 | if (_terrain[x, y]) 79 | { 80 | _terrain[x, y].GetComponent().Despawn(); 81 | _terrain[x, y] = null; 82 | } 83 | if (_environment[x, y]) 84 | { 85 | _environment[x, y].GetComponent().Despawn(); 86 | _environment[x, y] = null; 87 | } 88 | } 89 | 90 | /// 91 | /// Generate all the tiles in this chunk. 92 | /// 93 | public void Generate() 94 | { 95 | //Clear(); 96 | for (var x = 0; x < _size; x++) 97 | { 98 | for (var y = 0; y < _size; y++) 99 | { 100 | Clear(x, y); 101 | Generate(x, y); 102 | } 103 | } 104 | } 105 | 106 | /// 107 | /// Generate the tile in (X,Y) 108 | /// 109 | /// X position. 110 | /// Y position. 111 | private void Generate(int x, int y) 112 | { 113 | float height = Mathf.PerlinNoise( 114 | (_position.x*_size + x)*_world.Settings.HeightMap.Scale.x + _world.Settings.HeightMap.Offset.x, 115 | (_position.y*_size + y)*_world.Settings.HeightMap.Scale.y + _world.Settings.HeightMap.Offset.y 116 | ); 117 | height = Mathf.Clamp01(height); 118 | float probability = Mathf.PerlinNoise( 119 | (_position.x*_size + x)*_world.Settings.SpawnProbability.Scale.x + 120 | _world.Settings.SpawnProbability.Offset.x, 121 | (_position.y*_size + y)*_world.Settings.SpawnProbability.Scale.y + 122 | _world.Settings.SpawnProbability.Offset.y 123 | ); 124 | probability = Mathf.Clamp01(probability); 125 | foreach (var tile in _world.Terrain) 126 | { 127 | if (tile.CanSpawn(height, probability)) 128 | { 129 | SetTerrain(x, y, tile.Prefab); 130 | break; 131 | } 132 | } 133 | foreach (var tile in _world.Environment) 134 | { 135 | if (tile.CanSpawn(height, probability)) 136 | { 137 | SetEnviroment(x, y, tile.Prefab); 138 | break; 139 | } 140 | } 141 | } 142 | 143 | /// 144 | /// Set the terrain at (X,Y) 145 | /// 146 | /// X position. 147 | /// Y position. 148 | /// The tile to set. 149 | private void SetTerrain(int x, int y, GameObject tile) 150 | { 151 | _terrain[x, y] = PoolManager.Pools[tile].Spawn(); 152 | if (_terrain[x, y]) 153 | { 154 | _terrain[x, y].transform.parent = transform; 155 | _terrain[x, y].transform.localPosition = Vector3.right*x + Vector3.up*y; 156 | } 157 | } 158 | 159 | /// 160 | /// Set the environment object at (X,Y) 161 | /// 162 | /// X position. 163 | /// Y position. 164 | /// The tile to set. 165 | private void SetEnviroment(int x, int y, GameObject tile) 166 | { 167 | _environment[x, y] = PoolManager.Pools[tile].Spawn(); 168 | if (_environment[x, y]) 169 | { 170 | _environment[x, y].transform.parent = transform; 171 | _environment[x, y].transform.localPosition = Vector3.right*x + Vector3.up*y; 172 | } 173 | } 174 | 175 | // Awake is called when the script instance is being loaded 176 | public void Awake() 177 | { 178 | _size = 1; 179 | Setup(); 180 | } 181 | } 182 | } -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scripts/Chunk.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3df1816ab7821e440a4fec89423e2d69 3 | timeCreated: 1466281687 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scripts/PlayerController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | using UnityEngine.UI; 5 | 6 | public class PlayerController : MonoBehaviour 7 | { 8 | [Tooltip("The movement speed.")] [SerializeField] public float Speed; 9 | [Tooltip("The text UI element.")] [SerializeField] private Text _text; 10 | [Tooltip("The world.")] [SerializeField] private Procedural2DTileWorld.World _world; 11 | private string _message; 12 | 13 | // Awake is called when the script instance is being loaded 14 | public void Awake() 15 | { 16 | _message = _text.text; 17 | } 18 | 19 | 20 | // Update is called once per frame 21 | public void Update() 22 | { 23 | var pos = transform.position; 24 | pos.x += Input.GetAxis("Horizontal")*Speed; 25 | pos.y += Input.GetAxis("Vertical")*Speed; 26 | transform.position = pos; 27 | 28 | _text.text = string.Format(_message, 29 | Mathf.FloorToInt(transform.position.x), 30 | Mathf.FloorToInt(transform.position.y), 31 | Mathf.FloorToInt(_world.CurrentPosition.x), 32 | Mathf.FloorToInt(_world.CurrentPosition.y)); 33 | } 34 | } -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scripts/PlayerController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cb000348e083754d87ad8e85ea99285 3 | timeCreated: 1469493676 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scripts/World.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | 5 | namespace Procedural2DTileWorld 6 | { 7 | public class World : MonoBehaviour 8 | { 9 | [Tooltip("Environment tiles settings.")] [SerializeField] private TileSettings[] _environment; 10 | [Tooltip("Terrain tiles settings.")] [SerializeField] private TileSettings[] _terrain; 11 | [Tooltip("Settings for procedural generation.")] [SerializeField] private Settings _settings; 12 | 13 | private Chunk[,] _chunks; 14 | private Vector2 _currentPosition; 15 | private Transform _camera; 16 | 17 | public TileSettings[] Environment 18 | { 19 | get { return _environment; } 20 | } 21 | 22 | public TileSettings[] Terrain 23 | { 24 | get { return _terrain; } 25 | } 26 | 27 | public Settings Settings 28 | { 29 | get { return _settings; } 30 | } 31 | 32 | public Vector2 CurrentPosition 33 | { 34 | get { return _currentPosition; } 35 | } 36 | 37 | // Awake is called when the script instance is being loaded 38 | public void Awake() 39 | { 40 | _chunks = new Chunk[_settings.WorldSize, _settings.WorldSize]; 41 | _camera = Camera.main.transform; 42 | CreateWorld(); 43 | GenerateWorld(Vector2.zero); 44 | } 45 | 46 | // Use this for initialization 47 | public void Start() 48 | { 49 | } 50 | 51 | // Update is called once per frame 52 | public void Update() 53 | { 54 | var cameraPosition = new Vector2(Mathf.Floor(_camera.position.x/_settings.ChunkSize), 55 | Mathf.Floor(_camera.position.y/_settings.ChunkSize)); 56 | if (!Mathf.Approximately(_currentPosition.x, cameraPosition.x) || 57 | !Mathf.Approximately(_currentPosition.y, cameraPosition.y)) 58 | GenerateWorld(cameraPosition); 59 | } 60 | 61 | /// 62 | /// Create all the chunks in the world. 63 | /// 64 | private void CreateWorld() 65 | { 66 | for (var x = 0; x < _settings.WorldSize; x++) 67 | { 68 | for (var y = 0; y < _settings.WorldSize; y++) 69 | { 70 | _chunks[x, y] = CreateChunk(); 71 | } 72 | } 73 | } 74 | 75 | /// 76 | /// Create a new chunk. 77 | /// 78 | /// A new chunk. 79 | private Chunk CreateChunk() 80 | { 81 | var chunkGameObject = Instantiate(_settings.Chunk); 82 | var chunk = chunkGameObject.GetComponent(); 83 | chunk.transform.parent = transform; 84 | chunk.World = this; 85 | chunk.Size = _settings.ChunkSize; 86 | return chunk; 87 | } 88 | 89 | /// 90 | /// Generate the world based on a central position. 91 | /// 92 | /// The position of the central chunk. 93 | private void GenerateWorld(Vector2 position) 94 | { 95 | _currentPosition = position; 96 | position += (Vector2.left + Vector2.up)*_settings.StreamRadius; 97 | for (var x = 0; x < _settings.WorldSize; x++) 98 | { 99 | for (var y = 0; y < _settings.WorldSize; y++) 100 | { 101 | _chunks[x, y].Position = position; 102 | _chunks[x, y].Generate(); 103 | position += Vector2.down; 104 | } 105 | position += Vector2.right + Vector2.up*_settings.WorldSize; 106 | } 107 | } 108 | } 109 | 110 | [Serializable] 111 | public struct TileSettings 112 | { 113 | [Tooltip("The name of this tile.")] [SerializeField] public string Name; 114 | [Tooltip("The prefab of this tile.")] [SerializeField] public GameObject Prefab; 115 | [Tooltip("The minimun height to spawn.")] [Range(0.0f, 1.0f)] [SerializeField] public float MinHeight; 116 | [Tooltip("The maximum height to spawn.")] [Range(0.0f, 1.0f)] [SerializeField] public float MaxHeight; 117 | [Tooltip("Use conditional spawn.")] [SerializeField] public bool UseProbability; 118 | [Tooltip("The probability to spawn.")] [Range(0.0f, 1.0f)] [SerializeField] public float Probability; 119 | 120 | public bool IsInHeightRange(float height) 121 | { 122 | return MinHeight <= height && height <= MaxHeight; 123 | } 124 | 125 | public bool IsInProbabilityRange(float probability) 126 | { 127 | if (UseProbability) 128 | return probability < Probability; 129 | return true; 130 | } 131 | 132 | public bool CanSpawn(float height, float probability) 133 | { 134 | return IsInHeightRange(height) && IsInProbabilityRange(probability); 135 | } 136 | } 137 | 138 | [Serializable] 139 | public struct NoiseSettings 140 | { 141 | [Tooltip("Scale multiplier.")] [SerializeField] public Vector2 Scale; 142 | [Tooltip("Offset.")] [SerializeField] public Vector2 Offset; 143 | } 144 | 145 | [Serializable] 146 | public struct Settings 147 | { 148 | [Header("Chunk Settings")] [Tooltip("Size of the chunks.")] [SerializeField] public uint ChunkSize; 149 | [Tooltip("Prefab of chunk.")] [SerializeField] public GameObject Chunk; 150 | [Header("World Settings")] [SerializeField] public uint StreamRadius; 151 | [Header("Noise Settings")] [SerializeField] public NoiseSettings HeightMap; 152 | [SerializeField] public NoiseSettings SpawnProbability; 153 | 154 | public uint WorldSize 155 | { 156 | get { return 2*StreamRadius + 1; } 157 | } 158 | } 159 | } -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Scripts/World.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86a9044ae7891834eaa3d2109e320dd1 3 | timeCreated: 1466277356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b47faedcf08f1dd4e8bb247b25871b34 3 | folderAsset: yes 4 | timeCreated: 1466277231 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7b1a916dbe1eea4f999586e9b8edfbe 3 | folderAsset: yes 4 | timeCreated: 1466401853 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Dead Bush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Environment/Dead Bush.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Dead Bush.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b16c940c970eb104690a7c2e445d3f81 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Environment/Flower.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Flower.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f393b45c90b1a7d4abefbbe086bb6206 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Mushroom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Environment/Mushroom.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Mushroom.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f7899f97489c474bb91627ffe3bab3f 3 | timeCreated: 1466381442 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Tall Grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Environment/Tall Grass.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Tall Grass.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ab36e668e71d624cacb849dd89d6a03 3 | timeCreated: 1466381442 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Environment/Tree.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Tree.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe5289faec72a6744ae33e9993f9b9e5 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Water Lily.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Environment/Water Lily.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Environment/Water Lily.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cba9b7ea6f73f5e43917e6ed4b1c95db 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/SOURCE: -------------------------------------------------------------------------------- 1 | http://www.minecraftforum.net/forums/mapping-and-modding/resource-packs/1245525-storyblock-2-4-its-back-comeback-update-with-stone 2 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/SOURCE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c255057fb17c1048b51a8be6eb9e80f 3 | timeCreated: 1469460032 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 327f249897dc9534491b8b003934c272 3 | folderAsset: yes 4 | timeCreated: 1466401853 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Cobblestone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Cobblestone.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Cobblestone.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba276a5f8e47d74429ab54d3d3fd9399 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Dirt.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Dirt.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41e7d586821dd1547b715e224dcc056a 3 | timeCreated: 1466381442 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Grass.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Grass.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aab888b07fe31364bafb2dfa23e5a4ce 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Gravel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Gravel.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Gravel.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f442d5b51dcb4524aa5c15bd71b3771f 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Podzol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Podzol.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Podzol.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: defb8309608b14743961629d48420b8f 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Sand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Sand.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Sand.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f56aa0ccec5fdf4992186f88740af6d 3 | timeCreated: 1466381442 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Sandstone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Sandstone.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Sandstone.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9818e37e932cc4c43abd73393635ff44 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Water.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/Procedural2DTileWorld/Sprites/Terrain/Water.png -------------------------------------------------------------------------------- /Assets/Procedural2DTileWorld/Sprites/Terrain/Water.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bde3753cb56a2c3489e1196d8810d50e 3 | timeCreated: 1466381443 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 1 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 128 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/UnityVS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8de933ca9171e26478d0ed7b4d7ab081 3 | folderAsset: yes 4 | timeCreated: 1466381847 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityVS/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 053aec2e076858e48979d500bb59a017 3 | folderAsset: yes 4 | timeCreated: 1466381847 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll -------------------------------------------------------------------------------- /Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll.meta: -------------------------------------------------------------------------------- 1 | guid: 38d405c119fcc7c4e83d4a478a40ff2f 2 | -------------------------------------------------------------------------------- /Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll -------------------------------------------------------------------------------- /Assets/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll.meta: -------------------------------------------------------------------------------- 1 | guid: 4ad02dc83da735c4e8d945332b9202f6 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Camilo Sanchez (Camiloasc1) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.5f1 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Camiloasc1/UnityProcedural2DTileWorld/a7bca2d702752471c958b33d2772bbb5284a30d6/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Unity Procedural 2D Tile World 2 | ============================== 3 | 4 | Basic PCG software to procedurally create 2D tiled worlds in Unity 3D. 5 | 6 | #### [WebGL Demo](https://camiloasc1.github.io/UnityProcedural2DTileWorld/demo/) 7 | 8 | ### Features: 9 | * Infinite world dynamically generated (symmetric around 0,0). 10 | * Customizable parameters for: 11 | * Noise (2D Perlin noise). 12 | * Height maps. 13 | * Spawn probability. 14 | * Includes a basic pooling system. 15 | * Contains some sample textures. 16 | 17 | #### As example includes some terrain tiles as: 18 | 19 | * Cobblestone 20 | * Dirt 21 | * Grass 22 | * Gravel 23 | * Podzol 24 | * Sand 25 | * Sandstone 26 | * Water 27 | 28 | And also some environment objects: 29 | 30 | * Dead Bush 31 | * Flower 32 | * Mushroom 33 | * Tall Grass 34 | * Tree 35 | * Water Lily 36 | 37 | **Relies on Unity's implementation of 2D Perlin noise.** 38 | 39 | --------------------------------------------------------------------------------