├── .gitattributes ├── .gitignore ├── HexGridManager.unitypackage ├── README.md └── SampleProject ├── Assembly-CSharp-Editor-vs.csproj ├── Assembly-CSharp-Editor.csproj ├── Assembly-CSharp-vs.csproj ├── Assembly-CSharp.csproj ├── Assembly-UnityScript-vs.unityproj ├── Assembly-UnityScript.unityproj ├── Assets ├── Character.prefab ├── Character.prefab.meta ├── HexGridManager.meta ├── HexGridManager │ ├── DebugVisuals.meta │ ├── DebugVisuals │ │ ├── Materials.meta │ │ ├── Materials │ │ │ ├── HexMaterialDestination.mat │ │ │ ├── HexMaterialDestination.mat.meta │ │ │ ├── HexMaterialOccupied.mat │ │ │ ├── HexMaterialOccupied.mat.meta │ │ │ ├── HexMaterialVacant.mat │ │ │ └── HexMaterialVacant.mat.meta │ │ ├── Prefabs.meta │ │ ├── Prefabs │ │ │ ├── HexagonDestination.prefab │ │ │ ├── HexagonDestination.prefab.meta │ │ │ ├── HexagonOccupied.prefab │ │ │ ├── HexagonOccupied.prefab.meta │ │ │ ├── HexagonVacant.prefab │ │ │ └── HexagonVacant.prefab.meta │ │ ├── Scripts.meta │ │ ├── Scripts │ │ │ ├── Hex.cs │ │ │ ├── Hex.cs.meta │ │ │ ├── HexModel.cs │ │ │ └── HexModel.cs.meta │ │ ├── Shaders.meta │ │ └── Shaders │ │ │ ├── HexShader.shader │ │ │ └── HexShader.shader.meta │ ├── Editor.meta │ ├── Editor │ │ ├── HexGridManagerEditor.cs │ │ └── HexGridManagerEditor.cs.meta │ ├── HexGridManager.cs │ └── HexGridManager.cs.meta ├── Materials.meta ├── Materials │ ├── Floor.mat │ └── Floor.mat.meta ├── RandomMovement.meta ├── RandomMovement.unity ├── RandomMovement.unity.meta ├── RandomMovement │ ├── NavMesh.asset │ └── NavMesh.asset.meta ├── Scripts.meta ├── Scripts │ ├── CharacterAdder.cs │ ├── CharacterAdder.cs.meta │ ├── RandomMover.cs │ ├── RandomMover.cs.meta │ ├── SwarmTarget.cs │ ├── SwarmTarget.cs.meta │ ├── Swarmer.cs │ └── Swarmer.cs.meta ├── SwarmTarget.prefab ├── SwarmTarget.prefab.meta ├── Swarmer.prefab ├── Swarmer.prefab.meta ├── Swarming.meta ├── Swarming.unity ├── Swarming.unity.meta ├── Swarming │ ├── NavMesh.asset │ └── NavMesh.asset.meta ├── Textures.meta └── Textures │ ├── White.png │ └── White.png.meta ├── GridMesh-csharp.sln ├── GridMesh.sln ├── GridMesh.userprefs ├── NavMeshTest-csharp.sln ├── NavMeshTest-csharp.userprefs ├── NavMeshTest.sln ├── NavMeshTest.userprefs ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NavMeshLayers.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityAdsSettings.asset └── UnityConnectSettings.asset ├── SampleProject-csharp.sln ├── SampleProject.sln └── SampleProject.userprefs /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | Library 19 | Temp 20 | 21 | # External tool builders 22 | .externalToolBuilders/ 23 | 24 | # Locally stored "Eclipse launch configurations" 25 | *.launch 26 | 27 | # CDT-specific 28 | .cproject 29 | 30 | # PDT-specific 31 | .buildpath 32 | 33 | 34 | ################# 35 | ## Visual Studio 36 | ################# 37 | 38 | ## Ignore Visual Studio temporary files, build results, and 39 | ## files generated by popular Visual Studio add-ons. 40 | 41 | # User-specific files 42 | *.suo 43 | *.user 44 | *.sln.docstates 45 | 46 | # Build results 47 | 48 | [Dd]ebug/ 49 | [Rr]elease/ 50 | x64/ 51 | build/ 52 | [Bb]in/ 53 | [Oo]bj/ 54 | 55 | # MSTest test Results 56 | [Tt]est[Rr]esult*/ 57 | [Bb]uild[Ll]og.* 58 | 59 | *_i.c 60 | *_p.c 61 | *.ilk 62 | *.obj 63 | *.pch 64 | *.pdb 65 | *.pgc 66 | *.pgd 67 | *.rsp 68 | *.sbr 69 | *.tlb 70 | *.tli 71 | *.tlh 72 | *.tmp 73 | *.tmp_proj 74 | *.log 75 | *.vspscc 76 | *.vssscc 77 | .builds 78 | *.pidb 79 | *.log 80 | *.scc 81 | 82 | # Visual C++ cache files 83 | ipch/ 84 | *.aps 85 | *.ncb 86 | *.opensdf 87 | *.sdf 88 | *.cachefile 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | 102 | # TeamCity is a build add-in 103 | _TeamCity* 104 | 105 | # DotCover is a Code Coverage Tool 106 | *.dotCover 107 | 108 | # NCrunch 109 | *.ncrunch* 110 | .*crunch*.local.xml 111 | 112 | # Installshield output folder 113 | [Ee]xpress/ 114 | 115 | # DocProject is a documentation generator add-in 116 | DocProject/buildhelp/ 117 | DocProject/Help/*.HxT 118 | DocProject/Help/*.HxC 119 | DocProject/Help/*.hhc 120 | DocProject/Help/*.hhk 121 | DocProject/Help/*.hhp 122 | DocProject/Help/Html2 123 | DocProject/Help/html 124 | 125 | # Click-Once directory 126 | publish/ 127 | 128 | # Publish Web Output 129 | *.Publish.xml 130 | *.pubxml 131 | 132 | # NuGet Packages Directory 133 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 134 | #packages/ 135 | 136 | # Windows Azure Build Output 137 | csx 138 | *.build.csdef 139 | 140 | # Windows Store app package directory 141 | AppPackages/ 142 | 143 | # Others 144 | sql/ 145 | *.Cache 146 | ClientBin/ 147 | [Ss]tyle[Cc]op.* 148 | ~$* 149 | *~ 150 | *.dbmdl 151 | *.[Pp]ublish.xml 152 | *.pfx 153 | *.publishsettings 154 | 155 | # RIA/Silverlight projects 156 | Generated_Code/ 157 | 158 | # Backup & report files from converting an old project file to a newer 159 | # Visual Studio version. Backup files are not needed, because we have git ;-) 160 | _UpgradeReport_Files/ 161 | Backup*/ 162 | UpgradeLog*.XML 163 | UpgradeLog*.htm 164 | 165 | # SQL Server files 166 | App_Data/*.mdf 167 | App_Data/*.ldf 168 | 169 | ############# 170 | ## Windows detritus 171 | ############# 172 | 173 | # Windows image file caches 174 | Thumbs.db 175 | ehthumbs.db 176 | 177 | # Folder config file 178 | Desktop.ini 179 | 180 | # Recycle Bin used on file shares 181 | $RECYCLE.BIN/ 182 | 183 | # Mac crap 184 | .DS_Store 185 | 186 | 187 | ############# 188 | ## Python 189 | ############# 190 | 191 | *.py[co] 192 | 193 | # Packages 194 | *.egg 195 | *.egg-info 196 | dist/ 197 | build/ 198 | eggs/ 199 | parts/ 200 | var/ 201 | sdist/ 202 | develop-eggs/ 203 | .installed.cfg 204 | 205 | # Installer logs 206 | pip-log.txt 207 | 208 | # Unit test / coverage reports 209 | .coverage 210 | .tox 211 | 212 | #Translations 213 | *.mo 214 | 215 | #Mr Developer 216 | .mr.developer.cfg 217 | -------------------------------------------------------------------------------- /HexGridManager.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jconstable/HexGridManager/2a8abd328ddb68eaa670530942e052cf9bd49ad1/HexGridManager.unitypackage -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | HexGridManager 2 | ============== 3 | 4 | Create a logical hex grid on top of Unity's NavMesh. 5 | 6 | 7 | The problem: 8 | 9 | Unity's NavMesh is great for quickly adding locomotion to GameObjects, and Unity's NavMesh creation tool is 10 | extremely easy to use. However, in practice, if you have a lot of NavAgents in a scene and start seeing odd 11 | behavior, you have three options: 12 | 13 | 1) Increase the NavAgent radius, which will slow the game down and create strange behavior if destinations 14 | are too close to one another 15 | 16 | 2) Reduce the NavAgent radius and have objects end up stacking on top of each other 17 | 18 | 3) Use another pathfinding solution, which is probably written in C# and not as fast as Unity's C++ solution 19 | 20 | 21 | A solution: 22 | 23 | I created this HexGridManager as a lightweight way give GameObjects destinations that result in less stacking 24 | up, without affecting pathfinding. The main use case is to find locations on the nav mesh that are near, or next 25 | to, a target, and have some level of confidence that the area will not be too close to other such objects. 26 | 27 | For my use case, it's ok if objects path relatively close to one another, but not ok if they end up standing on 28 | top of each other. 29 | 30 | 31 | How to use this: 32 | 33 | The size of the hex unit is configurable, and the hex map can (and should) be pre-baked into the scene, avoiding the 34 | cost at runtime. 35 | 36 | The basic concept is that for any given GameObject, you can create an Occupant within the manager. The occupant maps 37 | the GameObject's position to a logical hex grid on the NavMesh. The Occupant can also be given a radius, in order to occupy an area on the map that is greater than one hex. 38 | 39 | If a GameObject would like to path to a location next to another GameObject, the HexGridManager can be queried for a 40 | vacant neighboring hex, which could be used as the NavAgent's destination. 41 | 42 | Whenever an Occupant detects that its GameObject has moved to a new grid hex, the GameObject is sent the 43 | "OnGridChanged" message, allowing it to take action. 44 | 45 | 46 | What's here? 47 | 48 | A ready-to-use UnityPackage. 49 | 50 | Also, this repo contains a sample project with the source code and two scenes: 51 | 52 | 1) RandomMovement - a basic demo of many navigating GameObjects and what the grid map looks like as they path around 53 | 54 | 2) Swarming - a target GameObject is swarmed by many other objects. 55 | 56 | 57 | 58 | Special thanks to this blog post by Red Blob Games for excellent hex math: 59 | http://www.redblobgames.com/grids/hexagons/ 60 | 61 | And to Baran Kahyaoglu for sample code to generate hex meshes on the fly (for debug visuals) 62 | http://www.barankahyaoglu.com/blog/post/2013/07/26/Hexagons-in-Unity.aspx 63 | 64 | TODO: 65 | - Functions to return grid distance between two points 66 | - Function to return best possible grid paths between two points 67 | 68 | -------------------------------------------------------------------------------- /SampleProject/Assembly-CSharp-Editor-vs.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14} 9 | Library 10 | Properties 11 | 12 | Assembly-CSharp-Editor 13 | v3.5 14 | 512 15 | Assets 16 | 17 | 18 | true 19 | full 20 | false 21 | Temp\bin\Debug\ 22 | DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_4;UNITY_4_3;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE 23 | prompt 24 | 4 25 | 0169 26 | 27 | 28 | pdbonly 29 | true 30 | Temp\bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 0169 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll 43 | 44 | 45 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.Graphs.dll 53 | 54 | 55 | C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\iPhonePlayer\EditorExtensions\UnityEditor.iOS.Extensions.dll 56 | 57 | 58 | C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WP8Support\EditorExtensions\UnityEditor.WP8.Extensions.dll 59 | 60 | 61 | C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\MetroSupport\EditorExtensions\UnityEditor.Metro.Extensions.dll 62 | 63 | 64 | C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\BB10Player\EditorExtensions\UnityEditor.BB10.Extensions.dll 65 | 66 | 67 | C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\EditorExtensions\UnityEditor.Android.Extensions.dll 68 | 69 | 70 | 71 | 72 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7} Assembly-CSharp-vs 73 | 74 | 75 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /SampleProject/Assembly-CSharp-Editor.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | 9 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14} 10 | Library 11 | Properties 12 | Assembly-CSharp-Editor 13 | v3.5 14 | 512 15 | Assets 16 | 17 | 18 | true 19 | full 20 | false 21 | Temp\bin\Debug\ 22 | DEBUG;TRACE;UNITY_5_3_0;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE 23 | prompt 24 | 4 25 | 0169 26 | 27 | 28 | pdbonly 29 | true 30 | Temp\bin\Release\ 31 | prompt 32 | 4 33 | 0169 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | /Applications/Unity5/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll 42 | 43 | 44 | /Applications/Unity5/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll 52 | 53 | 54 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/EditorTestsRunner/Editor/nunit.framework.dll 55 | 56 | 57 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/EditorTestsRunner/Editor/UnityEditor.EditorTestsRunner.dll 58 | 59 | 60 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll 61 | 62 | 63 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll 64 | 65 | 66 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll 67 | 68 | 69 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll 70 | 71 | 72 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/TreeEditor/Editor/UnityEditor.TreeEditor.dll 73 | 74 | 75 | /Applications/Unity5/Unity.app/Contents/Frameworks/Managed/UnityEditor.Graphs.dll 76 | 77 | 78 | /Applications/Unity5/PlaybackEngines/AndroidPlayer/UnityEditor.Android.Extensions.dll 79 | 80 | 81 | /Applications/Unity5/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll 82 | 83 | 84 | /Applications/Unity5/PlaybackEngines/MacStandaloneSupport/UnityEditor.OSXStandalone.Extensions.dll 85 | 86 | 87 | /Applications/Unity5/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll 88 | 89 | 90 | 91 | 92 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7} Assembly-CSharp 93 | 94 | 95 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /SampleProject/Assembly-CSharp-vs.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7} 9 | Library 10 | Properties 11 | 12 | Assembly-CSharp 13 | v3.5 14 | 512 15 | Assets 16 | 17 | 18 | true 19 | full 20 | false 21 | Temp\bin\Debug\ 22 | DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_4;UNITY_4_3;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE 23 | prompt 24 | 4 25 | 0169 26 | 27 | 28 | pdbonly 29 | true 30 | Temp\bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 0169 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll 43 | 44 | 45 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /SampleProject/Assembly-CSharp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | 9 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7} 10 | Library 11 | Properties 12 | Assembly-CSharp 13 | v3.5 14 | 512 15 | Assets 16 | 17 | 18 | true 19 | full 20 | false 21 | Temp\bin\Debug\ 22 | DEBUG;TRACE;UNITY_5_3_0;UNITY_5_3;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_LOG_MIXED_STACKTRACE;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE 23 | prompt 24 | 4 25 | 0169 26 | 27 | 28 | pdbonly 29 | true 30 | Temp\bin\Release\ 31 | prompt 32 | 4 33 | 0169 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | /Applications/Unity5/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll 42 | 43 | 44 | /Applications/Unity5/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll 58 | 59 | 60 | /Applications/Unity5/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll 61 | 62 | 63 | /Applications/Unity5/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll 64 | 65 | 66 | 67 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /SampleProject/Assembly-UnityScript-vs.unityproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | {32D28C67-FD2F-E630-0605-914F33CE5F3F} 9 | Library 10 | Properties 11 | 12 | Assembly-UnityScript 13 | v3.5 14 | 512 15 | Assets 16 | 17 | 18 | true 19 | full 20 | false 21 | Temp\bin\Debug\ 22 | DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_4;UNITY_4_3;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE 23 | prompt 24 | 4 25 | 0169 26 | 27 | 28 | pdbonly 29 | true 30 | Temp\bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 0169 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll 43 | 44 | 45 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /SampleProject/Assembly-UnityScript.unityproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | {32D28C67-FD2F-E630-0605-914F33CE5F3F} 9 | Library 10 | Properties 11 | 12 | Assembly-UnityScript 13 | v3.5 14 | 512 15 | Assets 16 | 17 | 18 | true 19 | full 20 | false 21 | Temp\bin\Debug\ 22 | DEBUG;TRACE;UNITY_STANDALONE_WIN;ENABLE_MICROPHONE;ENABLE_TEXTUREID_MAP;ENABLE_AUDIO_FMOD;UNITY_STANDALONE;ENABLE_MONO;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_GENERICS;ENABLE_SUBSTANCE;INCLUDE_WP8SUPPORT;ENABLE_MOVIES;ENABLE_WWW;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;INCLUDE_METROSUPPORT;RENDER_SOFTWARE_CURSOR;ENABLE_NETWORK;ENABLE_PHYSICS;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_2D_PHYSICS;ENABLE_SHADOWS;ENABLE_AUDIO;ENABLE_NAVMESH_CARVING;ENABLE_DUCK_TYPING;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;UNITY_4_3_4;UNITY_4_3;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE 23 | prompt 24 | 4 25 | 0169 26 | 27 | 28 | pdbonly 29 | true 30 | Temp\bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 0169 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEngine.dll 43 | 44 | 45 | C:/Program Files (x86)/Unity/Editor/Data/Managed/UnityEditor.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /SampleProject/Assets/Character.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 | - 195: {fileID: 19500000} 12 | - 114: {fileID: 11400000} 13 | m_Layer: 0 14 | m_Name: Character 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!1 &100002 21 | GameObject: 22 | m_ObjectHideFlags: 0 23 | m_PrefabParentObject: {fileID: 0} 24 | m_PrefabInternal: {fileID: 100100000} 25 | serializedVersion: 4 26 | m_Component: 27 | - 4: {fileID: 400002} 28 | - 33: {fileID: 3300000} 29 | - 136: {fileID: 13600000} 30 | - 23: {fileID: 2300000} 31 | m_Layer: 0 32 | m_Name: 3d Mesh 33 | m_TagString: Untagged 34 | m_Icon: {fileID: 0} 35 | m_NavMeshLayer: 0 36 | m_StaticEditorFlags: 0 37 | m_IsActive: 1 38 | --- !u!4 &400000 39 | Transform: 40 | m_ObjectHideFlags: 1 41 | m_PrefabParentObject: {fileID: 0} 42 | m_PrefabInternal: {fileID: 100100000} 43 | m_GameObject: {fileID: 100000} 44 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 45 | m_LocalPosition: {x: 7.26547813, y: 6.67967015e-08, z: -2.1795826} 46 | m_LocalScale: {x: 1, y: 1, z: 1} 47 | m_Children: 48 | - {fileID: 400002} 49 | m_Father: {fileID: 0} 50 | --- !u!4 &400002 51 | Transform: 52 | m_ObjectHideFlags: 1 53 | m_PrefabParentObject: {fileID: 0} 54 | m_PrefabInternal: {fileID: 100100000} 55 | m_GameObject: {fileID: 100002} 56 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 57 | m_LocalPosition: {x: 0, y: 0, z: 0} 58 | m_LocalScale: {x: 1, y: 1, z: 1} 59 | m_Children: [] 60 | m_Father: {fileID: 400000} 61 | --- !u!23 &2300000 62 | Renderer: 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_CastShadows: 1 69 | m_ReceiveShadows: 1 70 | m_LightmapIndex: 255 71 | m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} 72 | m_Materials: 73 | - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} 74 | m_SubsetIndices: 75 | m_StaticBatchRoot: {fileID: 0} 76 | m_UseLightProbes: 0 77 | m_LightProbeAnchor: {fileID: 0} 78 | m_ScaleInLightmap: 1 79 | m_SortingLayer: 0 80 | m_SortingOrder: 0 81 | m_SortingLayerID: 0 82 | --- !u!33 &3300000 83 | MeshFilter: 84 | m_ObjectHideFlags: 1 85 | m_PrefabParentObject: {fileID: 0} 86 | m_PrefabInternal: {fileID: 100100000} 87 | m_GameObject: {fileID: 100002} 88 | m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} 89 | --- !u!114 &11400000 90 | MonoBehaviour: 91 | m_ObjectHideFlags: 1 92 | m_PrefabParentObject: {fileID: 0} 93 | m_PrefabInternal: {fileID: 100100000} 94 | m_GameObject: {fileID: 100000} 95 | m_Enabled: 1 96 | m_EditorHideFlags: 0 97 | m_Script: {fileID: 11500000, guid: bcacd37bfd4df5645b2a7613a79fc51d, type: 3} 98 | m_Name: 99 | m_EditorClassIdentifier: 100 | roam: 1 101 | --- !u!136 &13600000 102 | CapsuleCollider: 103 | m_ObjectHideFlags: 1 104 | m_PrefabParentObject: {fileID: 0} 105 | m_PrefabInternal: {fileID: 100100000} 106 | m_GameObject: {fileID: 100002} 107 | m_Material: {fileID: 0} 108 | m_IsTrigger: 0 109 | m_Enabled: 0 110 | m_Radius: .5 111 | m_Height: 2 112 | m_Direction: 1 113 | m_Center: {x: 0, y: 0, z: 0} 114 | --- !u!195 &19500000 115 | NavMeshAgent: 116 | m_ObjectHideFlags: 1 117 | m_PrefabParentObject: {fileID: 0} 118 | m_PrefabInternal: {fileID: 100100000} 119 | m_GameObject: {fileID: 100000} 120 | m_Enabled: 1 121 | m_Radius: .25 122 | m_Speed: 3.5 123 | m_Acceleration: 8 124 | avoidancePriority: 50 125 | m_AngularSpeed: 2 126 | m_StoppingDistance: 0 127 | m_AutoTraverseOffMeshLink: 1 128 | m_AutoBraking: 1 129 | m_AutoRepath: 1 130 | m_Height: 2 131 | m_BaseOffset: 1 132 | m_WalkableMask: 4294967295 133 | m_ObstacleAvoidanceType: 4 134 | --- !u!1001 &100100000 135 | Prefab: 136 | m_ObjectHideFlags: 1 137 | serializedVersion: 2 138 | m_Modification: 139 | m_TransformParent: {fileID: 0} 140 | m_Modifications: [] 141 | m_RemovedComponents: [] 142 | m_ParentPrefab: {fileID: 0} 143 | m_RootGameObject: {fileID: 100000} 144 | m_IsPrefabParent: 1 145 | m_IsExploded: 1 146 | -------------------------------------------------------------------------------- /SampleProject/Assets/Character.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58013f33ca29a454a912cacd9feb4f71 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f676dcbd33506547b3967312e498f9b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79c5a8da5182092429c192b3ee44339e 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07e1e8bc82752bb4bbb844f31df5d00d 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Materials/HexMaterialDestination.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 3 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: HexMaterialDestination 10 | m_Shader: {fileID: 4800000, guid: 53bffd6822aa1ab42a89abb2f623af9e, type: 3} 11 | m_ShaderKeywords: [] 12 | m_CustomRenderQueue: -1 13 | m_SavedProperties: 14 | serializedVersion: 2 15 | m_TexEnvs: 16 | data: 17 | first: 18 | name: _MainTex 19 | second: 20 | m_Texture: {fileID: 0} 21 | m_Scale: {x: 1, y: 1} 22 | m_Offset: {x: 0, y: 0} 23 | m_Floats: 24 | data: 25 | first: 26 | name: _Dropoff 27 | second: .870000005 28 | data: 29 | first: 30 | name: _Gain 31 | second: 8.06000042 32 | m_Colors: 33 | data: 34 | first: 35 | name: _Color 36 | second: {r: .159602076, g: .904411793, b: .442116112, a: 0} 37 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Materials/HexMaterialDestination.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56685ef15dd0e87478e83ef88e84e18b 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Materials/HexMaterialOccupied.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 3 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: HexMaterialOccupied 10 | m_Shader: {fileID: 4800000, guid: 53bffd6822aa1ab42a89abb2f623af9e, type: 3} 11 | m_ShaderKeywords: [] 12 | m_CustomRenderQueue: -1 13 | m_SavedProperties: 14 | serializedVersion: 2 15 | m_TexEnvs: 16 | data: 17 | first: 18 | name: _MainTex 19 | second: 20 | m_Texture: {fileID: 0} 21 | m_Scale: {x: 1, y: 1} 22 | m_Offset: {x: 0, y: 0} 23 | m_Floats: 24 | data: 25 | first: 26 | name: _Dropoff 27 | second: .870000005 28 | data: 29 | first: 30 | name: _Gain 31 | second: 8.06000042 32 | m_Colors: 33 | data: 34 | first: 35 | name: _Color 36 | second: {r: 1, g: 0, b: 0, a: 0} 37 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Materials/HexMaterialOccupied.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99a19bba497b1e34593a4c1e61db3e16 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Materials/HexMaterialVacant.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 3 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: HexMaterialVacant 10 | m_Shader: {fileID: 4800000, guid: 53bffd6822aa1ab42a89abb2f623af9e, type: 3} 11 | m_ShaderKeywords: [] 12 | m_CustomRenderQueue: -1 13 | m_SavedProperties: 14 | serializedVersion: 2 15 | m_TexEnvs: 16 | data: 17 | first: 18 | name: _MainTex 19 | second: 20 | m_Texture: {fileID: 0} 21 | m_Scale: {x: 1, y: 1} 22 | m_Offset: {x: 0, y: 0} 23 | m_Floats: 24 | data: 25 | first: 26 | name: _Dropoff 27 | second: .870000005 28 | data: 29 | first: 30 | name: _Gain 31 | second: 8.06000042 32 | m_Colors: 33 | data: 34 | first: 35 | name: _Color 36 | second: {r: .408953309, g: .715281427, b: .897058845, a: 0} 37 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Materials/HexMaterialVacant.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8a9941353136f744975806ac75922aa 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbbdd1a05affc994d8c368467beff988 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Prefabs/HexagonDestination.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 | - 114: {fileID: 11400002} 12 | m_Layer: 0 13 | m_Name: HexagonDestination 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &400000 20 | Transform: 21 | m_ObjectHideFlags: 1 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | m_GameObject: {fileID: 100000} 25 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 26 | m_LocalPosition: {x: 0, y: 2, z: 0} 27 | m_LocalScale: {x: 1, y: 1, z: 1} 28 | m_Children: [] 29 | m_Father: {fileID: 0} 30 | --- !u!114 &11400002 31 | MonoBehaviour: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 100000} 36 | m_Enabled: 1 37 | m_EditorHideFlags: 0 38 | m_Script: {fileID: 11500000, guid: 151fb9107d82765449ab7100da7f4f30, type: 3} 39 | m_Name: 40 | m_EditorClassIdentifier: 41 | HexPosition: {x: 0, y: 0} 42 | MaterialToUse: {fileID: 2100000, guid: 56685ef15dd0e87478e83ef88e84e18b, type: 2} 43 | GridSize: 1 44 | --- !u!1001 &100100000 45 | Prefab: 46 | m_ObjectHideFlags: 1 47 | serializedVersion: 2 48 | m_Modification: 49 | m_TransformParent: {fileID: 0} 50 | m_Modifications: [] 51 | m_RemovedComponents: [] 52 | m_ParentPrefab: {fileID: 0} 53 | m_RootGameObject: {fileID: 100000} 54 | m_IsPrefabParent: 1 55 | m_IsExploded: 1 56 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Prefabs/HexagonDestination.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 785663b3d9d069c49bd411115e100e64 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Prefabs/HexagonOccupied.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 | - 114: {fileID: 11400002} 12 | m_Layer: 0 13 | m_Name: HexagonOccupied 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &400000 20 | Transform: 21 | m_ObjectHideFlags: 1 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | m_GameObject: {fileID: 100000} 25 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 26 | m_LocalPosition: {x: 0, y: 2, z: 0} 27 | m_LocalScale: {x: 1, y: 1, z: 1} 28 | m_Children: [] 29 | m_Father: {fileID: 0} 30 | --- !u!114 &11400002 31 | MonoBehaviour: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 100000} 36 | m_Enabled: 1 37 | m_EditorHideFlags: 0 38 | m_Script: {fileID: 11500000, guid: 151fb9107d82765449ab7100da7f4f30, type: 3} 39 | m_Name: 40 | m_EditorClassIdentifier: 41 | HexPosition: {x: 0, y: 0} 42 | MaterialToUse: {fileID: 2100000, guid: 99a19bba497b1e34593a4c1e61db3e16, type: 2} 43 | GridSize: 1 44 | --- !u!1001 &100100000 45 | Prefab: 46 | m_ObjectHideFlags: 1 47 | serializedVersion: 2 48 | m_Modification: 49 | m_TransformParent: {fileID: 0} 50 | m_Modifications: [] 51 | m_RemovedComponents: [] 52 | m_ParentPrefab: {fileID: 0} 53 | m_RootGameObject: {fileID: 100000} 54 | m_IsPrefabParent: 1 55 | m_IsExploded: 1 56 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Prefabs/HexagonOccupied.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 239da92ed069c4c4ba50102e7b83fd21 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Prefabs/HexagonVacant.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 | - 114: {fileID: 11400002} 12 | m_Layer: 0 13 | m_Name: HexagonVacant 14 | m_TagString: Untagged 15 | m_Icon: {fileID: 0} 16 | m_NavMeshLayer: 0 17 | m_StaticEditorFlags: 0 18 | m_IsActive: 1 19 | --- !u!4 &400000 20 | Transform: 21 | m_ObjectHideFlags: 1 22 | m_PrefabParentObject: {fileID: 0} 23 | m_PrefabInternal: {fileID: 100100000} 24 | m_GameObject: {fileID: 100000} 25 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 26 | m_LocalPosition: {x: 0, y: 2, z: 0} 27 | m_LocalScale: {x: 1, y: 1, z: 1} 28 | m_Children: [] 29 | m_Father: {fileID: 0} 30 | --- !u!114 &11400002 31 | MonoBehaviour: 32 | m_ObjectHideFlags: 1 33 | m_PrefabParentObject: {fileID: 0} 34 | m_PrefabInternal: {fileID: 100100000} 35 | m_GameObject: {fileID: 100000} 36 | m_Enabled: 1 37 | m_EditorHideFlags: 0 38 | m_Script: {fileID: 11500000, guid: 151fb9107d82765449ab7100da7f4f30, type: 3} 39 | m_Name: 40 | m_EditorClassIdentifier: 41 | HexPosition: {x: 0, y: 0} 42 | MaterialToUse: {fileID: 2100000, guid: f8a9941353136f744975806ac75922aa, type: 2} 43 | GridSize: 1 44 | --- !u!1001 &100100000 45 | Prefab: 46 | m_ObjectHideFlags: 1 47 | serializedVersion: 2 48 | m_Modification: 49 | m_TransformParent: {fileID: 0} 50 | m_Modifications: [] 51 | m_RemovedComponents: [] 52 | m_ParentPrefab: {fileID: 0} 53 | m_RootGameObject: {fileID: 100000} 54 | m_IsPrefabParent: 1 55 | m_IsExploded: 1 56 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Prefabs/HexagonVacant.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 220810bebb6713b4696e9df601a6fa17 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a075cb2c2666e9f4ab95a858f9a0acd0 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Scripts/Hex.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Hex : MonoBehaviour { 5 | 6 | public Vector2 HexPosition; 7 | public HexModel HexModel { get; set; } 8 | public Material MaterialToUse; 9 | public float GridSize = 1f; 10 | 11 | public void Start() 12 | { 13 | GameObject hex = new GameObject(); 14 | HexModel = hex.AddComponent< HexModel > (); 15 | HexModel.GridSize = GridSize; 16 | hex.transform.parent = transform; 17 | hex.transform.localPosition = new Vector3(0, 0, 0); 18 | hex.GetComponent().material = MaterialToUse; 19 | } 20 | 21 | void Update () 22 | { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Scripts/Hex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 151fb9107d82765449ab7100da7f4f30 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Scripts/HexModel.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | [RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] 5 | public class HexModel : MonoBehaviour 6 | { 7 | public Hex Parent; 8 | public Vector3[] Vertices; 9 | public Color[] Colors; 10 | public Vector3[] Normals; 11 | public Vector2[] UV; 12 | public int[] Triangles; 13 | 14 | public float GridSize = 0f; 15 | private float Radius = 0f; 16 | private float HalfWidth = 0f; 17 | 18 | void Start () 19 | { 20 | Radius = GridSize; 21 | HalfWidth = (float)Mathf.Sqrt((Radius * Radius) - ((Radius / 2.0f) * (Radius / 2.0f))); 22 | 23 | Parent = transform.parent.GetComponent(); 24 | Vertices = new Vector3[7]; 25 | Colors = new Color[7]; 26 | UV = new Vector2[7]; 27 | 28 | DrawTopAndBottom(); 29 | SetTriangles(); 30 | 31 | var mesh = new Mesh { name = "Hex Mesh" }; 32 | GetComponent().mesh = mesh; 33 | mesh.vertices = Vertices; 34 | mesh.colors = Colors; 35 | mesh.uv = UV; 36 | mesh.SetTriangles(Triangles, 0); 37 | mesh.normals = Normals; 38 | } 39 | 40 | void Update () 41 | { 42 | 43 | } 44 | 45 | #region draw 46 | private void SetTriangles() 47 | { 48 | Normals = new Vector3[] 49 | { 50 | new Vector3(0, 1, 0), 51 | new Vector3(0, 1, 0), 52 | new Vector3(0, 1, 0), 53 | new Vector3(0, 1, 0), 54 | new Vector3(0, 1, 0), 55 | new Vector3(0, 1, 0), 56 | new Vector3(0, 1, 0) 57 | }; 58 | 59 | Triangles = new int[] 60 | { 61 | 0, 6, 1, 1, 6, 2, 2, 6, 3, 3, 6, 4, 4, 6, 5, 5, 6, 0 62 | }; 63 | } 64 | 65 | private void DrawTopAndBottom() 66 | { 67 | //top 68 | Vertices[0] = new Vector3(0, 0, -GridSize); 69 | Colors[0] = new Color(1, 0, 0); 70 | UV[0] = new Vector2(0.5f, 1); 71 | //topright 72 | Vertices[1] = new Vector3(HalfWidth, 0, -GridSize / 2); 73 | Colors[1] = new Color(1, 0, 0); 74 | UV[1] = new Vector2(1, 0.75f); 75 | //bottomright 76 | Vertices[2] = new Vector3(HalfWidth, 0, GridSize / 2); 77 | Colors[2] = new Color(1, 0, 0); 78 | UV[2] = new Vector2(1, 0.25f); 79 | //bottom 80 | Vertices[3] = new Vector3(0, 0, GridSize); 81 | Colors[3] = new Color(1, 0, 0); 82 | UV[3] = new Vector2(0.5f, 0); 83 | //bottomleft 84 | Vertices[4] = new Vector3(-HalfWidth, 0, GridSize / 2); 85 | Colors[4] = new Color(1, 0, 0); 86 | UV[4] = new Vector2(0, 0.25f); 87 | //topleft 88 | Vertices[5] = new Vector3(-HalfWidth, 0, -GridSize / 2); 89 | Colors[5] = new Color(1, 0, 0); 90 | UV[5] = new Vector2(0, 0.75f); 91 | // center 92 | Vertices[6] = new Vector3(0, 0, 0); 93 | Colors[6] = new Color(0, 0, 0); 94 | UV[6] = new Vector2(0.5f, 0.5f); 95 | 96 | } 97 | 98 | #endregion 99 | } 100 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Scripts/HexModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec8220a455da79948962142e67e9138f 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58420235ec8fa354ab2abecf51e2cc7c 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Shaders/HexShader.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/HexShader" { 2 | Properties { 3 | _Color ("Color", Color) = (1.0,1.0,1.0,1.0) 4 | _Dropoff ("Dropoff", Float) = 0.0 5 | _Gain ("Gain", Float) = 1.0 6 | } 7 | SubShader { 8 | Pass { 9 | Tags { "Queue" = "Transparent" "RenderType" = "Transparent" } 10 | Blend SrcAlpha OneMinusSrcAlpha 11 | 12 | CGPROGRAM 13 | #pragma vertex vert alpha 14 | #pragma fragment frag alpha 15 | 16 | uniform float4 _Color; 17 | uniform float _Dropoff; 18 | uniform float _Gain; 19 | 20 | uniform float4 _LightColor0; 21 | 22 | //float4x4 _Object2World; 23 | //float4x4 _World2Object; 24 | //float4 _WorldSpaceLightPos0; 25 | 26 | struct vertexInput { 27 | half4 vertex : POSITION; 28 | half3 normal : NORMAL; 29 | half4 col : COLOR; 30 | }; 31 | struct vertexOutput { 32 | half4 pos : SV_POSITION; 33 | half4 col : COLOR; 34 | }; 35 | 36 | vertexOutput vert(vertexInput v) 37 | { 38 | vertexOutput o; 39 | 40 | o.col = half4( v.col.rgb,1.0); 41 | o.pos = mul( UNITY_MATRIX_MVP, v.vertex); 42 | return o; 43 | } 44 | 45 | float4 frag(vertexOutput i) : COLOR 46 | { 47 | half a = i.col.r; 48 | a = saturate( max(a - _Dropoff, 0.0) * _Gain); 49 | return half4( _Color.rgb, a ); 50 | } 51 | 52 | 53 | ENDCG 54 | } 55 | } 56 | FallBack "Diffuse" 57 | } 58 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/DebugVisuals/Shaders/HexShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53bffd6822aa1ab42a89abb2f623af9e 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf54b79b4e69fe749bb749186f93bab2 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/Editor/HexGridManagerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEditor; 4 | 5 | [CustomEditor(typeof(HexGridManager))] 6 | public class HexGridManagerEditor : Editor 7 | { 8 | public override void OnInspectorGUI() 9 | { 10 | DrawDefaultInspector(); 11 | 12 | HexGridManager hexManager = (HexGridManager)target; 13 | if (GUILayout.Button("Rebuild Grid From NavMesh")) 14 | { 15 | NavMeshBuilder.BuildNavMesh(); 16 | hexManager.RebuildFromNavMesh(); 17 | } 18 | 19 | if (GUILayout.Button("Report Stats")) 20 | { 21 | hexManager.ReportStats(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/Editor/HexGridManagerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fba53f8e36843944a85896af8e51773 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/HexGridManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2014 John Constable 2 | // 3 | // This is a component intended to be used within a Unity project. It creates and stores a map of 4 | // heagonal grid square, and provides various functions such as validitiy testing, collision testing, 5 | // and vacant neighbor searching. It is intended to be used in collaboration with Unity's built-in 6 | // pathfinding/navmesh solution, although there are no true dependendencies. The coordinate system used 7 | // by this hex grid is Axial. 8 | // 9 | // TODO: Distance testing, find best path 10 | // 11 | // HexGridManager is free software: you can redistribute it and/or modify it under the terms of the GNU General 12 | // Public License as published by the Free Software Foundation, either version 3 of the License, or (at 13 | // your option) any later version. 14 | // 15 | // HexGridManager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 16 | // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. http://www.gnu.org/licenses/. 18 | 19 | using UnityEngine; 20 | using System.Collections.Generic; 21 | 22 | public class HexGridManager : MonoBehaviour 23 | { 24 | protected static readonly IntVector2[] neighborVectors = new IntVector2[6] 25 | { 26 | new IntVector2( +1, 0 ), 27 | new IntVector2( +1, -1 ), 28 | new IntVector2( 0, -1 ), 29 | new IntVector2( -1, 0 ), 30 | new IntVector2( -1, +1 ), 31 | new IntVector2( 0, +1 ) 32 | }; 33 | 34 | // The size in Unity meters of the length of one grid square 35 | public float GridSize = 0.25f; 36 | // The length in squares of one side of the entire possible grid space. Must be Power of 2 37 | public int GridRowMax = 1024; 38 | 39 | // Allow configuration of debug visual Y position, to avoid Z-fighting 40 | public float UnoccupiedDebugYPosition = 0.001f; 41 | public float OccupiedDebugYPosition = 0.002f; 42 | 43 | // Triggers debug display, if prefabs are also present 44 | public bool ShowDebug = false; 45 | public bool ShowDebugLabel = false; 46 | 47 | public GameObject OccupiedTilePrefab = null; 48 | public GameObject DestinationTilePrefab = null; 49 | public Material debugHexVacantMaterial; 50 | 51 | // Leave as public so they will be serialized in the editor 52 | [HideInInspector] 53 | public List validGrids = new List< int >(); 54 | 55 | // Keep track of who is overlapping which grids 56 | protected Dictionary< int, List< int > > _occupantBuckets = new Dictionary >(); 57 | 58 | private List< InternalOccupant > _occupants = new List(); 59 | private List< GameObject > _debugVisuals = new List(); 60 | 61 | // Store some numbers that are frequently used 62 | private int _exponent = 0; 63 | private int GridRowMaxHalf { 64 | get { 65 | if(_gridRowMaxHalf == 0) 66 | this.DetermineExponent(); 67 | return _gridRowMaxHalf; 68 | } 69 | set { 70 | _gridRowMaxHalf = value; 71 | } 72 | } 73 | private int _gridRowMaxHalf = 0; 74 | 75 | private static readonly float _sqrtThree = Mathf.Sqrt(3f); 76 | private static readonly float _oneThird = (1f/3f); 77 | private static readonly float _twoThirds = (2f/3f); 78 | private static readonly float _threeHalves = (3f/2f); 79 | 80 | private GenericPool< List< int > > _intListPool = null; 81 | private GenericPool< InternalOccupant > _occupantPool = null; 82 | protected GenericPool< IntVector2 > _intVectorPool = null; 83 | 84 | private Mesh _debugMesh = null; 85 | 86 | // Use this for initialization 87 | public HexGridManager() 88 | { 89 | _intListPool = new GenericPool< List< int > >(CreateNewList); 90 | _occupantPool = new GenericPool< InternalOccupant >(CreateNewOccupant); 91 | _intVectorPool = new GenericPool< IntVector2 >(CreateNewIntVector); 92 | } 93 | 94 | // Return true if the vector is a hex coordinate on the navmesh 95 | // vec - A grid position, using x and z as the coordinates 96 | public bool IsValid( Vector3 vec ) 97 | { 98 | return (validGrids.BinarySearch(GetGridSig(vec)) > -1); 99 | } 100 | 101 | // Returns true if the vectory is a hex coordinate that currently has an occupant 102 | // vec - A grid position, using x and z as the coordinates 103 | // params filter (optional) - Do not count the given occupants 104 | public bool IsOccupied( Vector3 vec, params object[] filters ) 105 | { 106 | return IsOccupied(GetGridSig(vec), filters ); 107 | } 108 | 109 | public bool IsOccupied( Vector3 vec ) 110 | { 111 | return IsOccupied(GetGridSig(vec), null); 112 | } 113 | 114 | public void GetOccupants( Vector3 vec, List< GameObject > occupantsOut ) 115 | { 116 | occupantsOut.Clear(); 117 | 118 | int sig = GetGridSig( vec ); 119 | List< int > occupants = null; 120 | bool exists = _occupantBuckets.TryGetValue(sig, out occupants); 121 | 122 | if( !exists ) 123 | { 124 | return; 125 | } 126 | 127 | foreach( int occupantID in occupants ) 128 | { 129 | foreach( InternalOccupant o in _occupants ) 130 | { 131 | if( o.ID == occupantID ) 132 | { 133 | if( o.TrackedGameObject != null ) 134 | { 135 | occupantsOut.Add( o.TrackedGameObject ); 136 | } 137 | } 138 | } 139 | } 140 | } 141 | 142 | // Convert from world space to grid space 143 | // pos - The world space vector 144 | // grid - The vector to which to write 145 | public void PositionToGrid( Vector3 pos, ref Vector3 outGrid ) 146 | { 147 | using (IntVector2 igrid = _intVectorPool.GetObject()) 148 | { 149 | PositionToGrid(pos, igrid); 150 | outGrid.x = igrid.x; 151 | outGrid.y = 0; 152 | outGrid.z = igrid.y; 153 | } 154 | } 155 | 156 | // Convert from a hex grid space to a world space position 157 | // grid - A grid position, using x and z as the coordinates 158 | // pos - The vector to write to 159 | public void GridToPosition( Vector3 grid, ref Vector3 pos ) 160 | { 161 | GridToPosition(Mathf.RoundToInt(grid.x), Mathf.RoundToInt(grid.z), ref pos); 162 | } 163 | 164 | // Convert from a hex grid space to a world space position 165 | // intx - The X grid coordinate 166 | // inty - The Y grid coordinate 167 | // pos - The vector to write to write 168 | public void GridToPosition( int intx, int inty, ref Vector3 pos ) 169 | { 170 | float x = (float)intx; 171 | float y = (float)inty; 172 | float g = (float)GridSize; 173 | 174 | pos.x = g * _sqrtThree * (x + ( y * 0.5f ) ); 175 | pos.y = 0f; 176 | pos.z = g * _threeHalves * y; 177 | } 178 | 179 | public void SnapPositionToGrid( Vector3 pos, ref Vector3 snapPos ) 180 | { 181 | Vector3 temp = Vector3.zero; 182 | PositionToGrid( pos, ref temp ); 183 | GridToPosition( temp, ref snapPos ); 184 | } 185 | 186 | // Find the nearest unoccupied grid position 187 | // dest - The object to which you'd like to find the closest unoccupied grid 188 | // outGrid - The vector to which coordinates will be written 189 | public void GetClosestVacantNeighbor( GameObject dest, ref Vector3 outGrid ) 190 | { 191 | GetClosestVacantNeighbor(dest, ref outGrid, Vector3.zero); 192 | } 193 | 194 | // Find the nearest unoccupied grid position 195 | // dest - The object to which you'd like to find the closest unoccupied grid 196 | // outGrid - The vector to which coordinates will be written 197 | // dir - Unit vector specifying in which direction you'd like the returned grid to favor 198 | public void GetClosestVacantNeighbor( GameObject dest, ref Vector3 outGrid, Vector3 dir ) 199 | { 200 | GetClosestVacantNeighbor( dest.transform.position, ref outGrid, dir ); 201 | } 202 | 203 | public void GetClosestVacantNeighbor( Vector3 dest, ref Vector3 outGrid, Vector3 dir ) 204 | { 205 | int currentSig = 0; 206 | 207 | // Early out if the given grid is unoccupied 208 | using (IntVector2 occupantCurrent = _intVectorPool.GetObject()) 209 | { 210 | PositionToGrid(dest, occupantCurrent); 211 | currentSig = GetGridSig(occupantCurrent); 212 | 213 | bool occupied = IsOccupied(currentSig); 214 | if (!occupied) 215 | { 216 | outGrid.Set(occupantCurrent.x, 0, occupantCurrent.y); 217 | return; 218 | } 219 | } 220 | 221 | int magnitude = 1; 222 | bool found = false; 223 | 224 | while( !found ) 225 | { 226 | List< int > unoccupiedNeighbors = AcquireListOfUnoccupiedNeighbors(currentSig, magnitude, true); 227 | using (IntVector2 nearest = _intVectorPool.GetObject()) 228 | { 229 | nearest.Set(0,0); // Initialize, just in case 230 | 231 | if (unoccupiedNeighbors.Count > 0) 232 | { 233 | // Now that we have a list of unoccupied neighbors, find the one in the best direction 234 | if (dir.sqrMagnitude < Mathf.Epsilon) 235 | { 236 | // Direction doesn't matter 237 | SigToGrid(unoccupiedNeighbors [0], nearest); 238 | } 239 | else 240 | { 241 | // Direction does matter 242 | FindNeighborClosestToPoint(dest, dir, unoccupiedNeighbors, nearest); 243 | } 244 | found = true; 245 | } 246 | 247 | outGrid.Set(nearest.x, 0, nearest.y); 248 | } 249 | 250 | unoccupiedNeighbors.Clear (); 251 | _intListPool.ReturnObject(unoccupiedNeighbors); 252 | 253 | magnitude++; 254 | } 255 | } 256 | 257 | public List GetAllWorldPositions() 258 | { 259 | List positions = new List(); 260 | Vector3 wPos = Vector3.zero; 261 | 262 | using(IntVector2 vec = _intVectorPool.GetObject()) 263 | { 264 | foreach(int sig in validGrids) 265 | { 266 | SigToGrid(sig, vec); 267 | 268 | GridToPosition(vec.x, vec.y, ref wPos); 269 | 270 | positions.Add(wPos); 271 | } 272 | } 273 | 274 | return positions; 275 | } 276 | 277 | public Vector3[] GetNeighborPositions(Vector3 worldPosition) 278 | { 279 | IntVector2 grid = _intVectorPool.GetObject(); 280 | PositionToGrid(worldPosition, grid); 281 | 282 | int sig = GetGridSig(grid); 283 | 284 | List neighbors = AcquireListOfNeighbors(sig, false); 285 | Vector3[] neighborPositions = new Vector3[neighbors.Count]; 286 | for(int i = 0; i < neighbors.Count; ++i) 287 | { 288 | IntVector2 nGrid = _intVectorPool.GetObject(); 289 | SigToGrid(neighbors[i], nGrid); 290 | 291 | Vector3 nPos = Vector3.zero; 292 | GridToPosition(nGrid.x, nGrid.y, ref nPos); 293 | 294 | neighborPositions[i] = nPos; 295 | } 296 | 297 | return neighborPositions; 298 | } 299 | 300 | #region Occupants 301 | // Create an occupant on the grid with a given magnitude (number of rings to occupy) 302 | // Occupants track the position of the given GameObject, and will send the "OnGridChanged" message 303 | // to the GameObject if its grid position changes. 304 | // thing - The GameObject that this Occupant is tracking 305 | // magnitude - The number of rings to occupy around the central hex 306 | public Occupant CreateOccupant( GameObject thing, int magnitude ) 307 | { 308 | InternalOccupant o = CreateInternalOccupant( thing.transform.position, thing, magnitude ); 309 | return (Occupant)o; 310 | } 311 | 312 | // Return the Occupant to the manager 313 | // occupant - The Occupant that is being returned 314 | public void ReturnOccupant( ref Occupant occupant ) 315 | { 316 | ReturnInternalOccupant (occupant as InternalOccupant); 317 | occupant = null; 318 | } 319 | #endregion 320 | 321 | #region Reservations 322 | // Create a reservation on a single grid space in the grid 323 | // pos - The position in world space of the grid you want to reserve 324 | public Reservation CreateReservation( Vector3 pos ) 325 | { 326 | InternalOccupant o = CreateInternalOccupant( pos, null, 0 ); 327 | return (Reservation)o; 328 | } 329 | 330 | // Return the Reservation to the manager 331 | // reservation - The reservation being returned 332 | public void ReturnReservation( ref Reservation reservation ) 333 | { 334 | ReturnInternalOccupant (reservation as InternalOccupant); 335 | reservation = null; 336 | } 337 | #endregion 338 | 339 | #region Distance 340 | public int GridDistanceBetweenOccupants( Occupant a, Occupant b, int maxDistance ) 341 | { 342 | int distance = 0; 343 | 344 | InternalOccupant occupantA = a as InternalOccupant; 345 | InternalOccupant occupantB = b as InternalOccupant; 346 | if(occupantA == null || occupantB == null) 347 | { 348 | Debug.LogWarning("One of these occupants is null wtf!"); 349 | } 350 | if( occupantA.TrackedGameObject == null || occupantB.TrackedGameObject == null ) 351 | { 352 | Debug.LogWarning( "Unable to calculate grid distances between two occupants that do not track GameObjects" ); 353 | return -1; 354 | } 355 | 356 | distance = GridDistanceBetweenVectors( occupantA.TrackedGameObject.transform.position, occupantB.TrackedGameObject.transform.position, maxDistance ); 357 | 358 | return distance; 359 | } 360 | 361 | public int GridDistanceBetweenVectors( Vector3 a, Vector3 b, int maxDistance ) 362 | { 363 | int distance = 0; 364 | int ax, ay, bx, by; 365 | 366 | PositionToGrid( a, out ax, out ay ); 367 | PositionToGrid( b, out bx, out by ); 368 | 369 | distance = ( Mathf.Abs( ax - bx ) + Mathf.Abs( ay - by ) + Mathf.Abs( ax + ay - bx - by ) ) / 2; 370 | distance = Mathf.Min( distance, maxDistance ); 371 | 372 | return distance; 373 | } 374 | #endregion 375 | 376 | 377 | 378 | 379 | 380 | #region Private 381 | private List< int > CreateNewList() 382 | { 383 | return new List(); 384 | } 385 | 386 | private InternalOccupant CreateNewOccupant() 387 | { 388 | return new InternalOccupant(this); 389 | } 390 | 391 | private IntVector2 CreateNewIntVector() 392 | { 393 | return new IntVector2( this ); 394 | } 395 | 396 | private void DetermineExponent() 397 | { 398 | while (( GridRowMax >> _exponent ) != 1) 399 | { 400 | _exponent++; 401 | } 402 | 403 | GridRowMaxHalf = GridRowMax / 2; 404 | } 405 | 406 | private List< InternalOccupant > _occupantsToMessage = new List< InternalOccupant > (); 407 | 408 | void Awake() 409 | { 410 | DetermineExponent(); 411 | } 412 | 413 | // Update is called once per frame 414 | void Update () 415 | { 416 | // Process occupants and signal if they have moved to a new grid 417 | using (IntVector2 grid = _intVectorPool.GetObject()) 418 | { 419 | foreach (InternalOccupant occupant in _occupants) 420 | { 421 | // Only update tracking for occupants that have GameObjects 422 | if (occupant.TrackedGameObject != null) 423 | { 424 | PositionToGrid(occupant.TrackedGameObject.transform.position, grid); 425 | int sig = GetGridSig(grid); 426 | 427 | // See if it's moved 428 | if (sig != occupant.Sig) 429 | { 430 | occupant.Update(grid, OccupiedTilePrefab); 431 | 432 | _occupantsToMessage.Add( occupant ); 433 | } 434 | } 435 | } 436 | 437 | foreach (InternalOccupant occupant in _occupantsToMessage) 438 | { 439 | occupant.TrackedGameObject.SendMessage( "OnGridChanged", SendMessageOptions.DontRequireReceiver ); 440 | } 441 | _occupantsToMessage.Clear (); 442 | } 443 | 444 | ToggleDebugVisuals(); 445 | } 446 | 447 | // Rebuild the hex grids from the NavMesh (not recommended at runtime) 448 | public void RebuildFromNavMesh() 449 | { 450 | validGrids.Clear(); 451 | System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); 452 | stopwatch.Start(); 453 | FillValidGrids(); 454 | stopwatch.Stop(); 455 | Debug.Log("GridManager: Setup took " + stopwatch.ElapsedMilliseconds + "ms" ); 456 | } 457 | 458 | // Report some stats to the console 459 | public void ReportStats() 460 | { 461 | _intListPool.PrintStats(); 462 | _intVectorPool.PrintStats(); 463 | _occupantPool.PrintStats(); 464 | Debug.Log("Hex spaces on NavMesh: " + validGrids.Count); 465 | } 466 | 467 | private void ToggleDebugVisuals() 468 | { 469 | if (!ShowDebug && _debugVisuals.Count > 0) 470 | { 471 | foreach (InternalOccupant occ in _occupants) 472 | { 473 | occ.DestroyVisuals(); 474 | } 475 | } 476 | } 477 | 478 | private void PositionToGrid( Vector3 pos, IntVector2 grid ) 479 | { 480 | PositionToGrid( pos, out grid.x, out grid.y ); 481 | } 482 | 483 | private void PositionToGrid( Vector3 pos, out int x, out int y ) 484 | { 485 | float g = (float)GridSize; 486 | float oneOverG = 1f / g; 487 | 488 | float q = (_oneThird * ( _sqrtThree * pos.x )) - (_oneThird * pos.z ); 489 | q *= oneOverG; 490 | float r = (_twoThirds * pos.z) * oneOverG; 491 | 492 | // XA: This is actually a rough estimate... 493 | x = Mathf.RoundToInt( q ); 494 | y = Mathf.RoundToInt( r ); 495 | 496 | // XA: Acquire a list of neibhors, including ourself, and check which one is actually closer 497 | int currentSig = GetGridSig(x, y); 498 | List< int > neighbors = this.AcquireListOfNeighbors(currentSig, true); 499 | 500 | int closestSig = -1; 501 | float closestDist = Mathf.Infinity; 502 | foreach(int n in neighbors) 503 | { 504 | int nx = 0, ny = 0; 505 | this.SigToGrid(n, out nx, out ny); 506 | 507 | // Calculate distance from our translate "grid coordinates" and the center of this hex 508 | float distance = ( Mathf.Abs( nx - q ) + Mathf.Abs( ny - r ) + Mathf.Abs( nx + ny - q - r ) ) / 2.0f; 509 | if(distance < closestDist) 510 | { 511 | closestSig = n; 512 | closestDist = distance; 513 | } 514 | } 515 | 516 | using (IntVector2 closestPos = _intVectorPool.GetObject()) 517 | { 518 | SigToGrid(closestSig, closestPos); 519 | 520 | x = closestPos.x; 521 | y = closestPos.y; 522 | } 523 | } 524 | 525 | private bool IsOccupied( int sig, params object[] filters ) 526 | { 527 | List< int > occupants = null; 528 | bool exists = _occupantBuckets.TryGetValue(sig, out occupants); 529 | 530 | if( !exists ) 531 | { 532 | return false; 533 | } 534 | 535 | int numOccupants = occupants.Count; 536 | for (int i = 0; i < filters.Length; ++i) { 537 | InternalOccupant occupant = filters [i] as InternalOccupant; 538 | if (occupant != null && occupants.Contains (occupant.ID)) { 539 | numOccupants--; 540 | } 541 | } 542 | 543 | return (numOccupants > 0); 544 | } 545 | 546 | 547 | 548 | private int GetGridSig( Vector3 vec ) 549 | { 550 | return GetGridSig( Mathf.RoundToInt(vec.x), Mathf.RoundToInt(vec.z) ); 551 | } 552 | 553 | private int GetGridSig( IntVector2 vec ) 554 | { 555 | return GetGridSig(vec.x, vec.y); 556 | } 557 | 558 | private int GetGridSig( int x, int y ) 559 | { 560 | return ( x + ( GridRowMaxHalf ) ) + 561 | ( ( y + ( GridRowMaxHalf ) ) << _exponent); 562 | } 563 | 564 | private void SigToGrid( int sig, IntVector2 vec ) 565 | { 566 | SigToGrid( sig, out vec.x, out vec.y ); 567 | } 568 | 569 | private void SigToGrid( int sig, out int x, out int y ) 570 | { 571 | x = ( sig % GridRowMax ) - ( GridRowMaxHalf ); 572 | sig >>= _exponent; 573 | y = ( sig % GridRowMax ) - ( GridRowMaxHalf ); 574 | } 575 | 576 | private InternalOccupant CreateInternalOccupant( Vector3 pos, GameObject tracked, int magnitude ) 577 | { 578 | InternalOccupant o = _occupantPool.GetObject(); 579 | 580 | using (IntVector2 grid = _intVectorPool.GetObject()) 581 | { 582 | PositionToGrid(pos, grid); 583 | 584 | o.Track(tracked); 585 | o.SetMagnitude(magnitude); 586 | o.Update(grid, (tracked == null) ? DestinationTilePrefab : OccupiedTilePrefab ); 587 | } 588 | 589 | _occupants.Add(o); 590 | 591 | return o; 592 | } 593 | 594 | private void ReturnInternalOccupant( InternalOccupant occupant ) 595 | { 596 | _occupants.Remove(occupant); 597 | 598 | occupant.DestroyVisuals(); 599 | occupant.Vacate(); 600 | occupant.Track(null); 601 | 602 | _occupantPool.ReturnObject(occupant); 603 | } 604 | 605 | private void PushNewMagnitudeOfNeighborsIntoStack( List actedGrids, Stack neighbors ) 606 | { 607 | using (IntVector2 actedVec = _intVectorPool.GetObject()) 608 | { 609 | using (IntVector2 neighborVec = _intVectorPool.GetObject()) 610 | { 611 | foreach (int acted in actedGrids) 612 | { 613 | for (int i = 0; i < neighborVectors.Length; i++) 614 | { 615 | SigToGrid(acted, actedVec); 616 | 617 | neighborVec.Set(actedVec.x + neighborVectors [i].x, 618 | actedVec.y + neighborVectors [i].y); 619 | 620 | int neighborSig = GetGridSig(neighborVec); 621 | if (!neighbors.Contains(neighborSig) && !actedGrids.Contains(neighborSig)) 622 | { 623 | neighbors.Push(neighborSig); 624 | } 625 | //else 626 | //{ 627 | // using( IntVector2 g = _intVectorPool.GetObject() ) 628 | // { 629 | // SigToGrid( neighborSig, g ); 630 | // Debug.Log( "Sig Failed " + neighborSig + " " + g.ToString() ); 631 | // } 632 | //} 633 | } 634 | } 635 | } 636 | } 637 | } 638 | 639 | private void FindNeighborClosestToPoint( Vector3 center, Vector3 dir, List neighbors, IntVector2 closestNeighbor ) 640 | { 641 | // Initialize the out vector just in case 642 | closestNeighbor.Set(0, 0); 643 | 644 | int x, y; 645 | 646 | float lastDot = float.MinValue; 647 | foreach( int neighborSig in neighbors ) 648 | { 649 | SigToGrid( neighborSig, out x, out y ); 650 | Vector3 neighborPos = Vector3.zero; 651 | 652 | GridToPosition( x, y, ref neighborPos ); 653 | 654 | float dot = Vector3.Dot( dir, ( center - neighborPos ).normalized ); 655 | if( dot > lastDot ) 656 | { 657 | closestNeighbor.Set( x, y ); 658 | lastDot = dot; 659 | } 660 | } 661 | } 662 | 663 | private List< int > AcquireListOfNeighbors( int currentSig, bool includeSelf = false ) 664 | { 665 | List< int > neighbors = _intListPool.GetObject(); 666 | neighbors.Clear(); 667 | neighbors.Capacity = neighborVectors.Length + ( includeSelf ? 0 : 1 ); 668 | 669 | int x, y; 670 | SigToGrid( currentSig, out x, out y ); 671 | 672 | if( includeSelf ) 673 | { 674 | neighbors.Add( currentSig ); 675 | } 676 | 677 | for( int i = 0; i < neighborVectors.Length; ++i ) 678 | { 679 | int neighborSig = GetGridSig( x + neighborVectors[i].x, y + neighborVectors[i].y ); 680 | neighbors.Add( neighborSig ); 681 | } 682 | 683 | return neighbors; 684 | } 685 | 686 | private List< int > AcquireListOfNeighbors( int currentSig, int magnitude, bool includeSelf = false ) 687 | { 688 | List< int > neighbors = _intListPool.GetObject(); 689 | neighbors.Clear(); 690 | 691 | //magnitude = Mathf.Max( 1, magnitude ); 692 | neighbors.Capacity = neighborVectors.Length * magnitude + ( includeSelf ? 0 : 1 ); 693 | 694 | int x, y; 695 | SigToGrid( currentSig, out x, out y ); 696 | 697 | if( includeSelf ) 698 | { 699 | neighbors.Add( currentSig ); 700 | } 701 | 702 | for( int k = 1; k <= magnitude; ++k ) 703 | { 704 | for( int i = 0; i < neighborVectors.Length; ++i ) 705 | { 706 | for( int j = 0; j < k; ++j ) 707 | { 708 | int neighborSig = GetGridSig( x + neighborVectors[i].x * k, y + neighborVectors[i].y * k ); 709 | neighbors.Add( neighborSig ); 710 | } 711 | } 712 | } 713 | 714 | return neighbors; 715 | } 716 | 717 | private List< int > AcquireListOfUnoccupiedNeighbors( int currentSig, int magnitude, bool includeSelf = false ) 718 | { 719 | List< int > neighbors = AcquireListOfNeighbors( currentSig, magnitude, false ); 720 | if( includeSelf ) 721 | { 722 | neighbors.Add( currentSig ); 723 | } 724 | neighbors.RemoveAll( ( int sig ) => { return IsOccupied( sig ); } ); 725 | 726 | return neighbors; 727 | } 728 | #endregion 729 | 730 | void FillValidGrids() 731 | { 732 | if( !Mathf.IsPowerOfTwo( GridRowMax ) ) 733 | { 734 | Debug.LogError( "GridManager: Invalid GridRowMax, must be Power of Two" ); 735 | return; 736 | } 737 | 738 | DetermineExponent(); 739 | 740 | Dictionary< int, bool > triedValues = new Dictionary< int, bool >(); 741 | bool b; 742 | 743 | int maxStackSize = 0; 744 | NavMeshHit hit; 745 | Vector3 pos = new Vector3(); 746 | 747 | Stack< int > neighborsToTry = new Stack< int >(); 748 | 749 | // Start it off 750 | using (IntVector2 grid = _intVectorPool.GetObject()) 751 | { 752 | grid.Set(0, 0); 753 | neighborsToTry.Push(GetGridSig(grid)); 754 | 755 | int sig = 0; 756 | float minGridSizeForTesting = Mathf.Max( 0.2f, GridSize / 2f ); 757 | 758 | using (IntVector2 tmpGrid2 = _intVectorPool.GetObject()) 759 | { 760 | while (neighborsToTry.Count > 0) 761 | { 762 | maxStackSize = Mathf.Max(maxStackSize, neighborsToTry.Count); 763 | 764 | sig = neighborsToTry.Pop(); 765 | SigToGrid(sig, grid); 766 | 767 | triedValues.Add(sig, true); 768 | 769 | GridToPosition(grid.x, grid.y, ref pos); 770 | if (NavMesh.SamplePosition(pos, out hit, minGridSizeForTesting, -1)) 771 | { 772 | 773 | //if( hit.distance <= minGridSizeForTesting ) 774 | { 775 | validGrids.Add(sig); 776 | 777 | for (int i = 0; i < HexGridManager.neighborVectors.Length; i++) 778 | { 779 | IntVector2 neighborDir = HexGridManager.neighborVectors [i]; 780 | 781 | tmpGrid2.Set(neighborDir.x + grid.x, neighborDir.y + grid.y); 782 | int nextSig = GetGridSig(tmpGrid2); 783 | if (!triedValues.TryGetValue(nextSig, out b) && !neighborsToTry.Contains(nextSig)) 784 | { 785 | neighborsToTry.Push(nextSig); 786 | } 787 | } 788 | } 789 | } 790 | } 791 | } 792 | } 793 | 794 | // Sort so we can bsearch it 795 | validGrids.Sort(); 796 | 797 | if (validGrids.Count == 0) 798 | { 799 | Debug.LogError("Unable to find any possible grid units in this scene. Make sure you have baked a nav mesh, and that the nav mesh includes the world origin (0,0)"); 800 | return; 801 | } 802 | 803 | Debug.Log("Hex spaces on NavMesh found: " + validGrids.Count); 804 | Debug.Log("Max stack size during search: " + maxStackSize); 805 | _intVectorPool.PrintStats(); 806 | } 807 | 808 | private void OnDrawGizmos() 809 | { 810 | if(_debugMesh == null) { 811 | DetermineExponent(); 812 | _debugMesh = this.CreateHexMesh(); 813 | } 814 | 815 | if(_debugMesh != null && debugHexVacantMaterial != null) 816 | { 817 | debugHexVacantMaterial.SetPass(0); 818 | 819 | using(IntVector2 grid = _intVectorPool.GetObject()) 820 | { 821 | foreach (int sig in validGrids) 822 | { 823 | SigToGrid(sig, grid); 824 | 825 | Vector3 pos = Vector3.zero; 826 | GridToPosition( grid.x, grid.y, ref pos ); 827 | pos += Vector3.up * UnoccupiedDebugYPosition; 828 | 829 | Graphics.DrawMeshNow( _debugMesh, pos, Quaternion.identity ); 830 | 831 | #if UNITY_EDITOR 832 | if( ShowDebugLabel ) UnityEditor.Handles.Label( pos, "[" + grid.x + "," + grid.y + "]" ); 833 | #endif 834 | 835 | } 836 | } 837 | } 838 | } 839 | 840 | private Mesh CreateHexMesh() 841 | { 842 | float Radius = GridSize; 843 | float HalfWidth = (float)Mathf.Sqrt((Radius * Radius) - ((Radius / 2.0f) * (Radius / 2.0f))); 844 | 845 | Vector3[] normals = new Vector3[] 846 | { 847 | new Vector3(0, 1, 0), 848 | new Vector3(0, 1, 0), 849 | new Vector3(0, 1, 0), 850 | new Vector3(0, 1, 0), 851 | new Vector3(0, 1, 0), 852 | new Vector3(0, 1, 0), 853 | new Vector3(0, 1, 0) 854 | }; 855 | 856 | int[] tris = new int[] 857 | { 858 | 0, 6, 1, 1, 6, 2, 2, 6, 3, 3, 6, 4, 4, 6, 5, 5, 6, 0 859 | }; 860 | 861 | Vector3[] Vertices = new Vector3[7]; 862 | Color[] Colors = new Color[7]; 863 | Vector2[] UV = new Vector2[7]; 864 | 865 | //top 866 | Vertices[0] = new Vector3(0, 0, -GridSize); 867 | Colors[0] = new Color(1, 0, 0); 868 | UV[0] = new Vector2(0.5f, 1); 869 | //topright 870 | Vertices[1] = new Vector3(HalfWidth, 0, -GridSize / 2); 871 | Colors[1] = new Color(1, 0, 0); 872 | UV[1] = new Vector2(1, 0.75f); 873 | //bottomright 874 | Vertices[2] = new Vector3(HalfWidth, 0, GridSize / 2); 875 | Colors[2] = new Color(1, 0, 0); 876 | UV[2] = new Vector2(1, 0.25f); 877 | //bottom 878 | Vertices[3] = new Vector3(0, 0, GridSize); 879 | Colors[3] = new Color(1, 0, 0); 880 | UV[3] = new Vector2(0.5f, 0); 881 | //bottomleft 882 | Vertices[4] = new Vector3(-HalfWidth, 0, GridSize / 2); 883 | Colors[4] = new Color(1, 0, 0); 884 | UV[4] = new Vector2(0, 0.25f); 885 | //topleft 886 | Vertices[5] = new Vector3(-HalfWidth, 0, -GridSize / 2); 887 | Colors[5] = new Color(1, 0, 0); 888 | UV[5] = new Vector2(0, 0.75f); 889 | // center 890 | Vertices[6] = new Vector3(0, 0, 0); 891 | Colors[6] = new Color(0, 0, 0); 892 | UV[6] = new Vector2(0.5f, 0.5f); 893 | 894 | // Create the mesh 895 | Mesh mesh = new Mesh { name = "Hex Mesh" }; 896 | mesh.vertices = Vertices; 897 | mesh.colors = Colors; 898 | mesh.uv = UV; 899 | mesh.SetTriangles(tris, 0); 900 | mesh.normals = normals; 901 | 902 | return mesh; 903 | } 904 | 905 | #region InnerClasses 906 | // Simple container to remove need for a normal Vector2 for holding grid coordinates 907 | public class IntVector2 : System.IDisposable 908 | { 909 | public int x; 910 | public int y; 911 | 912 | private HexGridManager _manager; 913 | 914 | public IntVector2( HexGridManager manager ) { _manager = manager; x = 0; y = 0; } 915 | public IntVector2( int _x, int _y ) { _manager = null; x = _x; y = _y; } 916 | 917 | public void Set( IntVector2 other ) { x = other.x; y = other.y; } 918 | public void Set( int _x, int _y ) { x = _x; y = _y; } 919 | 920 | public bool Equals( IntVector2 other ) 921 | { 922 | return (x == other.x) && (y == other.y); 923 | } 924 | 925 | public int SqrMagnitude 926 | { 927 | get { return x * x + y * y; } 928 | } 929 | 930 | public void Dispose() 931 | { 932 | if (_manager != null) 933 | { 934 | _manager._intVectorPool.ReturnObject( this ); 935 | } 936 | } 937 | 938 | public override string ToString() 939 | { 940 | return "[" + x + ", " + y + "]"; 941 | } 942 | } 943 | 944 | // Public interface to allow users of this class to reference their Occupants without 945 | // access to the implementation 946 | public interface Occupant { 947 | } 948 | 949 | // Public interface to allow users of this class to reference their Reservations without 950 | // access to the implementation 951 | public interface Reservation { 952 | } 953 | 954 | // Class that ecapsulates a 2D region of occupied grid squares 955 | protected class InternalOccupant : Occupant, Reservation 956 | { 957 | // Getter for the occupant ID 958 | public int ID { get { return _id; } } 959 | 960 | // Getter for the current sig 961 | public int Sig { get { return _current; } } 962 | 963 | // Getter for the tracked GameObject 964 | public GameObject TrackedGameObject { get { return _trackedGameObject; } } 965 | 966 | // Static to uniquely identify every Occupant that is created 967 | private static int IdCounter = 0; 968 | 969 | private int _id = -1; // Unique ID 970 | private HexGridManager _manager; // Reference to the parent grid manager 971 | private GameObject _trackedGameObject = null; // The GameObject that this Occupant is tracking 972 | private int _current; // Last known coordinates of this occupant 973 | private int _magnitude; // The extent to which this Occupant extends from center 974 | private int _debugTileCounter = 0; 975 | private List< GameObject > debugVisuals = new List(); 976 | 977 | public InternalOccupant( HexGridManager manager ) 978 | { 979 | _manager = manager; 980 | _id = IdCounter++; 981 | } 982 | 983 | // Set the magnitude for the occupant 984 | public void SetMagnitude( int magnitude ) 985 | { 986 | _magnitude = magnitude; 987 | DestroyVisuals(); 988 | } 989 | 990 | public void DestroyVisuals() 991 | { 992 | foreach (GameObject o in debugVisuals) { Destroy(o); } 993 | debugVisuals.Clear(); 994 | _debugTileCounter = 0; 995 | } 996 | 997 | public void Track( GameObject go ) 998 | { 999 | _trackedGameObject = go; 1000 | } 1001 | 1002 | // Mark the grid with this occupant's new coordinates 1003 | public void Update( IntVector2 vec, GameObject debugPrefab ) 1004 | { 1005 | Vacate(); 1006 | 1007 | _current = _manager.GetGridSig(vec); 1008 | 1009 | // Stamp this occupant into the grid 1010 | Occupy( debugPrefab ); 1011 | } 1012 | 1013 | // Add this occupants area to the grid 1014 | public void Occupy( GameObject debugPrefab ) 1015 | { 1016 | _debugTileCounter = 0; // More straighforward counter for which tile is being updated within UpdateDebugVisuals 1017 | 1018 | // List of grid sigs we have visited 1019 | List< int > actedGrids = _manager.AcquireListOfNeighbors( _current, _magnitude, true ); 1020 | 1021 | foreach( int sig in actedGrids ) 1022 | { 1023 | AddFootprintToGrid( sig ); 1024 | UpdateDebugVisuals( false, sig, debugPrefab ); 1025 | } 1026 | 1027 | actedGrids.Clear(); 1028 | _manager._intListPool.ReturnObject(actedGrids); 1029 | } 1030 | 1031 | // Remove this occupants area from the grid 1032 | public void Vacate() 1033 | { 1034 | _debugTileCounter = 0; // More straighforward counter for which tile is being updated within UpdateDebugVisuals 1035 | 1036 | // List of grid sigs we have visited 1037 | List< int > actedGrids = _manager.AcquireListOfNeighbors( _current, _magnitude, true ); 1038 | foreach( int sig in actedGrids ) 1039 | { 1040 | RemoveFootprintFromGrid( sig ); 1041 | UpdateDebugVisuals( true, sig, null ); 1042 | } 1043 | 1044 | actedGrids.Clear(); 1045 | _manager._intListPool.ReturnObject(actedGrids); 1046 | } 1047 | 1048 | private void AddFootprintToGrid( int sig ) 1049 | { 1050 | List< int > bucket = null; 1051 | if( _manager._occupantBuckets.TryGetValue( sig, out bucket ) ) 1052 | { 1053 | if( !bucket.Contains( _id ) ) 1054 | { 1055 | bucket.Add( _id ); 1056 | } 1057 | } else { 1058 | bucket = _manager._intListPool.GetObject(); 1059 | bucket.Add( _id ); 1060 | _manager._occupantBuckets.Add( sig, bucket ); 1061 | } 1062 | } 1063 | 1064 | private void RemoveFootprintFromGrid( int sig ) 1065 | { 1066 | List< int > bucket = null; 1067 | if( _manager._occupantBuckets.TryGetValue( sig, out bucket ) ) 1068 | { 1069 | bucket.Remove( _id ); 1070 | 1071 | if( bucket.Count == 0 ) 1072 | { 1073 | bucket.Clear(); 1074 | _manager._intListPool.ReturnObject( bucket ); 1075 | _manager._occupantBuckets.Remove( sig ); 1076 | } 1077 | } 1078 | } 1079 | 1080 | private void UpdateDebugVisuals( bool remove, int sig, GameObject debugPrefab ) 1081 | { 1082 | if( !remove && _manager.ShowDebug && _manager.OccupiedTilePrefab != null ) 1083 | { 1084 | // Attempt to reuse a grid 1085 | if( _debugTileCounter >= debugVisuals.Count ) 1086 | { 1087 | GameObject newVisual = Instantiate( debugPrefab ) as GameObject; 1088 | Hex hex = newVisual.GetComponent< Hex >(); 1089 | if( hex != null ) 1090 | { 1091 | float factor = ( _trackedGameObject == null ) ? 0.8f : 0.9f; 1092 | hex.GridSize = _manager.GridSize * factor; 1093 | } 1094 | newVisual.transform.parent = _manager.transform; 1095 | debugVisuals.Add( newVisual ); 1096 | } 1097 | 1098 | int x, y; 1099 | Vector3 pos = Vector3.zero; 1100 | 1101 | _manager.SigToGrid( sig, out x, out y ); 1102 | _manager.GridToPosition( x, y, ref pos ); 1103 | 1104 | debugVisuals[ _debugTileCounter ].transform.position = pos + (Vector3.up * _manager.OccupiedDebugYPosition); 1105 | 1106 | // Re-use pos 1107 | pos.Set( x, 0, y ); 1108 | debugVisuals[ _debugTileCounter ].gameObject.SetActive( _manager.IsValid( pos ) ); 1109 | 1110 | _debugTileCounter++; 1111 | } 1112 | } 1113 | } 1114 | 1115 | // Simple class to support templated object pooling 1116 | protected class GenericPool { 1117 | private Stack< T > _pool = new Stack< T >(); 1118 | 1119 | public delegate T CreateObject(); 1120 | 1121 | private CreateObject _func = null; 1122 | 1123 | private int _outstanding = 0; 1124 | private int _highwater = 0; 1125 | public GenericPool( CreateObject func ) 1126 | { 1127 | _func = func; 1128 | } 1129 | 1130 | ~GenericPool() 1131 | { 1132 | _pool.Clear(); 1133 | } 1134 | 1135 | public T GetObject() 1136 | { 1137 | T obj = default(T); 1138 | 1139 | if (_pool.Count > 0) { 1140 | obj = _pool.Pop(); 1141 | } else { 1142 | _highwater++; 1143 | obj = _func(); 1144 | } 1145 | _outstanding++; 1146 | 1147 | return obj; 1148 | } 1149 | 1150 | public void ReturnObject( T obj ) 1151 | { 1152 | _outstanding--; 1153 | _pool.Push(obj); 1154 | } 1155 | 1156 | public void PrintStats() 1157 | { 1158 | Debug.Log("GenericPool stats: (" + typeof(T).ToString() + "): " + _pool.Count + " in queue, " + _outstanding + " outstanding, "+_highwater+" max"); 1159 | } 1160 | }; 1161 | #endregion 1162 | } 1163 | -------------------------------------------------------------------------------- /SampleProject/Assets/HexGridManager/HexGridManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 887b71a423ab43046aa56d3b95b4c410 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb22c1a228ecc164983c53ef55a94f9a 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/Materials/Floor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 3 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Floor 10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: [] 12 | m_CustomRenderQueue: -1 13 | m_SavedProperties: 14 | serializedVersion: 2 15 | m_TexEnvs: 16 | data: 17 | first: 18 | name: _MainTex 19 | second: 20 | m_Texture: {fileID: 2800000, guid: 935d78249049dfe4d83883bb9f682f6c, type: 3} 21 | m_Scale: {x: 1, y: 1} 22 | m_Offset: {x: 0, y: 0} 23 | m_Floats: {} 24 | m_Colors: 25 | data: 26 | first: 27 | name: _Color 28 | second: {r: 1, g: 1, b: 1, a: 1} 29 | -------------------------------------------------------------------------------- /SampleProject/Assets/Materials/Floor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 220cb4b9d41efc94994ee8cf07505c55 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/RandomMovement.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1890de2f034271545bb3953b1eb8d282 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/RandomMovement.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76563535ef9703c47987c2f774dbbcaa 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/RandomMovement/NavMesh.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!238 &23800000 4 | NavMeshData: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: NavMesh 9 | m_NavMeshTiles: 10 | - m_MeshData: 56414e4410000000ffffffffffffffff00000000090000001200000009000000000000001000000012000000aaaa2ac29a9919beaaaa2ac20000000099998140000000000100c040aaaabac18088883c505515c054555dc18088883c505515c0545565c18088883c505535c0545565c18088883c000058c154555dc18088883c000060c1000000008088883c000060c1000000008088883c000078c1000060c18088883c000078c1555581c18088883c545575c1555581c18088883c545565c1555585c18088883c54555dc1aaaabac18088883c54555dc1545515c18088883c505515c0000000008088883c545515c154550dc18088883c545515c154550dc18088883c505535c0aaaabac18088883c00000000000000008088883c000000000700080009000000000000000000000002000000000000000100000003000000070009000a00030004000000010000000400000005000000010000000500000000000100020000000000000007000000040000000000000001000000030000000a000b0000000200030000000000000003000000020000000100000005000000040005000600070000000000000000800000020000000000010000000400000011000c000100100000000000080000000700028000000000010000000400000001000000100000000000000003000000060000000000000001000000030000000f000c00110000000000000000000600090000000000000001000000030000000d000e000f001100000000000000000008000080000000000100000004000000000000000000000000000100000000000100000000000300000000000400000000000100000000000500000000000300000000000800000000000200000000000a00000000000200000000000c00000000000100000000000d00000000000100000000000e00000000000200010002000000150003000400010001000400000001000500010002000300050001000200000015000300040000000500000001000200050002000300000001000200030000000500000001000200050002000300010011000300000001000500010002000000150001000200000015000200030000000500000001000200050074000000a300000106000001efffffff74000000ad00000106000001f9ffffff74000000ef00ad0006000001fdffffff74000000f200ad00060000010600000074000000ef00ad000600f2000200000074000000ad00000106000001fdffffff74000000ad00aa000600f2000300000074000000f200000106000001050000009c000000a300000106000001f7ffffff9c000000a300ad000600af00fdffffff9c000000a300ad000600af00010000009f000000a300ac000600aa0000000000ac000000a300000106000001fbffffffac000000a30000010600ac0004000000c8000000c800000106000001fdffffffc8000000ef0000010600000107000000cb000000c8000001060000010800000000000000000000000000000000000000 11 | - m_MeshData: 56414e441000000000000000ffffffff00000000040000000b00000004000000000000000700000008000000000000009a9919beaaaa2ac2aaaa2a4299998140000000000100c040000000008088883c000060c1ffff5f418088883c000060c1ffff67418088883c000058c1ffff67418088883c00000000aaaa82418088883c00000000aaaa82418088883c545575c1000000008088883c000078c1000000008088883c00000000ffff1f418088883c00000000ffff1f418088883c545515c1000000008088883c545515c10200030004000500000000000000028000000300000000000100000004000000010005000600000000000000030000000480000000000000010000000400000001000200050000000000000000000100020000000000000001000000030000000700080009000a00000000000280000000000480000000000100000004000000000000000000000000000200000000000200000000000200000000000400000000000100000000000500000000000200020003000000050000000100020005000200030000000500000001000200050001000200000015000200030001001100030000000100050000000000a300620006000001f9ffffff00000000a300620006000001fdffffff00000000a30062000600ac000100000000000000c8003c00060000010300000054000000a400620006000001fdffffff54000000a40062000600af000200000057000000a4006200060000010000000000000000000000000000000000000000 12 | - m_MeshData: 56414e4410000000ffffffff0000000000000000090000001100000009000000000000001000000012000000aaaa2ac29a9919be000000000000000099998140aaaa2a420100c040aaaabac18088883c5555154054555dc18088883c55551540545515c18088883c55551540000000008088883c00000000aaaabac18088883c00000000000000008088883caaaa8241000000008088883c54556d4154555dc18088883c54556d41545565c18088883c54556541545565c18088883c55553540aaaabac18088883c54556541555585c18088883c54556541555581c18088883c54556d41555581c18088883caaaa8241000000008088883cffff174154550dc18088883c5555354054550dc18088883cffff17410c000d000700080000000000000006000000070000000000010000000400000004000000010000000000000000000400030000000000000001000000030000000100020003000400000000000000080006800200000000000100000004000000090001000000000000000000000002000500000000000000010000000300000000000a000b0009000000000000000000070004000000000001000000040000000500060007000d00000000000080000001000000000000000100000004000000080009000b000c00000000000000050000000100000000000100000004000000030002000f0000000000000003000000090000000000000001000000030000000f0010000e000300000000000000000000800800000000000100000004000000000000000000000000000200000000000200000000000100000000000300000000000300000000000600000000000100000000000700000000000200000000000900000000000200000000000b00000000000200000000000d00000000000100000000000e000000000002000200030000000500000001000200050001000200000015000200030001001100030000000200110000000100020005000100020000001500020003000000050000000100020005000200030000000500000001000200050002000300000005000000010002000500010002000000150002000300000005000000010002000500740000000000000106006200efffffff740000000000000106005600f9ffffff740000000000000106000e00fdffffff740000000000ad0006000e0001000000740000000000000106000e0002000000740000000e00ad0006005600fdffffff740000000e00ad000600110003000000740000000e00aa0006005600040000009c0000000000000106006200f7ffffff9c0000001100ad0006006200fdffffff9c0000001100aa0006005900060000009f0000005600ad0006006200000000009f0000000000000106006200fbffffffc80000000000000106001100070000009f0000000000000106006200fdffffffcb0000000000000106003900080000009f00000059000001060062000500000000000000000000000000000000000000 13 | - m_MeshData: 56414e4410000000000000000000000000000000040000000b00000004000000000000000700000008000000000000009a9919be00000000aaaa2a4299998140aaaa2a420100c040000000008088883cffff1741ffff1f418088883cffff1741ffff1f418088883c00000000000000008088883c00000000000000008088883c54556d41000000008088883caaaa8241aaaa82418088883caaaa8241aaaa82418088883c00000000ffff67418088883c00000000ffff67418088883c54556541ffff5f418088883c54556d4100000100020003000000000000000000068004800000000001000000040000000a00040005000600000000000000048000000400000000000100000004000000070008000900060000000000068000000400000000000000010000000400000009000a00060000000000000000000200030000000000000001000000030000000000000000000000000002000000000002000000000002000000000004000000000002000000000006000000000001000200030001001100030000000100050002000300000005000000010002000500020003000000050000000100020005000100020000001500000000000000620006006200f9ffffff000000000000620006006200fdffffff0000000000003c00060039000000000000000000590062000600620001000000540000000000620006006200fdffffff570000000000620006006200020000005400000056006200060062000300000000000000000000000000000000000000 14 | m_NavMeshParams: 15 | tileSize: 42.666664 16 | walkableHeight: 1.9999999 17 | walkableRadius: 0.49999997 18 | walkableClimb: 0.41666663 19 | cellSize: 0.16666666 20 | m_Heightmaps: [] 21 | m_HeightMeshes: [] 22 | m_OffMeshLinks: [] 23 | -------------------------------------------------------------------------------- /SampleProject/Assets/RandomMovement/NavMesh.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae0c1fafb2b5c074ba23717a632de7d6 3 | timeCreated: 1453248867 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8857a371ab1ff7d48a3081d198ec5ff0 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/CharacterAdder.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class CharacterAdder : MonoBehaviour { 5 | public GameObject characterPrefab = null; 6 | // Use this for initialization 7 | void Start () { 8 | 9 | } 10 | 11 | // Update is called once per frame 12 | void Update () { 13 | if (Input.GetMouseButtonUp(0) ) 14 | { 15 | if( characterPrefab != null ) 16 | { 17 | GameObject o = Instantiate( characterPrefab ) as GameObject; 18 | o.transform.position = Vector3.zero; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/CharacterAdder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: baf5994501dfef649a2d6115a09b4d18 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/RandomMover.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class RandomMover : MonoBehaviour { 5 | 6 | public bool roam = false; 7 | 8 | private HexGridManager _gridManager = null; 9 | private NavMeshAgent _navAgent = null; 10 | private HexGridManager.Occupant _occupant = null; 11 | private Vector3 tempGrid = Vector3.zero; 12 | 13 | // Use this for initialization 14 | void Start () { 15 | GameObject gridContainer = GameObject.FindGameObjectWithTag("GridContainer"); 16 | _gridManager = gridContainer.GetComponent< HexGridManager >(); 17 | _navAgent = GetComponent< NavMeshAgent >(); 18 | _occupant = _gridManager.CreateOccupant(gameObject, 1); 19 | } 20 | 21 | void OnDestroy() 22 | { 23 | _gridManager.ReturnOccupant(ref _occupant); 24 | } 25 | 26 | // Update is called once per frame 27 | void Update () { 28 | 29 | float mag = _navAgent.velocity.sqrMagnitude; 30 | if ( mag < 0.001f && roam ) 31 | { 32 | GetNewDestination(); 33 | } 34 | } 35 | 36 | void OnGridChanged() 37 | { 38 | if( _gridManager.IsOccupied( tempGrid ) ) 39 | { 40 | GetNewDestination(); 41 | } 42 | } 43 | 44 | void GetNewDestination() 45 | { 46 | tempGrid.Set(Random.Range(-70, 70), 0, Random.Range(-70, 70)); 47 | 48 | if (_gridManager.IsValid(tempGrid) && !_gridManager.IsOccupied(tempGrid)) 49 | { 50 | Vector3 destination = Vector3.zero; 51 | _gridManager.GridToPosition( tempGrid, ref destination ); 52 | _navAgent.destination = destination; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/RandomMover.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcacd37bfd4df5645b2a7613a79fc51d 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/SwarmTarget.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class SwarmTarget : MonoBehaviour { 5 | 6 | private HexGridManager _gridContainer = null; 7 | 8 | private HexGridManager.Occupant _occupant = null; 9 | 10 | public int swarmCount = 0; 11 | 12 | // Use this for initialization 13 | void Start () { 14 | GameObject gridContainer = GameObject.FindGameObjectWithTag("GridContainer"); 15 | _gridContainer = gridContainer.GetComponent< HexGridManager >(); 16 | _occupant = _gridContainer.CreateOccupant(gameObject, 1); 17 | } 18 | 19 | void OnDestroy() 20 | { 21 | _gridContainer.ReturnOccupant(ref _occupant); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/SwarmTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 499a4121c044ae74bb29b9f0a6486d7d 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/Swarmer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Swarmer : MonoBehaviour { 5 | public static readonly int KeyPositionsAroundTarget = 6; 6 | 7 | private HexGridManager _gridContainer = null; 8 | private NavMeshAgent _navAgent = null; 9 | private SwarmTarget _target = null; 10 | private bool needsDestination = true; 11 | 12 | private HexGridManager.Occupant _occupant = null; 13 | private HexGridManager.Reservation _reservation = null; 14 | 15 | private Vector3 currentGrid = Vector3.zero; 16 | private Vector3 tempGrid = Vector3.zero; 17 | 18 | // Use this for initialization 19 | void Start () { 20 | GameObject gridContainer = GameObject.FindGameObjectWithTag("GridContainer"); 21 | _gridContainer = gridContainer.GetComponent< HexGridManager >(); 22 | 23 | _navAgent = GetComponent< NavMeshAgent >(); 24 | 25 | GameObject swarmGameObject = GameObject.FindGameObjectWithTag ("SwarmTarget"); 26 | _target = swarmGameObject.GetComponent< SwarmTarget > (); 27 | 28 | _occupant = _gridContainer.CreateOccupant(gameObject, 1); 29 | 30 | _gridContainer.PositionToGrid(transform.position, ref currentGrid); 31 | } 32 | 33 | void OnDestroy() 34 | { 35 | _gridContainer.ReturnOccupant(ref _occupant); 36 | _gridContainer.ReturnReservation(ref _reservation); 37 | } 38 | 39 | void FindSwarmDestination() 40 | { 41 | Vector3 dir = ( _target.gameObject.transform.position - gameObject.transform.position ).normalized; 42 | _gridContainer.GetClosestVacantNeighbor(_target.gameObject, ref tempGrid, dir); 43 | Vector3 destination = Vector3.zero; 44 | _gridContainer.GridToPosition(tempGrid, ref destination); 45 | 46 | _navAgent.destination = destination; 47 | _reservation = _gridContainer.CreateReservation(destination); 48 | 49 | needsDestination = false; 50 | } 51 | 52 | // Update is called once per frame 53 | void Update () 54 | { 55 | if ( needsDestination ) 56 | { 57 | FindSwarmDestination(); 58 | } 59 | } 60 | 61 | public void OnGridChanged() 62 | { 63 | if( _reservation != null && _gridContainer.IsOccupied( tempGrid, _reservation, _occupant ) ) 64 | { 65 | _gridContainer.ReturnReservation(ref _reservation); 66 | needsDestination = true; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SampleProject/Assets/Scripts/Swarmer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91d5ebb60196be545821562fc41faa6f 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/SwarmTarget.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 | - 195: {fileID: 19500000} 12 | - 114: {fileID: 11400000} 13 | m_Layer: 0 14 | m_Name: SwarmTarget 15 | m_TagString: SwarmTarget 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!1 &100002 21 | GameObject: 22 | m_ObjectHideFlags: 0 23 | m_PrefabParentObject: {fileID: 0} 24 | m_PrefabInternal: {fileID: 100100000} 25 | serializedVersion: 4 26 | m_Component: 27 | - 4: {fileID: 400002} 28 | - 33: {fileID: 3300000} 29 | - 136: {fileID: 13600000} 30 | - 23: {fileID: 2300000} 31 | m_Layer: 0 32 | m_Name: 3d Mesh 33 | m_TagString: Untagged 34 | m_Icon: {fileID: 0} 35 | m_NavMeshLayer: 0 36 | m_StaticEditorFlags: 0 37 | m_IsActive: 1 38 | --- !u!4 &400000 39 | Transform: 40 | m_ObjectHideFlags: 1 41 | m_PrefabParentObject: {fileID: 0} 42 | m_PrefabInternal: {fileID: 100100000} 43 | m_GameObject: {fileID: 100000} 44 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 45 | m_LocalPosition: {x: 10.9496069, y: 0, z: -.922771454} 46 | m_LocalScale: {x: 1, y: 1, z: 1} 47 | m_Children: 48 | - {fileID: 400002} 49 | m_Father: {fileID: 0} 50 | --- !u!4 &400002 51 | Transform: 52 | m_ObjectHideFlags: 1 53 | m_PrefabParentObject: {fileID: 0} 54 | m_PrefabInternal: {fileID: 100100000} 55 | m_GameObject: {fileID: 100002} 56 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 57 | m_LocalPosition: {x: 0, y: -.529999971, z: 0} 58 | m_LocalScale: {x: 1, y: 1, z: 1} 59 | m_Children: [] 60 | m_Father: {fileID: 400000} 61 | --- !u!23 &2300000 62 | Renderer: 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_CastShadows: 1 69 | m_ReceiveShadows: 1 70 | m_LightmapIndex: 255 71 | m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} 72 | m_Materials: 73 | - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} 74 | m_SubsetIndices: 75 | m_StaticBatchRoot: {fileID: 0} 76 | m_UseLightProbes: 0 77 | m_LightProbeAnchor: {fileID: 0} 78 | m_ScaleInLightmap: 1 79 | m_SortingLayer: 0 80 | m_SortingOrder: 0 81 | m_SortingLayerID: 0 82 | --- !u!33 &3300000 83 | MeshFilter: 84 | m_ObjectHideFlags: 1 85 | m_PrefabParentObject: {fileID: 0} 86 | m_PrefabInternal: {fileID: 100100000} 87 | m_GameObject: {fileID: 100002} 88 | m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} 89 | --- !u!114 &11400000 90 | MonoBehaviour: 91 | m_ObjectHideFlags: 1 92 | m_PrefabParentObject: {fileID: 0} 93 | m_PrefabInternal: {fileID: 100100000} 94 | m_GameObject: {fileID: 100000} 95 | m_Enabled: 1 96 | m_EditorHideFlags: 0 97 | m_Script: {fileID: 11500000, guid: 499a4121c044ae74bb29b9f0a6486d7d, type: 3} 98 | m_Name: 99 | m_EditorClassIdentifier: 100 | swarmCount: 0 101 | --- !u!136 &13600000 102 | CapsuleCollider: 103 | m_ObjectHideFlags: 1 104 | m_PrefabParentObject: {fileID: 0} 105 | m_PrefabInternal: {fileID: 100100000} 106 | m_GameObject: {fileID: 100002} 107 | m_Material: {fileID: 0} 108 | m_IsTrigger: 0 109 | m_Enabled: 0 110 | m_Radius: .5 111 | m_Height: 2 112 | m_Direction: 1 113 | m_Center: {x: 0, y: 0, z: 0} 114 | --- !u!195 &19500000 115 | NavMeshAgent: 116 | m_ObjectHideFlags: 1 117 | m_PrefabParentObject: {fileID: 0} 118 | m_PrefabInternal: {fileID: 100100000} 119 | m_GameObject: {fileID: 100000} 120 | m_Enabled: 1 121 | m_Radius: .200000003 122 | m_Speed: 3.5 123 | m_Acceleration: 8 124 | avoidancePriority: 50 125 | m_AngularSpeed: 2 126 | m_StoppingDistance: 0 127 | m_AutoTraverseOffMeshLink: 1 128 | m_AutoBraking: 1 129 | m_AutoRepath: 1 130 | m_Height: 2 131 | m_BaseOffset: 1 132 | m_WalkableMask: 4294967295 133 | m_ObstacleAvoidanceType: 4 134 | --- !u!1001 &100100000 135 | Prefab: 136 | m_ObjectHideFlags: 1 137 | serializedVersion: 2 138 | m_Modification: 139 | m_TransformParent: {fileID: 0} 140 | m_Modifications: [] 141 | m_RemovedComponents: [] 142 | m_ParentPrefab: {fileID: 0} 143 | m_RootGameObject: {fileID: 100000} 144 | m_IsPrefabParent: 1 145 | m_IsExploded: 1 146 | -------------------------------------------------------------------------------- /SampleProject/Assets/SwarmTarget.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fcfcb62c85f15544ca6eb7df947a221f 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/Swarmer.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 | - 33: {fileID: 3300000} 12 | - 136: {fileID: 13600000} 13 | - 23: {fileID: 2300000} 14 | m_Layer: 0 15 | m_Name: 3d Mesh 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!1 &100002 22 | GameObject: 23 | m_ObjectHideFlags: 0 24 | m_PrefabParentObject: {fileID: 0} 25 | m_PrefabInternal: {fileID: 100100000} 26 | serializedVersion: 4 27 | m_Component: 28 | - 4: {fileID: 400002} 29 | - 195: {fileID: 19500000} 30 | - 114: {fileID: 11400000} 31 | m_Layer: 0 32 | m_Name: Swarmer 33 | m_TagString: Untagged 34 | m_Icon: {fileID: 0} 35 | m_NavMeshLayer: 0 36 | m_StaticEditorFlags: 0 37 | m_IsActive: 1 38 | --- !u!4 &400000 39 | Transform: 40 | m_ObjectHideFlags: 1 41 | m_PrefabParentObject: {fileID: 0} 42 | m_PrefabInternal: {fileID: 100100000} 43 | m_GameObject: {fileID: 100000} 44 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 45 | m_LocalPosition: {x: 0, y: 0, z: 0} 46 | m_LocalScale: {x: 1, y: 1, z: 1} 47 | m_Children: [] 48 | m_Father: {fileID: 400002} 49 | --- !u!4 &400002 50 | Transform: 51 | m_ObjectHideFlags: 1 52 | m_PrefabParentObject: {fileID: 0} 53 | m_PrefabInternal: {fileID: 100100000} 54 | m_GameObject: {fileID: 100002} 55 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 56 | m_LocalPosition: {x: -21.0954037, y: 0, z: -3.59230208} 57 | m_LocalScale: {x: 1, y: 1, z: 1} 58 | m_Children: 59 | - {fileID: 400000} 60 | m_Father: {fileID: 0} 61 | --- !u!23 &2300000 62 | Renderer: 63 | m_ObjectHideFlags: 1 64 | m_PrefabParentObject: {fileID: 0} 65 | m_PrefabInternal: {fileID: 100100000} 66 | m_GameObject: {fileID: 100000} 67 | m_Enabled: 1 68 | m_CastShadows: 1 69 | m_ReceiveShadows: 1 70 | m_LightmapIndex: 255 71 | m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} 72 | m_Materials: 73 | - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} 74 | m_SubsetIndices: 75 | m_StaticBatchRoot: {fileID: 0} 76 | m_UseLightProbes: 0 77 | m_LightProbeAnchor: {fileID: 0} 78 | m_ScaleInLightmap: 1 79 | m_SortingLayer: 0 80 | m_SortingOrder: 0 81 | m_SortingLayerID: 0 82 | --- !u!33 &3300000 83 | MeshFilter: 84 | m_ObjectHideFlags: 1 85 | m_PrefabParentObject: {fileID: 0} 86 | m_PrefabInternal: {fileID: 100100000} 87 | m_GameObject: {fileID: 100000} 88 | m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} 89 | --- !u!114 &11400000 90 | MonoBehaviour: 91 | m_ObjectHideFlags: 1 92 | m_PrefabParentObject: {fileID: 0} 93 | m_PrefabInternal: {fileID: 100100000} 94 | m_GameObject: {fileID: 100002} 95 | m_Enabled: 1 96 | m_EditorHideFlags: 0 97 | m_Script: {fileID: 11500000, guid: 91d5ebb60196be545821562fc41faa6f, type: 3} 98 | m_Name: 99 | m_EditorClassIdentifier: 100 | --- !u!136 &13600000 101 | CapsuleCollider: 102 | m_ObjectHideFlags: 1 103 | m_PrefabParentObject: {fileID: 0} 104 | m_PrefabInternal: {fileID: 100100000} 105 | m_GameObject: {fileID: 100000} 106 | m_Material: {fileID: 0} 107 | m_IsTrigger: 0 108 | m_Enabled: 0 109 | m_Radius: .5 110 | m_Height: 2 111 | m_Direction: 1 112 | m_Center: {x: 0, y: 0, z: 0} 113 | --- !u!195 &19500000 114 | NavMeshAgent: 115 | m_ObjectHideFlags: 1 116 | m_PrefabParentObject: {fileID: 0} 117 | m_PrefabInternal: {fileID: 100100000} 118 | m_GameObject: {fileID: 100002} 119 | m_Enabled: 1 120 | m_Radius: .200000003 121 | m_Speed: 3.5 122 | m_Acceleration: 8 123 | avoidancePriority: 50 124 | m_AngularSpeed: 2 125 | m_StoppingDistance: 0 126 | m_AutoTraverseOffMeshLink: 1 127 | m_AutoBraking: 1 128 | m_AutoRepath: 1 129 | m_Height: 2 130 | m_BaseOffset: 1 131 | m_WalkableMask: 4294967295 132 | m_ObstacleAvoidanceType: 4 133 | --- !u!1001 &100100000 134 | Prefab: 135 | m_ObjectHideFlags: 1 136 | serializedVersion: 2 137 | m_Modification: 138 | m_TransformParent: {fileID: 0} 139 | m_Modifications: [] 140 | m_RemovedComponents: [] 141 | m_ParentPrefab: {fileID: 0} 142 | m_RootGameObject: {fileID: 100002} 143 | m_IsPrefabParent: 1 144 | m_IsExploded: 1 145 | -------------------------------------------------------------------------------- /SampleProject/Assets/Swarmer.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: caf4d871689cf0a4fa61e2c2fd4545fb 3 | NativeFormatImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/Swarming.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2b73e9daa48ae24d8ae9418b52b11ef 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/Swarming.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ec04b859b694f943a11ba1439065c44 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /SampleProject/Assets/Swarming/NavMesh.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!238 &23800000 4 | NavMeshData: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: NavMesh 9 | m_NavMeshTiles: 10 | - m_MeshData: 56414e4410000000ffffffffffffffff0000000005000000090000000500000000000000070000000a000000aaaa2ac29a9919beaaaa2ac20000000099998140000000000100c040aaaae2c18088883c000080bf0000e0c08088883c000080bfaaaa9ec18088883cacaa22c1ffffabc18088883c000030c1a8aacac08088883c000080bf000000008088883c000080bf000000008088883c54551dc1ffffe7c18088883c00000000000000008088883c0000000000000100020003000000000005000000000000000000000001000000040000000400050006000000000000000300008000000000000000000100000003000000080005000400000000000000008002000400000000000000010000000300000008000400010000000000000003000000050000000000000001000000030000000700080001000000000000000280040001000000000000000100000004000000000000000000000000000200000000000200000000000100000000000300000000000100000000000400000000000100000000000500000000000200020003000000050000000100020005000100020000001500010002000000150001000200000015000200030000000500000001000200050052000000be00000106000001f7ffffff52000000be00000106000001fdffffff52000000fa000001060000010400000056000000be00d6000600fa0000000000d6000000c500000106000001fbffffffda000000c50000010600fa0001000000d6000000fa00000106000001fdffffffd6000000fa0000010600000103000000da000000fa000001060000010200000000000000000000000000000000000000 11 | - m_MeshData: 56414e441000000000000000ffffffff00000000010000000600000001000000000000000400000002000000000000009a9919beaaaa2ac2aaaa2a4299998140000000000100c040000000008088883c54551dc1000000008088883c00000000555581418088883c00000000ffff9b418088883c0000a0c0555585408088883caaaa7ac1aaaa4a408088883caaaa6ac10400050000000100020003000000000004800280000000000100000006000000000000000000000000000400040005000100010005000000010005000100020004000100020003000400050000000000a2007500060000010000000000000000000000000000000000000000 12 | - m_MeshData: 56414e4410000000ffffffff000000000000000005000000090000000500000000000000070000000a000000aaaa2ac29a9919be000000000000000099998140aaaa2a420100c040ffffebc18088883caaaa2a3fa8aacac08088883caaaa2a3f5855b5c08088883caaaa2a3f000000008088883caaaa2a3f000000008088883c00000000ffffe7c18088883c00000000aaaa00c28088883cffff8f40555585c18088883c54557541000000008088883cffff8f400200030004000000000000000500008002000000000000000100000003000000010002000400000000000000000001000300000000000000010000000300000001000400050000000000000002000680000004000000000001000000040000000000060007000100000000000000000000000300000000000100000004000000080003000200000000000000008001000000000000000000010000000300000000000000000000000000010000000000010000000000010000000000020000000000020000000000040000000000020000000000060000000000010001000200000015000100020000001500020003000000050000000100020005000200030000000500000001000200050001000200000015003f0000000000000106005c00f7ffffff3f0000000000000106005c00fdffffff3f0000000400da0006005c00030000004f000000000000010600040002000000da0000000000000106001b00fbffffffda000000000000010600040001000000de0000000000000106001b00fdffffffde000000000000010600040000000000de0000000400000106001b000400000000000000000000000000000000000000 13 | - m_MeshData: 56414e4410000000000000000000000000000000010000000500000001000000000000000300000002000000000000009a9919be00000000aaaa2a4299998140aaaa2a420100c040000000008088883cffff8f40aaaaaa3e8088883cffff9f4055550d418088883caaaa2a41555581418088883c00000000000000008088883c0000000004000000010002000300000004800000000000000680000001000000050000000000000000000000000003000300040002001100040000000200010000000100020005000000000000006100060040000000000000000000000000000000000000000000 14 | m_NavMeshParams: 15 | tileSize: 42.666664 16 | walkableHeight: 1.9999999 17 | walkableRadius: 0.49999997 18 | walkableClimb: 0.41666663 19 | cellSize: 0.16666666 20 | m_Heightmaps: [] 21 | m_HeightMeshes: [] 22 | m_OffMeshLinks: [] 23 | -------------------------------------------------------------------------------- /SampleProject/Assets/Swarming/NavMesh.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84782399bf47caa4f99b335ac8c15aeb 3 | timeCreated: 1453249172 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /SampleProject/Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40555d7a7b592704da9f60608d8c0090 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /SampleProject/Assets/Textures/White.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jconstable/HexGridManager/2a8abd328ddb68eaa670530942e052cf9bd49ad1/SampleProject/Assets/Textures/White.png -------------------------------------------------------------------------------- /SampleProject/Assets/Textures/White.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 935d78249049dfe4d83883bb9f682f6c 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 1 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: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | spriteMode: 0 34 | spriteExtrude: 1 35 | spriteMeshType: 1 36 | alignment: 0 37 | spritePivot: {x: .5, y: .5} 38 | spritePixelsToUnits: 100 39 | alphaIsTransparency: 0 40 | textureType: -1 41 | buildTargetSettings: [] 42 | spriteSheet: 43 | sprites: [] 44 | spritePackingTag: 45 | userData: 46 | -------------------------------------------------------------------------------- /SampleProject/GridMesh-csharp.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2008 3 | 4 | Project("{6D3163EA-22B6-E3E9-CEC4-4E8A34ED3C5F}") = "GridMesh", "Assembly-CSharp-vs.csproj", "{7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}" 5 | EndProject 6 | Project("{6D3163EA-22B6-E3E9-CEC4-4E8A34ED3C5F}") = "GridMesh", "Assembly-CSharp-Editor-vs.csproj", "{E0F1C0BD-B537-1071-F676-5A6B91D034D9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(MonoDevelopProperties) = preSolution 27 | StartupItem = Assembly-CSharp.csproj 28 | Policies = $0 29 | $0.TextStylePolicy = $1 30 | $1.inheritsSet = VisualStudio 31 | $1.inheritsScope = text/plain 32 | $1.scope = text/x-csharp 33 | $0.CSharpFormattingPolicy = $2 34 | $2.IndentSwitchBody = True 35 | $2.AnonymousMethodBraceStyle = NextLine 36 | $2.PropertyBraceStyle = NextLine 37 | $2.PropertyGetBraceStyle = NextLine 38 | $2.PropertySetBraceStyle = NextLine 39 | $2.EventBraceStyle = NextLine 40 | $2.EventAddBraceStyle = NextLine 41 | $2.EventRemoveBraceStyle = NextLine 42 | $2.StatementBraceStyle = NextLine 43 | $2.ArrayInitializerBraceStyle = NextLine 44 | $2.BeforeMethodDeclarationParentheses = False 45 | $2.BeforeMethodCallParentheses = False 46 | $2.BeforeConstructorDeclarationParentheses = False 47 | $2.BeforeDelegateDeclarationParentheses = False 48 | $2.NewParentheses = False 49 | $2.inheritsSet = Mono 50 | $2.inheritsScope = text/x-csharp 51 | $2.scope = text/x-csharp 52 | $0.TextStylePolicy = $3 53 | $3.FileWidth = 120 54 | $3.TabWidth = 4 55 | $3.EolMarker = Unix 56 | $3.inheritsSet = Mono 57 | $3.inheritsScope = text/plain 58 | $3.scope = text/plain 59 | EndGlobalSection 60 | 61 | EndGlobal 62 | -------------------------------------------------------------------------------- /SampleProject/GridMesh.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2008 3 | 4 | Project("{6D3163EA-22B6-E3E9-CEC4-4E8A34ED3C5F}") = "GridMesh", "Assembly-CSharp.csproj", "{7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}" 5 | EndProject 6 | Project("{6D3163EA-22B6-E3E9-CEC4-4E8A34ED3C5F}") = "GridMesh", "Assembly-CSharp-Editor.csproj", "{E0F1C0BD-B537-1071-F676-5A6B91D034D9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7EF3E3CF-22F1-9E61-44E2-E14C1BB2C60D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {E0F1C0BD-B537-1071-F676-5A6B91D034D9}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(MonoDevelopProperties) = preSolution 27 | StartupItem = Assembly-CSharp.csproj 28 | Policies = $0 29 | $0.TextStylePolicy = $1 30 | $1.inheritsSet = VisualStudio 31 | $1.inheritsScope = text/plain 32 | $1.scope = text/x-csharp 33 | $0.CSharpFormattingPolicy = $2 34 | $2.IndentSwitchBody = True 35 | $2.AnonymousMethodBraceStyle = NextLine 36 | $2.PropertyBraceStyle = NextLine 37 | $2.PropertyGetBraceStyle = NextLine 38 | $2.PropertySetBraceStyle = NextLine 39 | $2.EventBraceStyle = NextLine 40 | $2.EventAddBraceStyle = NextLine 41 | $2.EventRemoveBraceStyle = NextLine 42 | $2.StatementBraceStyle = NextLine 43 | $2.ArrayInitializerBraceStyle = NextLine 44 | $2.BeforeMethodDeclarationParentheses = False 45 | $2.BeforeMethodCallParentheses = False 46 | $2.BeforeConstructorDeclarationParentheses = False 47 | $2.BeforeDelegateDeclarationParentheses = False 48 | $2.NewParentheses = False 49 | $2.inheritsSet = Mono 50 | $2.inheritsScope = text/x-csharp 51 | $2.scope = text/x-csharp 52 | $0.TextStylePolicy = $3 53 | $3.FileWidth = 120 54 | $3.TabWidth = 4 55 | $3.EolMarker = Unix 56 | $3.inheritsSet = Mono 57 | $3.inheritsScope = text/plain 58 | $3.scope = text/plain 59 | EndGlobalSection 60 | 61 | EndGlobal 62 | -------------------------------------------------------------------------------- /SampleProject/GridMesh.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SampleProject/NavMeshTest-csharp.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2008 3 | 4 | Project("{F9EE1E8B-B936-07E8-8B0F-ECAD7DFE8F61}") = "NavMeshTest", "Assembly-CSharp-vs.csproj", "{4116B381-B91C-8535-C39E-8D5E22BB1FCA}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(MonoDevelopProperties) = preSolution 21 | StartupItem = Assembly-CSharp.csproj 22 | Policies = $0 23 | $0.TextStylePolicy = $1 24 | $1.inheritsSet = VisualStudio 25 | $1.inheritsScope = text/plain 26 | $1.scope = text/x-csharp 27 | $0.CSharpFormattingPolicy = $2 28 | $2.IndentSwitchBody = True 29 | $2.AnonymousMethodBraceStyle = NextLine 30 | $2.PropertyBraceStyle = NextLine 31 | $2.PropertyGetBraceStyle = NextLine 32 | $2.PropertySetBraceStyle = NextLine 33 | $2.EventBraceStyle = NextLine 34 | $2.EventAddBraceStyle = NextLine 35 | $2.EventRemoveBraceStyle = NextLine 36 | $2.StatementBraceStyle = NextLine 37 | $2.ArrayInitializerBraceStyle = NextLine 38 | $2.BeforeMethodDeclarationParentheses = False 39 | $2.BeforeMethodCallParentheses = False 40 | $2.BeforeConstructorDeclarationParentheses = False 41 | $2.BeforeDelegateDeclarationParentheses = False 42 | $2.NewParentheses = False 43 | $2.inheritsSet = Mono 44 | $2.inheritsScope = text/x-csharp 45 | $2.scope = text/x-csharp 46 | $0.TextStylePolicy = $3 47 | $3.FileWidth = 120 48 | $3.TabWidth = 4 49 | $3.EolMarker = Unix 50 | $3.inheritsSet = Mono 51 | $3.inheritsScope = text/plain 52 | $3.scope = text/plain 53 | EndGlobalSection 54 | 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /SampleProject/NavMeshTest-csharp.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /SampleProject/NavMeshTest.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2008 3 | 4 | Project("{F9EE1E8B-B936-07E8-8B0F-ECAD7DFE8F61}") = "NavMeshTest", "Assembly-CSharp.csproj", "{4116B381-B91C-8535-C39E-8D5E22BB1FCA}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {4116B381-B91C-8535-C39E-8D5E22BB1FCA}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(MonoDevelopProperties) = preSolution 21 | StartupItem = Assembly-CSharp.csproj 22 | Policies = $0 23 | $0.TextStylePolicy = $1 24 | $1.inheritsSet = VisualStudio 25 | $1.inheritsScope = text/plain 26 | $1.scope = text/x-csharp 27 | $0.CSharpFormattingPolicy = $2 28 | $2.IndentSwitchBody = True 29 | $2.AnonymousMethodBraceStyle = NextLine 30 | $2.PropertyBraceStyle = NextLine 31 | $2.PropertyGetBraceStyle = NextLine 32 | $2.PropertySetBraceStyle = NextLine 33 | $2.EventBraceStyle = NextLine 34 | $2.EventAddBraceStyle = NextLine 35 | $2.EventRemoveBraceStyle = NextLine 36 | $2.StatementBraceStyle = NextLine 37 | $2.ArrayInitializerBraceStyle = NextLine 38 | $2.BeforeMethodDeclarationParentheses = False 39 | $2.BeforeMethodCallParentheses = False 40 | $2.BeforeConstructorDeclarationParentheses = False 41 | $2.BeforeDelegateDeclarationParentheses = False 42 | $2.NewParentheses = False 43 | $2.inheritsSet = Mono 44 | $2.inheritsScope = text/x-csharp 45 | $2.scope = text/x-csharp 46 | $0.TextStylePolicy = $3 47 | $3.FileWidth = 120 48 | $3.TabWidth = 4 49 | $3.EolMarker = Unix 50 | $3.inheritsSet = Mono 51 | $3.inheritsScope = text/plain 52 | $3.scope = text/plain 53 | EndGlobalSection 54 | 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /SampleProject/NavMeshTest.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/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/Swarming.unity 10 | - enabled: 1 11 | path: Assets/RandomMovement.unity 12 | -------------------------------------------------------------------------------- /SampleProject/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: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: 11 | m_DefaultBehaviorMode: 0 12 | m_SpritePackerMode: 0 13 | -------------------------------------------------------------------------------- /SampleProject/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: 5 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_LegacyDeferred: 14 | m_Mode: 1 15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 16 | m_AlwaysIncludedShaders: 17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 23 | m_PreloadedShaders: [] 24 | m_ShaderSettings: 25 | useScreenSpaceShadows: 1 26 | m_BuildTargetShaderSettings: [] 27 | m_LightmapStripping: 0 28 | m_FogStripping: 0 29 | m_LightmapKeepPlain: 1 30 | m_LightmapKeepDirCombined: 1 31 | m_LightmapKeepDirSeparate: 1 32 | m_LightmapKeepDynamicPlain: 1 33 | m_LightmapKeepDynamicDirCombined: 1 34 | m_LightmapKeepDynamicDirSeparate: 1 35 | m_FogKeepLinear: 1 36 | m_FogKeepExp: 1 37 | m_FogKeepExp2: 1 38 | -------------------------------------------------------------------------------- /SampleProject/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: 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 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/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: -9.81000042} 7 | m_DefaultMaterial: {fileID: 0} 8 | m_VelocityIterations: 8 9 | m_PositionIterations: 3 10 | m_RaycastsHitTriggers: 1 11 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 12 | -------------------------------------------------------------------------------- /SampleProject/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 8 7 | AndroidProfiler: 0 8 | defaultScreenOrientation: 0 9 | targetDevice: 2 10 | useOnDemandResources: 0 11 | accelerometerFrequency: 60 12 | companyName: DefaultCompany 13 | productName: NavMeshTest 14 | defaultCursor: {fileID: 0} 15 | cursorHotspot: {x: 0, y: 0} 16 | m_ShowUnitySplashScreen: 1 17 | m_VirtualRealitySplashScreen: {fileID: 0} 18 | defaultScreenWidth: 1024 19 | defaultScreenHeight: 768 20 | defaultScreenWidthWeb: 960 21 | defaultScreenHeightWeb: 600 22 | m_RenderingPath: 1 23 | m_MobileRenderingPath: 1 24 | m_ActiveColorSpace: 0 25 | m_MTRendering: 1 26 | m_MobileMTRendering: 0 27 | m_Stereoscopic3D: 0 28 | iosShowActivityIndicatorOnLoading: -1 29 | androidShowActivityIndicatorOnLoading: -1 30 | iosAppInBackgroundBehavior: 0 31 | displayResolutionDialog: 1 32 | iosAllowHTTPDownload: 1 33 | allowedAutorotateToPortrait: 1 34 | allowedAutorotateToPortraitUpsideDown: 1 35 | allowedAutorotateToLandscapeRight: 1 36 | allowedAutorotateToLandscapeLeft: 1 37 | useOSAutorotation: 1 38 | use32BitDisplayBuffer: 1 39 | disableDepthAndStencilBuffers: 0 40 | defaultIsFullScreen: 1 41 | defaultIsNativeResolution: 1 42 | runInBackground: 0 43 | captureSingleScreen: 0 44 | Override IPod Music: 0 45 | Prepare IOS For Recording: 0 46 | submitAnalytics: 1 47 | usePlayerLog: 1 48 | bakeCollisionMeshes: 0 49 | forceSingleInstance: 0 50 | resizableWindow: 0 51 | useMacAppStoreValidation: 0 52 | gpuSkinning: 0 53 | xboxPIXTextureCapture: 0 54 | xboxEnableAvatar: 0 55 | xboxEnableKinect: 0 56 | xboxEnableKinectAutoTracking: 0 57 | xboxEnableFitness: 0 58 | visibleInBackground: 0 59 | allowFullscreenSwitch: 1 60 | macFullscreenMode: 2 61 | d3d9FullscreenMode: 1 62 | d3d11FullscreenMode: 1 63 | xboxSpeechDB: 0 64 | xboxEnableHeadOrientation: 0 65 | xboxEnableGuest: 0 66 | xboxEnablePIXSampling: 0 67 | n3dsDisableStereoscopicView: 0 68 | n3dsEnableSharedListOpt: 1 69 | n3dsEnableVSync: 0 70 | uiUse16BitDepthBuffer: 0 71 | xboxOneResolution: 0 72 | ps3SplashScreen: {fileID: 0} 73 | videoMemoryForVertexBuffers: 0 74 | psp2PowerMode: 0 75 | psp2AcquireBGM: 1 76 | wiiUTVResolution: 0 77 | wiiUGamePadMSAA: 1 78 | wiiUSupportsNunchuk: 0 79 | wiiUSupportsClassicController: 0 80 | wiiUSupportsBalanceBoard: 0 81 | wiiUSupportsMotionPlus: 0 82 | wiiUSupportsProController: 0 83 | wiiUAllowScreenCapture: 1 84 | wiiUControllerCount: 0 85 | m_SupportedAspectRatios: 86 | 4:3: 1 87 | 5:4: 1 88 | 16:10: 1 89 | 16:9: 1 90 | Others: 1 91 | bundleIdentifier: com.Company.ProductName 92 | bundleVersion: 1.0 93 | preloadedAssets: [] 94 | metroEnableIndependentInputSource: 0 95 | metroEnableLowLatencyPresentationAPI: 0 96 | xboxOneDisableKinectGpuReservation: 0 97 | virtualRealitySupported: 0 98 | productGUID: 77c1b54e1c716e94d96792051be5a9c2 99 | AndroidBundleVersionCode: 1 100 | AndroidMinSdkVersion: 9 101 | AndroidPreferredInstallLocation: 1 102 | aotOptions: 103 | apiCompatibilityLevel: 2 104 | stripEngineCode: 1 105 | iPhoneStrippingLevel: 0 106 | iPhoneScriptCallOptimization: 0 107 | iPhoneBuildNumber: 0 108 | ForceInternetPermission: 0 109 | ForceSDCardPermission: 0 110 | CreateWallpaper: 0 111 | APKExpansionFiles: 0 112 | preloadShaders: 0 113 | StripUnusedMeshComponents: 0 114 | VertexChannelCompressionMask: 115 | serializedVersion: 2 116 | m_Bits: 238 117 | iPhoneSdkVersion: 988 118 | iPhoneTargetOSVersion: 22 119 | uIPrerenderedIcon: 0 120 | uIRequiresPersistentWiFi: 0 121 | uIRequiresFullScreen: 1 122 | uIStatusBarHidden: 1 123 | uIExitOnSuspend: 0 124 | uIStatusBarStyle: 0 125 | iPhoneSplashScreen: {fileID: 0} 126 | iPhoneHighResSplashScreen: {fileID: 0} 127 | iPhoneTallHighResSplashScreen: {fileID: 0} 128 | iPhone47inSplashScreen: {fileID: 0} 129 | iPhone55inPortraitSplashScreen: {fileID: 0} 130 | iPhone55inLandscapeSplashScreen: {fileID: 0} 131 | iPadPortraitSplashScreen: {fileID: 0} 132 | iPadHighResPortraitSplashScreen: {fileID: 0} 133 | iPadLandscapeSplashScreen: {fileID: 0} 134 | iPadHighResLandscapeSplashScreen: {fileID: 0} 135 | appleTVSplashScreen: {fileID: 0} 136 | iOSLaunchScreenType: 0 137 | iOSLaunchScreenPortrait: {fileID: 0} 138 | iOSLaunchScreenLandscape: {fileID: 0} 139 | iOSLaunchScreenBackgroundColor: 140 | serializedVersion: 2 141 | rgba: 0 142 | iOSLaunchScreenFillPct: 100 143 | iOSLaunchScreenSize: 100 144 | iOSLaunchScreenCustomXibPath: 145 | iOSLaunchScreeniPadType: 0 146 | iOSLaunchScreeniPadImage: {fileID: 0} 147 | iOSLaunchScreeniPadBackgroundColor: 148 | serializedVersion: 2 149 | rgba: 0 150 | iOSLaunchScreeniPadFillPct: 100 151 | iOSLaunchScreeniPadSize: 100 152 | iOSLaunchScreeniPadCustomXibPath: 153 | iOSDeviceRequirements: [] 154 | AndroidTargetDevice: 0 155 | AndroidSplashScreenScale: 0 156 | androidSplashScreen: {fileID: 0} 157 | AndroidKeystoreName: 158 | AndroidKeyaliasName: 159 | AndroidTVCompatibility: 1 160 | AndroidIsGame: 1 161 | androidEnableBanner: 1 162 | m_AndroidBanners: 163 | - width: 320 164 | height: 180 165 | banner: {fileID: 0} 166 | androidGamepadSupportLevel: 0 167 | resolutionDialogBanner: {fileID: 0} 168 | m_BuildTargetIcons: [] 169 | m_BuildTargetBatching: [] 170 | m_BuildTargetGraphicsAPIs: 171 | - m_BuildTarget: WindowsStandaloneSupport 172 | m_APIs: 01000000 173 | m_Automatic: 0 174 | - m_BuildTarget: AndroidPlayer 175 | m_APIs: 08000000 176 | m_Automatic: 0 177 | webPlayerTemplate: APPLICATION:Default 178 | m_TemplateCustomTags: {} 179 | wiiUTitleID: 0005000011000000 180 | wiiUGroupID: 00010000 181 | wiiUCommonSaveSize: 4096 182 | wiiUAccountSaveSize: 2048 183 | wiiUOlvAccessKey: 0 184 | wiiUTinCode: 0 185 | wiiUJoinGameId: 0 186 | wiiUJoinGameModeMask: 0000000000000000 187 | wiiUCommonBossSize: 0 188 | wiiUAccountBossSize: 0 189 | wiiUAddOnUniqueIDs: [] 190 | wiiUMainThreadStackSize: 3072 191 | wiiULoaderThreadStackSize: 1024 192 | wiiUSystemHeapSize: 128 193 | wiiUTVStartupScreen: {fileID: 0} 194 | wiiUGamePadStartupScreen: {fileID: 0} 195 | wiiUProfilerLibPath: 196 | actionOnDotNetUnhandledException: 1 197 | enableInternalProfiler: 0 198 | logObjCUncaughtExceptions: 1 199 | enableCrashReportAPI: 0 200 | locationUsageDescription: 201 | XboxTitleId: 202 | XboxImageXexPath: 203 | XboxSpaPath: 204 | XboxGenerateSpa: 0 205 | XboxDeployKinectResources: 0 206 | XboxSplashScreen: {fileID: 0} 207 | xboxEnableSpeech: 0 208 | xboxAdditionalTitleMemorySize: 0 209 | xboxDeployKinectHeadOrientation: 0 210 | xboxDeployKinectHeadPosition: 0 211 | ps3TitleConfigPath: 212 | ps3DLCConfigPath: 213 | ps3ThumbnailPath: 214 | ps3BackgroundPath: 215 | ps3SoundPath: 216 | ps3NPAgeRating: 12 217 | ps3TrophyCommId: 218 | ps3NpCommunicationPassphrase: 219 | ps3TrophyPackagePath: 220 | ps3BootCheckMaxSaveGameSizeKB: 128 221 | ps3TrophyCommSig: 222 | ps3SaveGameSlots: 1 223 | ps3TrialMode: 0 224 | ps3VideoMemoryForAudio: 0 225 | ps3EnableVerboseMemoryStats: 0 226 | ps3UseSPUForUmbra: 0 227 | ps3EnableMoveSupport: 1 228 | ps3DisableDolbyEncoding: 0 229 | ps4NPAgeRating: 12 230 | ps4NPTitleSecret: 231 | ps4NPTrophyPackPath: 232 | ps4ParentalLevel: 1 233 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 234 | ps4Category: 0 235 | ps4MasterVersion: 01.00 236 | ps4AppVersion: 01.00 237 | ps4AppType: 0 238 | ps4ParamSfxPath: 239 | ps4VideoOutPixelFormat: 0 240 | ps4VideoOutResolution: 4 241 | ps4PronunciationXMLPath: 242 | ps4PronunciationSIGPath: 243 | ps4BackgroundImagePath: 244 | ps4StartupImagePath: 245 | ps4SaveDataImagePath: 246 | ps4SdkOverride: 247 | ps4BGMPath: 248 | ps4ShareFilePath: 249 | ps4ShareOverlayImagePath: 250 | ps4PrivacyGuardImagePath: 251 | ps4NPtitleDatPath: 252 | ps4RemotePlayKeyAssignment: -1 253 | ps4RemotePlayKeyMappingDir: 254 | ps4EnterButtonAssignment: 1 255 | ps4ApplicationParam1: 0 256 | ps4ApplicationParam2: 0 257 | ps4ApplicationParam3: 0 258 | ps4ApplicationParam4: 0 259 | ps4DownloadDataSize: 0 260 | ps4GarlicHeapSize: 2048 261 | ps4Passcode: 5xr84P2R391UXaLHbavJvFZGfO47XWS2 262 | ps4pnSessions: 1 263 | ps4pnPresence: 1 264 | ps4pnFriends: 1 265 | ps4pnGameCustomData: 1 266 | playerPrefsSupport: 0 267 | ps4ReprojectionSupport: 0 268 | ps4UseAudio3dBackend: 0 269 | ps4SocialScreenEnabled: 0 270 | ps4Audio3dVirtualSpeakerCount: 14 271 | ps4attribCpuUsage: 0 272 | ps4PatchPkgPath: 273 | ps4PatchLatestPkgPath: 274 | ps4PatchChangeinfoPath: 275 | ps4attribUserManagement: 0 276 | ps4attribMoveSupport: 0 277 | ps4attrib3DSupport: 0 278 | ps4attribShareSupport: 0 279 | ps4IncludedModules: [] 280 | monoEnv: 281 | psp2Splashimage: {fileID: 0} 282 | psp2NPTrophyPackPath: 283 | psp2NPSupportGBMorGJP: 0 284 | psp2NPAgeRating: 12 285 | psp2NPTitleDatPath: 286 | psp2NPCommsID: 287 | psp2NPCommunicationsID: 288 | psp2NPCommsPassphrase: 289 | psp2NPCommsSig: 290 | psp2ParamSfxPath: 291 | psp2ManualPath: 292 | psp2LiveAreaGatePath: 293 | psp2LiveAreaBackroundPath: 294 | psp2LiveAreaPath: 295 | psp2LiveAreaTrialPath: 296 | psp2PatchChangeInfoPath: 297 | psp2PatchOriginalPackage: 298 | psp2PackagePassword: qVOw5lxuBEBNue7b9PZS0hoI6pgabi9U 299 | psp2KeystoneFile: 300 | psp2MemoryExpansionMode: 0 301 | psp2DRMType: 0 302 | psp2StorageType: 0 303 | psp2MediaCapacity: 0 304 | psp2DLCConfigPath: 305 | psp2ThumbnailPath: 306 | psp2BackgroundPath: 307 | psp2SoundPath: 308 | psp2TrophyCommId: 309 | psp2TrophyPackagePath: 310 | psp2PackagedResourcesPath: 311 | psp2SaveDataQuota: 10240 312 | psp2ParentalLevel: 1 313 | psp2ShortTitle: Not Set 314 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 315 | psp2Category: 0 316 | psp2MasterVersion: 01.00 317 | psp2AppVersion: 01.00 318 | psp2TVBootMode: 0 319 | psp2EnterButtonAssignment: 2 320 | psp2TVDisableEmu: 0 321 | psp2AllowTwitterDialog: 1 322 | psp2Upgradable: 0 323 | psp2HealthWarning: 0 324 | psp2UseLibLocation: 0 325 | psp2InfoBarOnStartup: 0 326 | psp2InfoBarColor: 0 327 | psmSplashimage: {fileID: 0} 328 | spritePackerPolicy: 329 | scriptingDefineSymbols: {} 330 | metroPackageName: NavMeshTest 331 | metroPackageVersion: 332 | metroCertificatePath: 333 | metroCertificatePassword: 334 | metroCertificateSubject: 335 | metroCertificateIssuer: 336 | metroCertificateNotAfter: 0000000000000000 337 | metroApplicationDescription: NavMeshTest 338 | wsaImages: {} 339 | metroTileShortName: 340 | metroCommandLineArgsFile: 341 | metroTileShowName: 1 342 | metroMediumTileShowName: 0 343 | metroLargeTileShowName: 0 344 | metroWideTileShowName: 0 345 | metroDefaultTileSize: 1 346 | metroTileForegroundText: 1 347 | metroTileBackgroundColor: {r: 0, g: 0, b: 0, a: 1} 348 | metroSplashScreenBackgroundColor: {r: 0, g: 0, b: 0, a: 1} 349 | metroSplashScreenUseBackgroundColor: 0 350 | platformCapabilities: {} 351 | metroFTAName: 352 | metroFTAFileTypes: [] 353 | metroProtocolName: 354 | metroCompilationOverrides: 1 355 | blackberryDeviceAddress: 356 | blackberryDevicePassword: 357 | blackberryTokenPath: 358 | blackberryTokenExires: 359 | blackberryTokenAuthor: 360 | blackberryTokenAuthorId: 361 | blackberryCskPassword: 362 | blackberrySaveLogPath: 363 | blackberrySharedPermissions: 0 364 | blackberryCameraPermissions: 0 365 | blackberryGPSPermissions: 0 366 | blackberryDeviceIDPermissions: 0 367 | blackberryMicrophonePermissions: 0 368 | blackberryGamepadSupport: 0 369 | blackberryBuildId: 0 370 | blackberryLandscapeSplashScreen: {fileID: 0} 371 | blackberryPortraitSplashScreen: {fileID: 0} 372 | blackberrySquareSplashScreen: {fileID: 0} 373 | tizenProductDescription: 374 | tizenProductURL: 375 | tizenSigningProfileName: 376 | tizenGPSPermissions: 0 377 | tizenMicrophonePermissions: 0 378 | n3dsUseExtSaveData: 0 379 | n3dsCompressStaticMem: 1 380 | n3dsExtSaveDataNumber: 0x12345 381 | n3dsStackSize: 131072 382 | n3dsTargetPlatform: 2 383 | n3dsRegion: 7 384 | n3dsMediaSize: 0 385 | n3dsLogoStyle: 3 386 | n3dsTitle: GameName 387 | n3dsProductCode: 388 | n3dsApplicationId: 0xFF3FF 389 | stvDeviceAddress: 390 | stvProductDescription: 391 | stvProductAuthor: 392 | stvProductAuthorEmail: 393 | stvProductLink: 394 | stvProductCategory: 0 395 | XboxOneProductId: 396 | XboxOneUpdateKey: 397 | XboxOneSandboxId: 398 | XboxOneContentId: 399 | XboxOneTitleId: 400 | XboxOneSCId: 401 | XboxOneGameOsOverridePath: 402 | XboxOnePackagingOverridePath: 403 | XboxOneAppManifestOverridePath: 404 | XboxOnePackageEncryption: 0 405 | XboxOnePackageUpdateGranularity: 2 406 | XboxOneDescription: 407 | XboxOneIsContentPackage: 0 408 | XboxOneEnableGPUVariability: 0 409 | XboxOneSockets: {} 410 | XboxOneSplashScreen: {fileID: 0} 411 | XboxOneAllowedProductIds: [] 412 | XboxOnePersistentLocalStorageSize: 0 413 | intPropertyNames: 414 | - Android::ScriptingBackend 415 | - Standalone::ScriptingBackend 416 | - iOS::Architecture 417 | - iOS::EnableIncrementalBuildSupportForIl2cpp 418 | - iOS::ScriptingBackend 419 | Android::ScriptingBackend: 0 420 | Standalone::ScriptingBackend: 0 421 | iOS::Architecture: 2 422 | iOS::EnableIncrementalBuildSupportForIl2cpp: 1 423 | iOS::ScriptingBackend: 1 424 | boolPropertyNames: [] 425 | stringPropertyNames: [] 426 | cloudProjectId: 427 | projectName: 428 | organizationId: 429 | cloudEnabled: 0 430 | -------------------------------------------------------------------------------- /SampleProject/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.0f4 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | tags: 6 | - GridContainer 7 | - SwarmTarget 8 | - 9 | Builtin Layer 0: Default 10 | Builtin Layer 1: TransparentFX 11 | Builtin Layer 2: Ignore Raycast 12 | Builtin Layer 3: 13 | Builtin Layer 4: Water 14 | Builtin Layer 5: 15 | Builtin Layer 6: 16 | Builtin Layer 7: 17 | User Layer 8: 18 | User Layer 9: 19 | User Layer 10: 20 | User Layer 11: 21 | User Layer 12: 22 | User Layer 13: 23 | User Layer 14: 24 | User Layer 15: 25 | User Layer 16: 26 | User Layer 17: 27 | User Layer 18: 28 | User Layer 19: 29 | User Layer 20: 30 | User Layer 21: 31 | User Layer 22: 32 | User Layer 23: 33 | User Layer 24: 34 | User Layer 25: 35 | User Layer 26: 36 | User Layer 27: 37 | User Layer 28: 38 | User Layer 29: 39 | User Layer 30: 40 | User Layer 31: 41 | m_SortingLayers: 42 | - name: Default 43 | userID: 0 44 | uniqueID: 0 45 | locked: 0 46 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/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 | -------------------------------------------------------------------------------- /SampleProject/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | UnityPurchasingSettings: 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | UnityAnalyticsSettings: 10 | m_Enabled: 0 11 | m_InitializeOnStartup: 1 12 | m_TestMode: 0 13 | m_TestEventUrl: 14 | m_TestConfigUrl: 15 | -------------------------------------------------------------------------------- /SampleProject/SampleProject-csharp.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2008 3 | 4 | Project("{B2AF7265-7C82-876A-E21A-AC841FBE7B67}") = "SampleProject", "Assembly-CSharp-vs.csproj", "{21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}" 5 | EndProject 6 | Project("{B2AF7265-7C82-876A-E21A-AC841FBE7B67}") = "SampleProject", "Assembly-CSharp-Editor-vs.csproj", "{6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(MonoDevelopProperties) = preSolution 27 | StartupItem = Assembly-CSharp.csproj 28 | Policies = $0 29 | $0.TextStylePolicy = $1 30 | $1.inheritsSet = null 31 | $1.scope = text/x-csharp 32 | $0.CSharpFormattingPolicy = $2 33 | $2.inheritsSet = Mono 34 | $2.inheritsScope = text/x-csharp 35 | $2.scope = text/x-csharp 36 | $0.TextStylePolicy = $3 37 | $3.FileWidth = 120 38 | $3.TabWidth = 4 39 | $3.EolMarker = Unix 40 | $3.inheritsSet = Mono 41 | $3.inheritsScope = text/plain 42 | $3.scope = text/plain 43 | EndGlobalSection 44 | 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /SampleProject/SampleProject.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2008 3 | 4 | Project("{B2AF7265-7C82-876A-E21A-AC841FBE7B67}") = "SampleProject", "Assembly-CSharp.csproj", "{21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}" 5 | EndProject 6 | Project("{B2AF7265-7C82-876A-E21A-AC841FBE7B67}") = "SampleProject", "Assembly-CSharp-Editor.csproj", "{6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {21C2D141-8059-E3B5-BF6E-E8E63DFE24D7}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {6BC1E4FE-C3B8-FCCD-C800-33BA8F110A14}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(MonoDevelopProperties) = preSolution 27 | Policies = $0 28 | $0.TextStylePolicy = $1 29 | $1.inheritsSet = null 30 | $1.scope = text/x-csharp 31 | $0.CSharpFormattingPolicy = $2 32 | $2.inheritsSet = Mono 33 | $2.inheritsScope = text/x-csharp 34 | $2.scope = text/x-csharp 35 | $0.TextStylePolicy = $3 36 | $3.FileWidth = 120 37 | $3.EolMarker = Unix 38 | $3.inheritsSet = VisualStudio 39 | $3.inheritsScope = text/plain 40 | $3.scope = text/plain 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /SampleProject/SampleProject.userprefs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | --------------------------------------------------------------------------------