├── ProjectSettings ├── ProjectVersion.txt ├── NetworkManager.asset ├── TimeManager.asset ├── EditorBuildSettings.asset ├── UnityAnalyticsManager.asset ├── UnityAdsSettings.asset ├── AudioManager.asset ├── EditorSettings.asset ├── Physics2DSettings.asset ├── DynamicsManager.asset ├── GraphicsSettings.asset ├── TagManager.asset ├── NavMeshAreas.asset ├── NavMeshLayers.asset ├── QualitySettings.asset ├── InputManager.asset └── ProjectSettings.asset ├── Assets ├── Pictures │ ├── Dirt-1.png │ ├── Dirt-Grass-1.png │ ├── Dirt-1.png.meta │ └── Dirt-Grass-1.png.meta ├── Editor.meta ├── Pictures.meta ├── Prefabs.meta ├── Prefabs │ ├── TileSet.asset.meta │ ├── GameObject 1.prefab.meta │ ├── Grass-ground.prefab.meta │ ├── TileSet.asset │ ├── GameObject 1.prefab │ └── Grass-ground.prefab ├── Scripts.meta ├── Scripts │ ├── TileSet.cs │ ├── Grid.cs.meta │ ├── GridWindow.cs.meta │ ├── TileSet.cs.meta │ ├── GridWindow.cs │ └── Grid.cs ├── testLevel.unity.meta ├── Editor │ ├── GridEditor.cs.meta │ └── GridEditor.cs └── testLevel.unity ├── README.md ├── .gitignore └── LICENSE /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.2.2f1 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /Assets/Pictures/Dirt-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Luneyco/simple-unity-2d-map-editor/HEAD/Assets/Pictures/Dirt-1.png -------------------------------------------------------------------------------- /Assets/Pictures/Dirt-Grass-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Luneyco/simple-unity-2d-map-editor/HEAD/Assets/Pictures/Dirt-Grass-1.png -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b5cc7565f2abe142bd3d2465431636c 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Pictures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08e2559b7511e0a4b91bf22b228972d5 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0917b434155608d4c97d0065afb07e38 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Prefabs/TileSet.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd6eee83d1f32734e9f71bc21843b784 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75f6b5c4f65cbe24cbc1d3be4f325966 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Prefabs/GameObject 1.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9d119d424bdf1264da7df215e458cda1 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Prefabs/Grass-ground.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1972405e3bb3454a8855ee9a032ecfd 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Scripts/TileSet.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class TileSet : ScriptableObject { 5 | public Transform[] prefabs = new Transform[0]; 6 | } 7 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # simple-unity-2d-map-editor 2 | It is an simple 2D map editor for unity. 3 | 4 | It is the result of the Tutorial series on youtube https://www.youtube.com/watch?v=2j7AZdv0yr0&list=PLZvnsP8zkW0fvStNdFhF05dzoXXIOA2-R 5 | -------------------------------------------------------------------------------- /Assets/Scripts/Grid.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81df66ac2033afa4387be937639f57bb 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/testLevel.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c63c9c81112eb0649b968897e6e17bbc 3 | timeCreated: 1446760792 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor/GridEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f55045c51ae0b94bac4cca10d092fc6 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/GridWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13a65f7efd6ff2a4f9d42e438b30e97c 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/TileSet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4dee3c41abdcedf43b85831398d566a2 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: .0199999996 7 | Maximum Allowed Timestep: .333333343 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/Level.unity 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityAnalyticsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!303 &1 4 | UnityAnalyticsManager: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_InitializeOnStartup: 1 8 | m_TestMode: 0 9 | m_TestEventUrl: 10 | m_TestConfigUrl: 11 | -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!292 &1 4 | UnityAdsSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_InitializeOnStartup: 1 8 | m_TestMode: 0 9 | m_EnabledPlatforms: 4294967295 10 | m_IosGameId: 11 | m_AndroidGameId: 12 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | m_SpeedOfSound: 347 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_DSPBufferSize: 0 12 | m_DisableAudio: 0 13 | -------------------------------------------------------------------------------- /Assets/Scripts/GridWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Collections; 4 | 5 | public class GridWindow : EditorWindow { 6 | Grid grid; 7 | 8 | public void init(){ 9 | grid = (Grid)FindObjectOfType(typeof(Grid)); 10 | } 11 | 12 | void OnGUI(){ 13 | grid.color = EditorGUILayout.ColorField(grid.color,GUILayout.Width(200)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 1 12 | m_SpritePackerMode: 2 13 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | m_Gravity: {x: 0, y: -30} 7 | m_DefaultMaterial: {fileID: 0} 8 | m_VelocityIterations: 8 9 | m_PositionIterations: 3 10 | m_RaycastsHitTriggers: 1 11 | m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9fffffffefffffff2fffffff3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 12 | -------------------------------------------------------------------------------- /Assets/Prefabs/TileSet.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 4 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 0 11 | m_Script: {fileID: 11500000, guid: 4dee3c41abdcedf43b85831398d566a2, type: 3} 12 | m_Name: TileSet 13 | m_EditorClassIdentifier: 14 | prefabs: 15 | - {fileID: 400002, guid: 9d119d424bdf1264da7df215e458cda1, type: 2} 16 | - {fileID: 400002, guid: c1972405e3bb3454a8855ee9a032ecfd, type: 2} 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | 6 | # Autogenerated VS/MD solution and project files 7 | *.csproj 8 | *.unityproj 9 | *.sln 10 | *.suo 11 | <<<<<<< HEAD 12 | ======= 13 | *.tmp 14 | >>>>>>> bb29ed18aa056f6900de7e0c1f3253b81a1c8ea8 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | 20 | <<<<<<< HEAD 21 | # Unity3D Generated File On Crash Reports 22 | sysinfo.txt 23 | 24 | # Certificates 25 | *.pfx 26 | *.pfx.meta 27 | ======= 28 | # Unity3D generated meta files 29 | *.pidb.meta 30 | 31 | # Unity3D Generated File On Crash Reports 32 | sysinfo.txt 33 | >>>>>>> bb29ed18aa056f6900de7e0c1f3253b81a1c8ea8 34 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | m_Gravity: {x: 0, y: -9.81000042, z: 0} 7 | m_DefaultMaterial: {fileID: 0} 8 | m_BounceThreshold: 2 9 | m_SleepVelocity: .150000006 10 | m_SleepAngularVelocity: .140000001 11 | m_MaxAngularVelocity: 7 12 | m_MinPenetrationForPenalty: .00999999978 13 | m_SolverIterationCount: 6 14 | m_RaycastsHitTriggers: 1 15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 16 | -------------------------------------------------------------------------------- /Assets/Scripts/Grid.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Grid : MonoBehaviour { 5 | 6 | public float width = 32.0f; 7 | public float height = 32.0f; 8 | 9 | public Color color = Color.white; 10 | 11 | public Transform tilePrefab; 12 | 13 | public TileSet tileSet; 14 | 15 | public bool draggable; 16 | 17 | void OnDrawGizmos(){ 18 | Vector3 pos = Camera.current.transform.position; 19 | Gizmos.color = this.color; 20 | 21 | 22 | for(float y = pos.y - 800.0f; y < pos.y + 800.0f; y+= this.height){ 23 | Gizmos.DrawLine(new Vector3(-1000000.0f, Mathf.Floor(y/this.height)*this.height, 0.0f), 24 | new Vector3(1000000.0f, Mathf.Floor(y/this.height)*this.height, 0.0f)); 25 | } 26 | 27 | for(float x = pos.x -1200.0f; x < pos.x + 1200.0f; x+= this.width){ 28 | Gizmos.DrawLine(new Vector3(Mathf.Floor(x/this.width)*this.width,-1000000.0f, 0.0f), 29 | new Vector3(Mathf.Floor(x/this.width)*this.width, 1000000.0f, 0.0f)); 30 | } 31 | 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Desnoo 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 | 23 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_LegacyDeferred: 11 | m_Mode: 1 12 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 13 | m_AlwaysIncludedShaders: 14 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 15 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 16 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 17 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 18 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 19 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 20 | m_PreloadedShaders: [] 21 | m_LightmapStripping: 0 22 | m_LightmapKeepPlain: 1 23 | m_LightmapKeepDirCombined: 1 24 | m_LightmapKeepDirSeparate: 1 25 | m_LightmapKeepDynamic: 1 26 | m_FogStripping: 0 27 | m_FogKeepLinear: 1 28 | m_FogKeepExp: 1 29 | m_FogKeepExp2: 1 30 | -------------------------------------------------------------------------------- /Assets/Pictures/Dirt-1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9dd815ddb06cda4681ba377ec32372c 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 0 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 1 13 | mipMapFadeDistanceEnd: 3 14 | bumpmap: 15 | convertToNormalMap: 0 16 | externalNormalMap: 0 17 | heightScale: .25 18 | normalMapFilter: 0 19 | isReadable: 0 20 | grayScaleToAlpha: 0 21 | generateCubemap: 0 22 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: -1 30 | nPOTScale: 0 31 | lightmap: 0 32 | compressionQuality: 50 33 | spriteMode: 1 34 | spriteExtrude: 1 35 | spriteMeshType: 1 36 | alignment: 0 37 | spritePivot: {x: .5, y: .5} 38 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 39 | spritePixelsToUnits: 32 40 | alphaIsTransparency: 1 41 | textureType: 8 42 | buildTargetSettings: [] 43 | spriteSheet: 44 | sprites: [] 45 | spritePackingTag: 46 | userData: 47 | -------------------------------------------------------------------------------- /Assets/Pictures/Dirt-Grass-1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92c420c42248dc84fbb223bfc8d2bc5d 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 0 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: .25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 1024 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: 1 34 | nPOTScale: 0 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | spriteMode: 1 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: .5, y: .5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 32 45 | alphaIsTransparency: 1 46 | textureType: 8 47 | buildTargetSettings: [] 48 | spriteSheet: 49 | sprites: [] 50 | spritePackingTag: 51 | userData: 52 | assetBundleName: 53 | assetBundleVariant: 54 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | tags: 6 | - ground 7 | - Crate 8 | - Enemy 9 | - Wall 10 | - Obstacle 11 | - Bullet 12 | - BombPickup 13 | - ExplosionFX 14 | - HealthBar 15 | - 16 | Builtin Layer 0: Default 17 | Builtin Layer 1: TransparentFX 18 | Builtin Layer 2: Ignore Raycast 19 | Builtin Layer 3: 20 | Builtin Layer 4: Water 21 | Builtin Layer 5: 22 | Builtin Layer 6: 23 | Builtin Layer 7: 24 | User Layer 8: Bombs 25 | User Layer 9: Player 26 | User Layer 10: Enemies 27 | User Layer 11: Pickups 28 | User Layer 12: Ground 29 | User Layer 13: 30 | User Layer 14: 31 | User Layer 15: 32 | User Layer 16: 33 | User Layer 17: 34 | User Layer 18: 35 | User Layer 19: 36 | User Layer 20: 37 | User Layer 21: 38 | User Layer 22: 39 | User Layer 23: 40 | User Layer 24: 41 | User Layer 25: 42 | User Layer 26: 43 | User Layer 27: 44 | User Layer 28: 45 | User Layer 29: 46 | User Layer 30: 47 | User Layer 31: 48 | m_SortingLayers: 49 | - name: Default 50 | userID: 0 51 | uniqueID: 0 52 | locked: 0 53 | - name: Default 54 | userID: 1 55 | uniqueID: 3363470833 56 | locked: 0 57 | - name: Background 58 | userID: 2 59 | uniqueID: 1535931219 60 | locked: 0 61 | - name: Character 62 | userID: 4 63 | uniqueID: 2511236001 64 | locked: 0 65 | - name: Foreground 66 | userID: 3 67 | uniqueID: 1024582385 68 | locked: 0 69 | - name: UI 70 | userID: 5 71 | uniqueID: 149272721 72 | locked: 0 73 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshLayers: 5 | m_ObjectHideFlags: 0 6 | Built-in Layer 0: 7 | name: Default 8 | cost: 1 9 | editType: 2 10 | Built-in Layer 1: 11 | name: Not Walkable 12 | cost: 1 13 | editType: 0 14 | Built-in Layer 2: 15 | name: Jump 16 | cost: 2 17 | editType: 2 18 | User Layer 0: 19 | name: 20 | cost: 1 21 | editType: 3 22 | User Layer 1: 23 | name: 24 | cost: 1 25 | editType: 3 26 | User Layer 2: 27 | name: 28 | cost: 1 29 | editType: 3 30 | User Layer 3: 31 | name: 32 | cost: 1 33 | editType: 3 34 | User Layer 4: 35 | name: 36 | cost: 1 37 | editType: 3 38 | User Layer 5: 39 | name: 40 | cost: 1 41 | editType: 3 42 | User Layer 6: 43 | name: 44 | cost: 1 45 | editType: 3 46 | User Layer 7: 47 | name: 48 | cost: 1 49 | editType: 3 50 | User Layer 8: 51 | name: 52 | cost: 1 53 | editType: 3 54 | User Layer 9: 55 | name: 56 | cost: 1 57 | editType: 3 58 | User Layer 10: 59 | name: 60 | cost: 1 61 | editType: 3 62 | User Layer 11: 63 | name: 64 | cost: 1 65 | editType: 3 66 | User Layer 12: 67 | name: 68 | cost: 1 69 | editType: 3 70 | User Layer 13: 71 | name: 72 | cost: 1 73 | editType: 3 74 | User Layer 14: 75 | name: 76 | cost: 1 77 | editType: 3 78 | User Layer 15: 79 | name: 80 | cost: 1 81 | editType: 3 82 | User Layer 16: 83 | name: 84 | cost: 1 85 | editType: 3 86 | User Layer 17: 87 | name: 88 | cost: 1 89 | editType: 3 90 | User Layer 18: 91 | name: 92 | cost: 1 93 | editType: 3 94 | User Layer 19: 95 | name: 96 | cost: 1 97 | editType: 3 98 | User Layer 20: 99 | name: 100 | cost: 1 101 | editType: 3 102 | User Layer 21: 103 | name: 104 | cost: 1 105 | editType: 3 106 | User Layer 22: 107 | name: 108 | cost: 1 109 | editType: 3 110 | User Layer 23: 111 | name: 112 | cost: 1 113 | editType: 3 114 | User Layer 24: 115 | name: 116 | cost: 1 117 | editType: 3 118 | User Layer 25: 119 | name: 120 | cost: 1 121 | editType: 3 122 | User Layer 26: 123 | name: 124 | cost: 1 125 | editType: 3 126 | User Layer 27: 127 | name: 128 | cost: 1 129 | editType: 3 130 | User Layer 28: 131 | name: 132 | cost: 1 133 | editType: 3 134 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshLayers: 5 | m_ObjectHideFlags: 0 6 | Built-in Layer 0: 7 | name: Default 8 | cost: 1 9 | editType: 2 10 | Built-in Layer 1: 11 | name: Not Walkable 12 | cost: 1 13 | editType: 0 14 | Built-in Layer 2: 15 | name: Jump 16 | cost: 2 17 | editType: 2 18 | User Layer 0: 19 | name: 20 | cost: 1 21 | editType: 3 22 | User Layer 1: 23 | name: 24 | cost: 1 25 | editType: 3 26 | User Layer 2: 27 | name: 28 | cost: 1 29 | editType: 3 30 | User Layer 3: 31 | name: 32 | cost: 1 33 | editType: 3 34 | User Layer 4: 35 | name: 36 | cost: 1 37 | editType: 3 38 | User Layer 5: 39 | name: 40 | cost: 1 41 | editType: 3 42 | User Layer 6: 43 | name: 44 | cost: 1 45 | editType: 3 46 | User Layer 7: 47 | name: 48 | cost: 1 49 | editType: 3 50 | User Layer 8: 51 | name: 52 | cost: 1 53 | editType: 3 54 | User Layer 9: 55 | name: 56 | cost: 1 57 | editType: 3 58 | User Layer 10: 59 | name: 60 | cost: 1 61 | editType: 3 62 | User Layer 11: 63 | name: 64 | cost: 1 65 | editType: 3 66 | User Layer 12: 67 | name: 68 | cost: 1 69 | editType: 3 70 | User Layer 13: 71 | name: 72 | cost: 1 73 | editType: 3 74 | User Layer 14: 75 | name: 76 | cost: 1 77 | editType: 3 78 | User Layer 15: 79 | name: 80 | cost: 1 81 | editType: 3 82 | User Layer 16: 83 | name: 84 | cost: 1 85 | editType: 3 86 | User Layer 17: 87 | name: 88 | cost: 1 89 | editType: 3 90 | User Layer 18: 91 | name: 92 | cost: 1 93 | editType: 3 94 | User Layer 19: 95 | name: 96 | cost: 1 97 | editType: 3 98 | User Layer 20: 99 | name: 100 | cost: 1 101 | editType: 3 102 | User Layer 21: 103 | name: 104 | cost: 1 105 | editType: 3 106 | User Layer 22: 107 | name: 108 | cost: 1 109 | editType: 3 110 | User Layer 23: 111 | name: 112 | cost: 1 113 | editType: 3 114 | User Layer 24: 115 | name: 116 | cost: 1 117 | editType: 3 118 | User Layer 25: 119 | name: 120 | cost: 1 121 | editType: 3 122 | User Layer 26: 123 | name: 124 | cost: 1 125 | editType: 3 126 | User Layer 27: 127 | name: 128 | cost: 1 129 | editType: 3 130 | User Layer 28: 131 | name: 132 | cost: 1 133 | editType: 3 134 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 3 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | blendWeights: 1 18 | textureQuality: 1 19 | anisotropicTextures: 0 20 | antiAliasing: 0 21 | softParticles: 0 22 | softVegetation: 0 23 | vSyncCount: 0 24 | lodBias: .300000012 25 | maximumLODLevel: 0 26 | particleRaycastBudget: 4 27 | excludedTargetPlatforms: [] 28 | - serializedVersion: 2 29 | name: Fast 30 | pixelLightCount: 0 31 | shadows: 0 32 | shadowResolution: 0 33 | shadowProjection: 1 34 | shadowCascades: 1 35 | shadowDistance: 20 36 | blendWeights: 2 37 | textureQuality: 0 38 | anisotropicTextures: 0 39 | antiAliasing: 0 40 | softParticles: 0 41 | softVegetation: 0 42 | vSyncCount: 0 43 | lodBias: .400000006 44 | maximumLODLevel: 0 45 | particleRaycastBudget: 16 46 | excludedTargetPlatforms: [] 47 | - serializedVersion: 2 48 | name: Simple 49 | pixelLightCount: 1 50 | shadows: 1 51 | shadowResolution: 0 52 | shadowProjection: 1 53 | shadowCascades: 1 54 | shadowDistance: 20 55 | blendWeights: 2 56 | textureQuality: 0 57 | anisotropicTextures: 1 58 | antiAliasing: 0 59 | softParticles: 0 60 | softVegetation: 0 61 | vSyncCount: 0 62 | lodBias: .699999988 63 | maximumLODLevel: 0 64 | particleRaycastBudget: 64 65 | excludedTargetPlatforms: [] 66 | - serializedVersion: 2 67 | name: Good 68 | pixelLightCount: 2 69 | shadows: 2 70 | shadowResolution: 1 71 | shadowProjection: 1 72 | shadowCascades: 2 73 | shadowDistance: 40 74 | blendWeights: 2 75 | textureQuality: 0 76 | anisotropicTextures: 1 77 | antiAliasing: 0 78 | softParticles: 0 79 | softVegetation: 1 80 | vSyncCount: 1 81 | lodBias: 1 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 256 84 | excludedTargetPlatforms: [] 85 | - serializedVersion: 2 86 | name: Beautiful 87 | pixelLightCount: 3 88 | shadows: 2 89 | shadowResolution: 2 90 | shadowProjection: 1 91 | shadowCascades: 2 92 | shadowDistance: 70 93 | blendWeights: 4 94 | textureQuality: 0 95 | anisotropicTextures: 2 96 | antiAliasing: 2 97 | softParticles: 1 98 | softVegetation: 1 99 | vSyncCount: 1 100 | lodBias: 1.5 101 | maximumLODLevel: 0 102 | particleRaycastBudget: 1024 103 | excludedTargetPlatforms: [] 104 | - serializedVersion: 2 105 | name: Fantastic 106 | pixelLightCount: 4 107 | shadows: 2 108 | shadowResolution: 2 109 | shadowProjection: 1 110 | shadowCascades: 4 111 | shadowDistance: 150 112 | blendWeights: 4 113 | textureQuality: 0 114 | anisotropicTextures: 2 115 | antiAliasing: 2 116 | softParticles: 1 117 | softVegetation: 1 118 | vSyncCount: 1 119 | lodBias: 2 120 | maximumLODLevel: 0 121 | particleRaycastBudget: 4096 122 | excludedTargetPlatforms: [] 123 | m_PerPlatformDefaultQuality: {} 124 | -------------------------------------------------------------------------------- /Assets/Prefabs/GameObject 1.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &100000 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 4: {fileID: 400000} 11 | - 212: {fileID: 21200000} 12 | m_Layer: 0 13 | m_Name: Dirt-1 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!1 &100002 20 | GameObject: 21 | m_ObjectHideFlags: 0 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | serializedVersion: 4 25 | m_Component: 26 | - 4: {fileID: 400002} 27 | - 212: {fileID: 21200002} 28 | m_Layer: 0 29 | m_Name: GameObject 1 30 | m_TagString: Untagged 31 | m_Icon: {fileID: 0} 32 | m_NavMeshLayer: 0 33 | m_StaticEditorFlags: 0 34 | m_IsActive: 1 35 | --- !u!4 &400000 36 | Transform: 37 | m_ObjectHideFlags: 1 38 | m_PrefabParentObject: {fileID: 0} 39 | m_PrefabInternal: {fileID: 100100000} 40 | m_GameObject: {fileID: 100000} 41 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 42 | m_LocalPosition: {x: 0, y: 0, z: 0} 43 | m_LocalScale: {x: 1, y: 1, z: 1} 44 | m_Children: [] 45 | m_Father: {fileID: 400002} 46 | m_RootOrder: 0 47 | --- !u!4 &400002 48 | Transform: 49 | m_ObjectHideFlags: 1 50 | m_PrefabParentObject: {fileID: 0} 51 | m_PrefabInternal: {fileID: 100100000} 52 | m_GameObject: {fileID: 100002} 53 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 54 | m_LocalPosition: {x: 0, y: 0, z: 0} 55 | m_LocalScale: {x: 1, y: 1, z: 1} 56 | m_Children: 57 | - {fileID: 400000} 58 | m_Father: {fileID: 0} 59 | m_RootOrder: 0 60 | --- !u!212 &21200000 61 | SpriteRenderer: 62 | m_ObjectHideFlags: 1 63 | m_PrefabParentObject: {fileID: 0} 64 | m_PrefabInternal: {fileID: 100100000} 65 | m_GameObject: {fileID: 100000} 66 | m_Enabled: 1 67 | m_CastShadows: 0 68 | m_ReceiveShadows: 0 69 | m_Materials: 70 | - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} 71 | m_SubsetIndices: 72 | m_StaticBatchRoot: {fileID: 0} 73 | m_UseLightProbes: 0 74 | m_ReflectionProbeUsage: 1 75 | m_ProbeAnchor: {fileID: 0} 76 | m_ScaleInLightmap: 1 77 | m_PreserveUVs: 0 78 | m_ImportantGI: 0 79 | m_AutoUVMaxDistance: .5 80 | m_AutoUVMaxAngle: 89 81 | m_LightmapParameters: {fileID: 0} 82 | m_SortingLayerID: 0 83 | m_SortingOrder: 0 84 | m_Sprite: {fileID: 21300000, guid: b9dd815ddb06cda4681ba377ec32372c, type: 3} 85 | m_Color: {r: 1, g: 1, b: 1, a: 1} 86 | --- !u!212 &21200002 87 | SpriteRenderer: 88 | m_ObjectHideFlags: 1 89 | m_PrefabParentObject: {fileID: 0} 90 | m_PrefabInternal: {fileID: 100100000} 91 | m_GameObject: {fileID: 100002} 92 | m_Enabled: 1 93 | m_CastShadows: 0 94 | m_ReceiveShadows: 0 95 | m_Materials: 96 | - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} 97 | m_SubsetIndices: 98 | m_StaticBatchRoot: {fileID: 0} 99 | m_UseLightProbes: 0 100 | m_ReflectionProbeUsage: 1 101 | m_ProbeAnchor: {fileID: 0} 102 | m_ScaleInLightmap: 1 103 | m_PreserveUVs: 0 104 | m_ImportantGI: 0 105 | m_AutoUVMaxDistance: .5 106 | m_AutoUVMaxAngle: 89 107 | m_LightmapParameters: {fileID: 0} 108 | m_SortingLayerID: 0 109 | m_SortingOrder: 0 110 | m_Sprite: {fileID: 21300000, guid: b9dd815ddb06cda4681ba377ec32372c, type: 3} 111 | m_Color: {r: 1, g: 1, b: 1, a: 1} 112 | --- !u!1001 &100100000 113 | Prefab: 114 | m_ObjectHideFlags: 1 115 | serializedVersion: 2 116 | m_Modification: 117 | m_TransformParent: {fileID: 0} 118 | m_Modifications: [] 119 | m_RemovedComponents: [] 120 | m_ParentPrefab: {fileID: 0} 121 | m_RootGameObject: {fileID: 100002} 122 | m_IsPrefabParent: 1 123 | -------------------------------------------------------------------------------- /Assets/Prefabs/Grass-ground.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &100000 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 4: {fileID: 400000} 11 | - 212: {fileID: 21200000} 12 | m_Layer: 0 13 | m_Name: Dirt-Grass-1 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!1 &100002 20 | GameObject: 21 | m_ObjectHideFlags: 0 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | serializedVersion: 4 25 | m_Component: 26 | - 4: {fileID: 400002} 27 | - 212: {fileID: 21200002} 28 | - 61: {fileID: 6100000} 29 | m_Layer: 0 30 | m_Name: Grass-ground 31 | m_TagString: Untagged 32 | m_Icon: {fileID: 0} 33 | m_NavMeshLayer: 0 34 | m_StaticEditorFlags: 0 35 | m_IsActive: 1 36 | --- !u!4 &400000 37 | Transform: 38 | m_ObjectHideFlags: 1 39 | m_PrefabParentObject: {fileID: 0} 40 | m_PrefabInternal: {fileID: 100100000} 41 | m_GameObject: {fileID: 100000} 42 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 43 | m_LocalPosition: {x: 0, y: 0, z: 0} 44 | m_LocalScale: {x: 1, y: 1, z: 1} 45 | m_Children: [] 46 | m_Father: {fileID: 400002} 47 | m_RootOrder: 0 48 | --- !u!4 &400002 49 | Transform: 50 | m_ObjectHideFlags: 1 51 | m_PrefabParentObject: {fileID: 0} 52 | m_PrefabInternal: {fileID: 100100000} 53 | m_GameObject: {fileID: 100002} 54 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 55 | m_LocalPosition: {x: 0, y: 0, z: 0} 56 | m_LocalScale: {x: 1, y: 1, z: 1} 57 | m_Children: 58 | - {fileID: 400000} 59 | m_Father: {fileID: 0} 60 | m_RootOrder: 0 61 | --- !u!61 &6100000 62 | BoxCollider2D: 63 | m_ObjectHideFlags: 1 64 | m_PrefabParentObject: {fileID: 0} 65 | m_PrefabInternal: {fileID: 100100000} 66 | m_GameObject: {fileID: 100002} 67 | m_Enabled: 1 68 | m_Material: {fileID: 0} 69 | m_IsTrigger: 0 70 | m_Size: {x: 6.71000004, y: 3.41000009} 71 | m_Center: {x: 0, y: 1.70000005} 72 | --- !u!212 &21200000 73 | SpriteRenderer: 74 | m_ObjectHideFlags: 1 75 | m_PrefabParentObject: {fileID: 0} 76 | m_PrefabInternal: {fileID: 100100000} 77 | m_GameObject: {fileID: 100000} 78 | m_Enabled: 1 79 | m_CastShadows: 0 80 | m_ReceiveShadows: 0 81 | m_LightmapIndex: 255 82 | m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} 83 | m_Materials: 84 | - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} 85 | m_SubsetIndices: 86 | m_StaticBatchRoot: {fileID: 0} 87 | m_UseLightProbes: 0 88 | m_LightProbeAnchor: {fileID: 0} 89 | m_ScaleInLightmap: 1 90 | m_SortingLayerID: 0 91 | m_SortingOrder: 0 92 | m_Sprite: {fileID: 21300000, guid: 92c420c42248dc84fbb223bfc8d2bc5d, type: 3} 93 | m_Color: {r: 1, g: 1, b: 1, a: 1} 94 | --- !u!212 &21200002 95 | SpriteRenderer: 96 | m_ObjectHideFlags: 1 97 | m_PrefabParentObject: {fileID: 0} 98 | m_PrefabInternal: {fileID: 100100000} 99 | m_GameObject: {fileID: 100002} 100 | m_Enabled: 1 101 | m_CastShadows: 0 102 | m_ReceiveShadows: 0 103 | m_LightmapIndex: 255 104 | m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} 105 | m_Materials: 106 | - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} 107 | m_SubsetIndices: 108 | m_StaticBatchRoot: {fileID: 0} 109 | m_UseLightProbes: 0 110 | m_LightProbeAnchor: {fileID: 0} 111 | m_ScaleInLightmap: 1 112 | m_SortingLayerID: 0 113 | m_SortingOrder: 0 114 | m_Sprite: {fileID: 21300000, guid: 92c420c42248dc84fbb223bfc8d2bc5d, type: 3} 115 | m_Color: {r: 1, g: 1, b: 1, a: 1} 116 | --- !u!1001 &100100000 117 | Prefab: 118 | m_ObjectHideFlags: 1 119 | serializedVersion: 2 120 | m_Modification: 121 | m_TransformParent: {fileID: 0} 122 | m_Modifications: [] 123 | m_RemovedComponents: [] 124 | m_ParentPrefab: {fileID: 0} 125 | m_RootGameObject: {fileID: 100002} 126 | m_IsPrefabParent: 1 127 | m_IsExploded: 1 128 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | m_Axes: 7 | - serializedVersion: 3 8 | m_Name: Horizontal 9 | descriptiveName: 10 | descriptiveNegativeName: 11 | negativeButton: left 12 | positiveButton: right 13 | altNegativeButton: a 14 | altPositiveButton: d 15 | gravity: 3 16 | dead: .00100000005 17 | sensitivity: 3 18 | snap: 1 19 | invert: 0 20 | type: 0 21 | axis: 0 22 | joyNum: 0 23 | - serializedVersion: 3 24 | m_Name: Vertical 25 | descriptiveName: 26 | descriptiveNegativeName: 27 | negativeButton: down 28 | positiveButton: up 29 | altNegativeButton: s 30 | altPositiveButton: w 31 | gravity: 3 32 | dead: .00100000005 33 | sensitivity: 3 34 | snap: 1 35 | invert: 0 36 | type: 0 37 | axis: 0 38 | joyNum: 0 39 | - serializedVersion: 3 40 | m_Name: Fire1 41 | descriptiveName: 42 | descriptiveNegativeName: 43 | negativeButton: 44 | positiveButton: left ctrl 45 | altNegativeButton: 46 | altPositiveButton: mouse 0 47 | gravity: 1000 48 | dead: .00100000005 49 | sensitivity: 1000 50 | snap: 0 51 | invert: 0 52 | type: 0 53 | axis: 0 54 | joyNum: 0 55 | - serializedVersion: 3 56 | m_Name: Fire2 57 | descriptiveName: 58 | descriptiveNegativeName: 59 | negativeButton: 60 | positiveButton: left alt 61 | altNegativeButton: 62 | altPositiveButton: mouse 1 63 | gravity: 1000 64 | dead: .00100000005 65 | sensitivity: 1000 66 | snap: 0 67 | invert: 0 68 | type: 0 69 | axis: 0 70 | joyNum: 0 71 | - serializedVersion: 3 72 | m_Name: Fire3 73 | descriptiveName: 74 | descriptiveNegativeName: 75 | negativeButton: 76 | positiveButton: left cmd 77 | altNegativeButton: 78 | altPositiveButton: mouse 2 79 | gravity: 1000 80 | dead: .00100000005 81 | sensitivity: 1000 82 | snap: 0 83 | invert: 0 84 | type: 0 85 | axis: 0 86 | joyNum: 0 87 | - serializedVersion: 3 88 | m_Name: Jump 89 | descriptiveName: 90 | descriptiveNegativeName: 91 | negativeButton: 92 | positiveButton: space 93 | altNegativeButton: up 94 | altPositiveButton: 95 | gravity: 1000 96 | dead: .00100000005 97 | sensitivity: 1000 98 | snap: 0 99 | invert: 0 100 | type: 0 101 | axis: 0 102 | joyNum: 0 103 | - serializedVersion: 3 104 | m_Name: Mouse X 105 | descriptiveName: 106 | descriptiveNegativeName: 107 | negativeButton: 108 | positiveButton: 109 | altNegativeButton: 110 | altPositiveButton: 111 | gravity: 0 112 | dead: 0 113 | sensitivity: .100000001 114 | snap: 0 115 | invert: 0 116 | type: 1 117 | axis: 0 118 | joyNum: 0 119 | - serializedVersion: 3 120 | m_Name: Mouse Y 121 | descriptiveName: 122 | descriptiveNegativeName: 123 | negativeButton: 124 | positiveButton: 125 | altNegativeButton: 126 | altPositiveButton: 127 | gravity: 0 128 | dead: 0 129 | sensitivity: .100000001 130 | snap: 0 131 | invert: 0 132 | type: 1 133 | axis: 1 134 | joyNum: 0 135 | - serializedVersion: 3 136 | m_Name: Mouse ScrollWheel 137 | descriptiveName: 138 | descriptiveNegativeName: 139 | negativeButton: 140 | positiveButton: 141 | altNegativeButton: 142 | altPositiveButton: 143 | gravity: 0 144 | dead: 0 145 | sensitivity: .100000001 146 | snap: 0 147 | invert: 0 148 | type: 1 149 | axis: 2 150 | joyNum: 0 151 | - serializedVersion: 3 152 | m_Name: Horizontal 153 | descriptiveName: 154 | descriptiveNegativeName: 155 | negativeButton: 156 | positiveButton: 157 | altNegativeButton: 158 | altPositiveButton: 159 | gravity: 0 160 | dead: .189999998 161 | sensitivity: 1 162 | snap: 0 163 | invert: 0 164 | type: 2 165 | axis: 0 166 | joyNum: 0 167 | - serializedVersion: 3 168 | m_Name: Vertical 169 | descriptiveName: 170 | descriptiveNegativeName: 171 | negativeButton: 172 | positiveButton: 173 | altNegativeButton: 174 | altPositiveButton: 175 | gravity: 0 176 | dead: .189999998 177 | sensitivity: 1 178 | snap: 0 179 | invert: 1 180 | type: 2 181 | axis: 1 182 | joyNum: 0 183 | - serializedVersion: 3 184 | m_Name: Fire1 185 | descriptiveName: 186 | descriptiveNegativeName: 187 | negativeButton: 188 | positiveButton: joystick button 0 189 | altNegativeButton: 190 | altPositiveButton: 191 | gravity: 1000 192 | dead: .00100000005 193 | sensitivity: 1000 194 | snap: 0 195 | invert: 0 196 | type: 0 197 | axis: 0 198 | joyNum: 0 199 | - serializedVersion: 3 200 | m_Name: Fire2 201 | descriptiveName: 202 | descriptiveNegativeName: 203 | negativeButton: 204 | positiveButton: joystick button 1 205 | altNegativeButton: 206 | altPositiveButton: 207 | gravity: 1000 208 | dead: .00100000005 209 | sensitivity: 1000 210 | snap: 0 211 | invert: 0 212 | type: 0 213 | axis: 0 214 | joyNum: 0 215 | - serializedVersion: 3 216 | m_Name: Fire3 217 | descriptiveName: 218 | descriptiveNegativeName: 219 | negativeButton: 220 | positiveButton: joystick button 2 221 | altNegativeButton: 222 | altPositiveButton: 223 | gravity: 1000 224 | dead: .00100000005 225 | sensitivity: 1000 226 | snap: 0 227 | invert: 0 228 | type: 0 229 | axis: 0 230 | joyNum: 0 231 | - serializedVersion: 3 232 | m_Name: Jump 233 | descriptiveName: 234 | descriptiveNegativeName: 235 | negativeButton: 236 | positiveButton: joystick button 3 237 | altNegativeButton: 238 | altPositiveButton: 239 | gravity: 1000 240 | dead: .00100000005 241 | sensitivity: 1000 242 | snap: 0 243 | invert: 0 244 | type: 0 245 | axis: 0 246 | joyNum: 0 247 | -------------------------------------------------------------------------------- /Assets/testLevel.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | SceneSettings: 5 | m_ObjectHideFlags: 0 6 | m_PVSData: 7 | m_PVSObjectsArray: [] 8 | m_PVSPortalsArray: [] 9 | m_OcclusionBakeSettings: 10 | smallestOccluder: 5 11 | smallestHole: .25 12 | backfaceThreshold: 100 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 6 17 | m_Fog: 0 18 | m_FogColor: {r: .5, g: .5, b: .5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: .00999999978 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: .211999997, g: .226999998, b: .259000003, a: 1} 24 | m_AmbientEquatorColor: {r: .114, g: .125, b: .133000001, a: 1} 25 | m_AmbientGroundColor: {r: .0469999984, g: .0430000015, b: .0350000001, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SkyboxMaterial: {fileID: 0} 29 | m_HaloStrength: .5 30 | m_FlareStrength: 1 31 | m_FlareFadeSpeed: 3 32 | m_HaloTexture: {fileID: 0} 33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 34 | m_DefaultReflectionMode: 0 35 | m_DefaultReflectionResolution: 128 36 | m_ReflectionBounces: 1 37 | m_ReflectionIntensity: 1 38 | m_CustomReflection: {fileID: 0} 39 | m_Sun: {fileID: 0} 40 | --- !u!157 &3 41 | LightmapSettings: 42 | m_ObjectHideFlags: 0 43 | serializedVersion: 5 44 | m_GIWorkflowMode: 1 45 | m_LightmapsMode: 1 46 | m_GISettings: 47 | serializedVersion: 2 48 | m_BounceScale: 1 49 | m_IndirectOutputScale: 1 50 | m_AlbedoBoost: 1 51 | m_TemporalCoherenceThreshold: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 0 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 3 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_TextureWidth: 1024 60 | m_TextureHeight: 1024 61 | m_AOMaxDistance: 1 62 | m_Padding: 2 63 | m_CompAOExponent: 0 64 | m_LightmapParameters: {fileID: 0} 65 | m_TextureCompression: 1 66 | m_FinalGather: 0 67 | m_FinalGatherRayCount: 1024 68 | m_ReflectionCompression: 2 69 | m_LightmapSnapshot: {fileID: 0} 70 | m_RuntimeCPUUsage: 25 71 | --- !u!196 &4 72 | NavMeshSettings: 73 | serializedVersion: 2 74 | m_ObjectHideFlags: 0 75 | m_BuildSettings: 76 | serializedVersion: 2 77 | agentRadius: .5 78 | agentHeight: 2 79 | agentSlope: 45 80 | agentClimb: .400000006 81 | ledgeDropHeight: 0 82 | maxJumpAcrossDistance: 0 83 | accuratePlacement: 0 84 | minRegionArea: 2 85 | cellSize: .166666672 86 | manualCellSize: 0 87 | m_NavMeshData: {fileID: 0} 88 | --- !u!1 &511694006 89 | GameObject: 90 | m_ObjectHideFlags: 0 91 | m_PrefabParentObject: {fileID: 0} 92 | m_PrefabInternal: {fileID: 0} 93 | serializedVersion: 4 94 | m_Component: 95 | - 4: {fileID: 511694011} 96 | - 20: {fileID: 511694010} 97 | - 92: {fileID: 511694009} 98 | - 124: {fileID: 511694008} 99 | - 81: {fileID: 511694007} 100 | m_Layer: 0 101 | m_Name: Main Camera 102 | m_TagString: MainCamera 103 | m_Icon: {fileID: 0} 104 | m_NavMeshLayer: 0 105 | m_StaticEditorFlags: 0 106 | m_IsActive: 1 107 | --- !u!81 &511694007 108 | AudioListener: 109 | m_ObjectHideFlags: 0 110 | m_PrefabParentObject: {fileID: 0} 111 | m_PrefabInternal: {fileID: 0} 112 | m_GameObject: {fileID: 511694006} 113 | m_Enabled: 1 114 | --- !u!124 &511694008 115 | Behaviour: 116 | m_ObjectHideFlags: 0 117 | m_PrefabParentObject: {fileID: 0} 118 | m_PrefabInternal: {fileID: 0} 119 | m_GameObject: {fileID: 511694006} 120 | m_Enabled: 1 121 | --- !u!92 &511694009 122 | Behaviour: 123 | m_ObjectHideFlags: 0 124 | m_PrefabParentObject: {fileID: 0} 125 | m_PrefabInternal: {fileID: 0} 126 | m_GameObject: {fileID: 511694006} 127 | m_Enabled: 1 128 | --- !u!20 &511694010 129 | Camera: 130 | m_ObjectHideFlags: 0 131 | m_PrefabParentObject: {fileID: 0} 132 | m_PrefabInternal: {fileID: 0} 133 | m_GameObject: {fileID: 511694006} 134 | m_Enabled: 1 135 | serializedVersion: 2 136 | m_ClearFlags: 1 137 | m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} 138 | m_NormalizedViewPortRect: 139 | serializedVersion: 2 140 | x: 0 141 | y: 0 142 | width: 1 143 | height: 1 144 | near clip plane: .300000012 145 | far clip plane: 1000 146 | field of view: 60 147 | orthographic: 1 148 | orthographic size: 5 149 | m_Depth: -1 150 | m_CullingMask: 151 | serializedVersion: 2 152 | m_Bits: 4294967295 153 | m_RenderingPath: -1 154 | m_TargetTexture: {fileID: 0} 155 | m_TargetDisplay: 0 156 | m_TargetEye: 3 157 | m_HDR: 0 158 | m_OcclusionCulling: 1 159 | m_StereoConvergence: 10 160 | m_StereoSeparation: .0219999999 161 | m_StereoMirrorMode: 0 162 | --- !u!4 &511694011 163 | Transform: 164 | m_ObjectHideFlags: 0 165 | m_PrefabParentObject: {fileID: 0} 166 | m_PrefabInternal: {fileID: 0} 167 | m_GameObject: {fileID: 511694006} 168 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 169 | m_LocalPosition: {x: 0, y: 0, z: -10} 170 | m_LocalScale: {x: 1, y: 1, z: 1} 171 | m_Children: [] 172 | m_Father: {fileID: 0} 173 | m_RootOrder: 0 174 | --- !u!1 &832885927 175 | GameObject: 176 | m_ObjectHideFlags: 0 177 | m_PrefabParentObject: {fileID: 0} 178 | m_PrefabInternal: {fileID: 0} 179 | serializedVersion: 4 180 | m_Component: 181 | - 4: {fileID: 832885929} 182 | - 114: {fileID: 832885928} 183 | m_Layer: 0 184 | m_Name: Map 185 | m_TagString: Untagged 186 | m_Icon: {fileID: 0} 187 | m_NavMeshLayer: 0 188 | m_StaticEditorFlags: 0 189 | m_IsActive: 1 190 | --- !u!114 &832885928 191 | MonoBehaviour: 192 | m_ObjectHideFlags: 0 193 | m_PrefabParentObject: {fileID: 0} 194 | m_PrefabInternal: {fileID: 0} 195 | m_GameObject: {fileID: 832885927} 196 | m_Enabled: 1 197 | m_EditorHideFlags: 0 198 | m_Script: {fileID: 11500000, guid: 81df66ac2033afa4387be937639f57bb, type: 3} 199 | m_Name: 200 | m_EditorClassIdentifier: 201 | width: 6.78125 202 | height: 6.8125 203 | color: {r: 1, g: 1, b: 1, a: 1} 204 | tilePrefab: {fileID: 400002, guid: c1972405e3bb3454a8855ee9a032ecfd, type: 2} 205 | tileSet: {fileID: 11400000, guid: bd6eee83d1f32734e9f71bc21843b784, type: 2} 206 | draggable: 1 207 | --- !u!4 &832885929 208 | Transform: 209 | m_ObjectHideFlags: 0 210 | m_PrefabParentObject: {fileID: 0} 211 | m_PrefabInternal: {fileID: 0} 212 | m_GameObject: {fileID: 832885927} 213 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 214 | m_LocalPosition: {x: 0, y: 0, z: 0} 215 | m_LocalScale: {x: 1, y: 1, z: 1} 216 | m_Children: [] 217 | m_Father: {fileID: 0} 218 | m_RootOrder: 1 219 | -------------------------------------------------------------------------------- /Assets/Editor/GridEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | using System.Collections; 5 | using System.IO; 6 | 7 | [CustomEditor(typeof(Grid))] 8 | public class GridEditor : Editor { 9 | 10 | Grid grid; 11 | 12 | private int oldIndex = 0; 13 | 14 | private Vector3 mouseBeginPos; 15 | private Vector3 mouseEndPos; 16 | 17 | void OnEnable(){ 18 | grid = (Grid)target; 19 | } 20 | 21 | [MenuItem("Assets/Create/TileSet")] 22 | static void CreateTileSet(){ 23 | var asset = ScriptableObject.CreateInstance(); 24 | var path = AssetDatabase.GetAssetPath(Selection.activeObject); 25 | 26 | if(string.IsNullOrEmpty(path)){ 27 | path = "Assets"; 28 | }else if(Path.GetExtension(path) != ""){ 29 | path = path.Replace (Path.GetFileName(path),""); 30 | }else{ 31 | path+="/"; 32 | } 33 | 34 | var assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "TileSet.asset"); 35 | AssetDatabase.CreateAsset(asset,assetPathAndName); 36 | AssetDatabase.SaveAssets(); 37 | EditorUtility.FocusProjectWindow(); 38 | Selection.activeObject = asset; 39 | asset.hideFlags = HideFlags.DontSave; 40 | } 41 | 42 | public override void OnInspectorGUI(){ 43 | //base.OnInspectorGUI(); 44 | 45 | grid.width = createSlider("Width",grid.width); 46 | grid.height = createSlider("Height", grid.height); 47 | 48 | if(GUILayout.Button("Open Grid Window")){ 49 | GridWindow window = (GridWindow)EditorWindow.GetWindow (typeof(GridWindow)); 50 | window.init(); 51 | } 52 | 53 | // Tile Prefab 54 | EditorGUI.BeginChangeCheck(); 55 | var newTilePrefab = (Transform)EditorGUILayout.ObjectField("Tile Prefab",grid.tilePrefab,typeof(Transform),false); 56 | if(EditorGUI.EndChangeCheck()){ 57 | grid.tilePrefab = newTilePrefab; 58 | Undo.RecordObject(target,"Grid Changed"); 59 | } 60 | 61 | //Tile Map 62 | EditorGUI.BeginChangeCheck(); 63 | var newTileSet = (TileSet) EditorGUILayout.ObjectField("Tileset", grid.tileSet,typeof(TileSet),false); 64 | if(EditorGUI.EndChangeCheck()){ 65 | grid.tileSet = newTileSet; 66 | Undo.RecordObject(target,"Grid Changed"); 67 | } 68 | 69 | if(grid.tileSet != null){ 70 | EditorGUI.BeginChangeCheck(); 71 | var names = new string[grid.tileSet.prefabs.Length]; 72 | var values = new int[names.Length]; 73 | 74 | for(int i = 0; i < names.Length;i++){ 75 | names[i] = grid.tileSet.prefabs[i] != null ? grid.tileSet.prefabs[i].name : ""; 76 | values[i] = i; 77 | } 78 | 79 | var index = EditorGUILayout.IntPopup("Select Tile",oldIndex,names,values); 80 | 81 | if(EditorGUI.EndChangeCheck()){ 82 | Undo.RecordObject(target,"Grid Changed"); 83 | if(oldIndex != index){ 84 | oldIndex = index; 85 | grid.tilePrefab = grid.tileSet.prefabs[index]; 86 | 87 | float width = grid.tilePrefab.GetComponent().bounds.size.x; 88 | float height = grid.tilePrefab.GetComponent().bounds.size.y; 89 | 90 | grid.width = width; 91 | grid.height = height; 92 | 93 | } 94 | } 95 | } 96 | 97 | EditorGUI.BeginChangeCheck(); 98 | 99 | bool draggable = EditorGUILayout.Toggle ("Toggle Dragging: ", grid.draggable); 100 | if(EditorGUI.EndChangeCheck()){ 101 | grid.draggable = draggable; 102 | } 103 | } 104 | 105 | private float createSlider(string labelName, float sliderPosition){ 106 | GUILayout.BeginHorizontal(); 107 | GUILayout.Label ("Grid " + labelName); 108 | sliderPosition = EditorGUILayout.Slider(sliderPosition,1f,100f,null); 109 | GUILayout.EndHorizontal(); 110 | 111 | return sliderPosition; 112 | } 113 | 114 | void OnSceneGUI(){ 115 | int controlId = GUIUtility.GetControlID(FocusType.Passive); 116 | Event e = Event.current; 117 | Ray ray = Camera.current.ScreenPointToRay (new Vector3(e.mousePosition.x, -e.mousePosition.y + Camera.current.pixelHeight)); 118 | Vector3 mousePos = ray.origin; 119 | 120 | // create tile 121 | if(e.isMouse && e.type ==EventType.MouseDown && e.button == 0){ 122 | GUIUtility.hotControl = controlId; 123 | e.Use(); 124 | 125 | if(grid.draggable){ 126 | mouseBeginPos = mousePos; 127 | }else{ 128 | 129 | GameObject gameObject; 130 | Transform prefab = grid.tilePrefab; 131 | 132 | if(prefab){ 133 | Undo.IncrementCurrentGroup(); 134 | Vector3 aligned = new Vector3(Mathf.Floor (mousePos.x/grid.width) * grid.width + grid.width/2.0f,Mathf.Floor (mousePos.y/grid.height) * grid.height + grid.height/2.0f,0.0f); 135 | 136 | if(GetTransformFromPosition(aligned) != null) return; 137 | 138 | gameObject = (GameObject) PrefabUtility.InstantiatePrefab (prefab.gameObject); 139 | gameObject.transform.position = aligned; 140 | gameObject.transform.parent = grid.transform; 141 | 142 | Undo.RegisterCreatedObjectUndo(gameObject, " Create " + gameObject.name); 143 | } 144 | } 145 | } 146 | 147 | if(e.isMouse & e.type == EventType.MouseDown && (e.button == 0 || e.button == 1)){ 148 | GUIUtility.hotControl = controlId; 149 | e.Use(); 150 | Vector3 aligned = new Vector3(Mathf.Floor (mousePos.x/grid.width) * grid.width + grid.width/2.0f,Mathf.Floor (mousePos.y/grid.height) * grid.height + grid.height/2.0f,0.0f); 151 | Transform transform = GetTransformFromPosition(aligned); 152 | if(transform != null){ 153 | DestroyImmediate( transform.gameObject); 154 | } 155 | } 156 | 157 | if((e.isMouse && e.type == EventType.MouseUp && (e.button == 0 || e.button == 1))){ 158 | if(grid.draggable && e.button == 0){ 159 | mouseEndPos = mousePos; 160 | FillArea(mouseBeginPos, mouseEndPos); 161 | 162 | mouseEndPos = Vector3.zero; 163 | mouseBeginPos = Vector3.zero; 164 | } 165 | 166 | GUIUtility.hotControl = 0; 167 | } 168 | 169 | 170 | } 171 | 172 | 173 | Transform GetTransformFromPosition( Vector3 aligned){ 174 | 175 | int i = 0; 176 | while( i < grid.transform.childCount){ 177 | Transform transform = grid.transform.GetChild (i); 178 | if( transform.position == aligned){ 179 | return transform; 180 | } 181 | 182 | i++; 183 | } 184 | return null; 185 | } 186 | 187 | 188 | void FillArea(Vector3 _StartPosition, Vector3 _EndPosition){ 189 | 190 | Transform prefab = grid.tilePrefab; 191 | if(prefab == null){ 192 | Debug.LogError("No prefab attached to grid."); 193 | } 194 | 195 | // contains the number of tiles to the real start position, this means we begin in (0,0,0).... our value might be (2.0f,1.0f) then we begin at the position = 0 + 2.0f * grid.width 196 | Vector2 numberOfTilesToStartPosition = new Vector2(); 197 | Vector2 numberOfTilesToEndPosition = new Vector2(); 198 | 199 | Vector2 tilesToFill = new Vector2(); 200 | _StartPosition.x = Mathf.Floor(_StartPosition.x /grid.width) * grid.width; 201 | _StartPosition.y = Mathf.Floor(_StartPosition.y /grid.height) * grid.height; 202 | 203 | _EndPosition.x = Mathf.Floor(_EndPosition.x /grid.width) * grid.width; 204 | _EndPosition.y = Mathf.Floor(_EndPosition.y /grid.height) * grid.height ; 205 | 206 | Vector2 numberOfTilesToFill = new Vector2(); 207 | 208 | 209 | // look if there is a drag from right to left or bottom to top 210 | // if so swap entries 211 | if(_StartPosition.x > _EndPosition.x){ 212 | numberOfTilesToFill.x = _StartPosition.x - _EndPosition.x; 213 | }else{ 214 | numberOfTilesToFill.x = _EndPosition.x - _StartPosition.x; 215 | } 216 | 217 | if(_StartPosition.y > _EndPosition.y){ 218 | numberOfTilesToFill.y = _StartPosition.y - _EndPosition.y; 219 | }else{ 220 | numberOfTilesToFill.y = _EndPosition.y - _StartPosition.y; 221 | } 222 | 223 | // swap to fill from left to right 224 | if(_StartPosition.x >= _EndPosition.x){ 225 | Vector3 tmp = new Vector3(); 226 | tmp = _EndPosition; 227 | _StartPosition = _EndPosition; 228 | _EndPosition = tmp; 229 | } 230 | 231 | numberOfTilesToFill.x = numberOfTilesToFill.x / grid.width + 1.0f; 232 | numberOfTilesToFill.y = numberOfTilesToFill.y / grid.height + 1.0f; 233 | // save them 234 | int currentXTileNumber = 0; 235 | int currentYTileNumber = 0; 236 | 237 | 238 | do{ 239 | currentYTileNumber = 0; 240 | do{ 241 | 242 | Vector3 realWorldPosition = new Vector3(); 243 | GameObject gameObject; 244 | 245 | realWorldPosition.x = _StartPosition.x + (currentXTileNumber * grid.width) + grid.width / 2.0f; 246 | realWorldPosition.y = _StartPosition.y - (currentYTileNumber * grid.height) + grid.height / 2.0f; 247 | realWorldPosition.z = 0.0f; 248 | // if(GetTransformFromPosition(realWorldPosition) != null) continue; 249 | 250 | gameObject = (GameObject) PrefabUtility.InstantiatePrefab (prefab.gameObject); 251 | gameObject.transform.position = realWorldPosition; 252 | gameObject.transform.parent = grid.transform; 253 | 254 | 255 | ++currentYTileNumber; 256 | }while(currentYTileNumber < numberOfTilesToFill.y); 257 | 258 | ++ currentXTileNumber; 259 | }while(currentXTileNumber < numberOfTilesToFill.x); 260 | 261 | } 262 | 263 | // void FillArea(Vector3 beginPos, Vector3 endPos){ 264 | // int negX = 1; 265 | // int negY = 1; 266 | // int modX = 0; 267 | // int modY = 0; 268 | // 269 | // Vector3 beginChunks = new Vector3(Mathf.Floor (beginPos.x/grid.width) ,Mathf.Floor (beginPos.y/grid.height) ,0.0f); 270 | // Vector3 endChunks = new Vector3(Mathf.Floor (endPos.x/grid.width) ,Mathf.Floor (endPos.y/grid.height) ,0.0f); 271 | // 272 | // Vector3 beginChunk = new Vector3(Mathf.Floor (beginPos.x/grid.width),Mathf.Floor (beginPos.y/grid.height) ,0.0f); 273 | // 274 | // Vector3 tilesToDraw = endChunks - beginChunks; 275 | // 276 | // int x = (int)tilesToDraw.x; // +1 because of first tile is 0 277 | // int y = (int)tilesToDraw.y; 278 | // 279 | // if(x < 0) { 280 | // negX = -1; 281 | // x = (-1)*(x-1); 282 | // modX = -1; 283 | // }else{ 284 | // x = x+1; 285 | // } 286 | // if(y < 0) 287 | // { 288 | // negY = -1; 289 | // y = (-1)*(y-1); 290 | // modY = -1; 291 | // }else{ 292 | // y = y + 1; 293 | // } 294 | // 295 | // Debug.Log ("x " + x + " " + y); 296 | // Transform prefab = grid.tilePrefab; 297 | // // Undo.IncrementCurrentGroup(); 298 | // Vector3 aligned = new Vector3(); 299 | // 300 | // 301 | // for(int i = 0; i< x; i++){ 302 | // 303 | // Debug.Log (i); 304 | // aligned.x = (i+modX)*grid.width*negX+(beginChunk.x*grid.width) +grid.width*negX/2; 305 | // for(int j =0; j