├── .github ├── FUNDING.yml └── workflows │ └── ci.yml ├── .gitignore ├── .releaserc.json ├── Assets ├── CameraToTerminalTest.cs ├── CameraToTerminalTest.cs.meta ├── CameraToTerminalTest.unity ├── CameraToTerminalTest.unity.meta ├── PathfindingMaps.meta ├── PathfindingMaps │ ├── ConsoleMat.mat │ ├── ConsoleMat.mat.meta │ ├── PathfindingMaps.cs │ ├── PathfindingMaps.cs.meta │ ├── PathfindingMaps.unity │ └── PathfindingMaps.unity.meta ├── RuntimeResizeTest.cs ├── RuntimeResizeTest.cs.meta ├── Settings.meta ├── Settings │ ├── ForwardRenderer.asset │ ├── ForwardRenderer.asset.meta │ ├── SampleSceneProfile.asset │ ├── SampleSceneProfile.asset.meta │ ├── UniversalRP-HighQuality.asset │ ├── UniversalRP-HighQuality.asset.meta │ ├── UniversalRP-LowQuality.asset │ ├── UniversalRP-LowQuality.asset.meta │ ├── UniversalRP-MediumQuality.asset │ └── UniversalRP-MediumQuality.asset.meta ├── SpriteCursor.cs └── SpriteCursor.cs.meta ├── CHANGELOG.md ├── Documentation~ └── images~ │ ├── fovdemo.png │ ├── pathfinddemo.png │ └── samples.png ├── LICENSE.md ├── Packages ├── com.sark.rltk_unity │ ├── CHANGELOG.md │ ├── CHANGELOG.md.meta │ ├── LICENSE.md │ ├── LICENSE.md.meta │ ├── README.md │ ├── README.md.meta │ ├── Runtime.meta │ ├── Runtime │ │ ├── FieldOfView.meta │ │ ├── FieldOfView │ │ │ ├── BeveledCorners.cs │ │ │ ├── BeveledCorners.cs.meta │ │ │ ├── Bresenham.cs │ │ │ ├── Bresenham.cs.meta │ │ │ ├── IVisibilityMap.cs │ │ │ └── IVisibilityMap.cs.meta │ │ ├── RenderUtility.cs │ │ ├── RenderUtility.cs.meta │ │ ├── SampleScripts.meta │ │ ├── SampleScripts │ │ │ ├── BasicPathingMap.cs │ │ │ ├── BasicPathingMap.cs.meta │ │ │ ├── CameraToTerminalSize.cs │ │ │ ├── CameraToTerminalSize.cs.meta │ │ │ ├── Controls.cs │ │ │ ├── Controls.cs.meta │ │ │ ├── Controls.inputactions │ │ │ ├── Controls.inputactions.meta │ │ │ ├── ControlsTerminal.cs │ │ │ ├── ControlsTerminal.cs.meta │ │ │ ├── DraggingControls.cs │ │ │ ├── DraggingControls.cs.meta │ │ │ ├── InteractiveTerminal.cs │ │ │ ├── InteractiveTerminal.cs.meta │ │ │ ├── MapNoise.cs │ │ │ └── MapNoise.cs.meta │ │ ├── Sark.RLTK.Runtime.asmdef │ │ ├── Sark.RLTK.Runtime.asmdef.meta │ │ └── Scrapped~ │ │ │ ├── Authoring.meta │ │ │ ├── Authoring │ │ │ ├── ConsoleAuthoring.cs │ │ │ └── ConsoleAuthoring.cs.meta │ │ │ ├── RuntimeTests.meta │ │ │ └── RuntimeTests │ │ │ ├── SimpleConsoleSystem.cs │ │ │ ├── SimpleConsoleSystem.cs.meta │ │ │ ├── TestData.asset │ │ │ └── TestData.asset.meta │ ├── Samples.meta │ ├── Samples │ │ ├── FOVDemo.meta │ │ ├── FOVDemo │ │ │ ├── FOVDemo.cs │ │ │ ├── FOVDemo.cs.meta │ │ │ ├── FOVDemo.unity │ │ │ └── FOVDemo.unity.meta │ │ ├── PathfindingDemo.meta │ │ ├── PathfindingDemo │ │ │ ├── PathfindingDemo.cs │ │ │ ├── PathfindingDemo.cs.meta │ │ │ ├── PathfindingDemo.unity │ │ │ └── PathfindingDemo.unity.meta │ │ ├── Sark.RLTK.Samples.asmdef │ │ └── Sark.RLTK.Samples.asmdef.meta │ ├── package.json │ └── package.json.meta ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── BurstAotSettings_StandaloneWindows.json ├── BurstAotSettings_WebGL.json ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── SceneTemplateSettings.json ├── TagManager.asset ├── TimeManager.asset ├── URPProjectSettings.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── XRSettings.asset ├── README.md └── UserSettings └── EditorUserSettings.asset /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: sarkahn 2 | custom: ["https://www.paypal.me/sarkahn"] 3 | ko_fi: sarkahn 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | release: 8 | name: release 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | with: 13 | fetch-depth: 0 14 | - name: Semantic release 15 | id: semantic 16 | uses: cycjimmy/semantic-release-action@v2 17 | with: 18 | extra_plugins: | 19 | @semantic-release/changelog 20 | @semantic-release/git 21 | branch: master 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | - name: Create upm branch 25 | run: | 26 | git branch -d upm &> /dev/null || echo upm branch not found 27 | git subtree split -P "$PKG_ROOT" -b upm 28 | git checkout upm 29 | if git cat-file -e "master:Documentation~"; then 30 | git checkout master Documentation~ 31 | git config --global user.name 'github-bot' 32 | git config --global user.email 'github-bot@users.noreply.github.com' 33 | git commit -am "fix: Checkout docs folder from master." --allow-empty 34 | fi 35 | if git cat-file -e "master:README.md"; then 36 | git checkout master README.md 37 | git config --global user.name 'github-bot' 38 | git config --global user.email 'github-bot@users.noreply.github.com' 39 | git commit -am "fix: Copy license to package root." --allow-empty 40 | fi 41 | if [[ -d "Samples" ]]; then 42 | git mv Samples Samples~ 43 | rm -f Samples.meta 44 | git config --global user.name 'github-bot' 45 | git config --global user.email 'github-bot@users.noreply.github.com' 46 | git commit -am "fix: Samples => Samples~" --allow-empty 47 | fi 48 | if git cat-file -e "master:CHANGELOG.md"; then 49 | git checkout master CHANGELOG.md 50 | git config --global user.name 'github-bot' 51 | git config --global user.email 'github-bot@users.noreply.github.com' 52 | git commit -am "fix: Copy changelog to package root." --allow-empty 53 | fi 54 | if git cat-file -e "master:LICENSE.md"; then 55 | git checkout master LICENSE.md 56 | git config --global user.name 'github-bot' 57 | git config --global user.email 'github-bot@users.noreply.github.com' 58 | git commit -am "fix: Copy readme to package root." --allow-empty 59 | fi 60 | git push -f -u origin upm 61 | env: 62 | PKG_ROOT: Packages/com.sark.rltk_unity 63 | - name: Create upm git tag 64 | if: steps.semantic.outputs.new_release_published == 'true' 65 | run: | 66 | git tag $TAG upm 67 | git push origin --tags 68 | env: 69 | TAG: upm/v${{ steps.semantic.outputs.new_release_version }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | Assets/Temp/ 14 | Assets/Temp.meta 15 | 16 | # Asset meta data should only be ignored when the corresponding asset is also ignored 17 | #!/[Aa]ssets/**/*.meta 18 | 19 | # Uncomment this line if you wish to ignore the asset store tools plugin 20 | # /[Aa]ssets/AssetStoreTools* 21 | 22 | # Autogenerated Jetbrains Rider plugin 23 | [Aa]ssets/Plugins/Editor/JetBrains* 24 | 25 | # Visual Studio cache directory 26 | .vs/ 27 | 28 | # Gradle cache directory 29 | .gradle/ 30 | 31 | # Autogenerated VS/MD/Consulo solution and project files 32 | ExportedObj/ 33 | .consulo/ 34 | *.csproj 35 | *.unityproj 36 | *.sln 37 | *.suo 38 | *.tmp 39 | *.user 40 | *.userprefs 41 | *.pidb 42 | *.booproj 43 | *.svd 44 | *.pdb 45 | *.mdb 46 | *.opendb 47 | *.VC.db 48 | 49 | # Unity3D generated meta files 50 | *.pidb.meta 51 | *.pdb.meta 52 | *.mdb.meta 53 | 54 | # Unity3D generated file on crash reports 55 | sysinfo.txt 56 | 57 | # Builds 58 | *.apk 59 | *.unitypackage 60 | 61 | # Crashlytics generated file 62 | crashlytics-build.properties 63 | 64 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tagFormat": "v${version}", 3 | "plugins": [ 4 | ["@semantic-release/commit-analyzer", { "preset": "angular" }], 5 | "@semantic-release/release-notes-generator", 6 | ["@semantic-release/changelog", { "preset": "angular" }], 7 | ["@semantic-release/npm", { "npmPublish": false, "pkgRoot": "Packages/com.sark.rltk_unity" }], 8 | ["@semantic-release/git", { 9 | "assets": ["Packages/com.sark.rltk_unity/package.json", "CHANGELOG.md"], 10 | "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" 11 | }], 12 | "@semantic-release/github" 13 | ] 14 | } -------------------------------------------------------------------------------- /Assets/CameraToTerminalTest.cs: -------------------------------------------------------------------------------- 1 | using RLTK; 2 | using Sark.Terminals; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using Unity.Collections; 6 | using UnityEngine; 7 | 8 | public class CameraToTerminalTest : MonoBehaviour 9 | { 10 | SimpleTerminal _term; 11 | // Start is called before the first frame update 12 | void Start() 13 | { 14 | _term = new SimpleTerminal(10, 10, Allocator.Persistent); 15 | RenderUtility.AdjustCameraToTerminal(_term); 16 | } 17 | 18 | private void OnDestroy() 19 | { 20 | _term.Dispose(); 21 | } 22 | 23 | private void Update() 24 | { 25 | RenderUtility.RenderTerminal(_term); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/CameraToTerminalTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddd3c2f2605d08342b2e1d66488ea664 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/CameraToTerminalTest.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 0 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &300191310 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 300191312} 135 | - component: {fileID: 300191311} 136 | m_Layer: 0 137 | m_Name: CameraToTerminal 138 | m_TagString: Untagged 139 | m_Icon: {fileID: 0} 140 | m_NavMeshLayer: 0 141 | m_StaticEditorFlags: 0 142 | m_IsActive: 1 143 | --- !u!114 &300191311 144 | MonoBehaviour: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 300191310} 150 | m_Enabled: 1 151 | m_EditorHideFlags: 0 152 | m_Script: {fileID: 11500000, guid: ddd3c2f2605d08342b2e1d66488ea664, type: 3} 153 | m_Name: 154 | m_EditorClassIdentifier: 155 | --- !u!4 &300191312 156 | Transform: 157 | m_ObjectHideFlags: 0 158 | m_CorrespondingSourceObject: {fileID: 0} 159 | m_PrefabInstance: {fileID: 0} 160 | m_PrefabAsset: {fileID: 0} 161 | m_GameObject: {fileID: 300191310} 162 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 163 | m_LocalPosition: {x: -9.778499, y: -4.316271, z: -13.13881} 164 | m_LocalScale: {x: 1, y: 1, z: 1} 165 | m_Children: [] 166 | m_Father: {fileID: 0} 167 | m_RootOrder: 1 168 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 169 | --- !u!1 &1004587378 170 | GameObject: 171 | m_ObjectHideFlags: 0 172 | m_CorrespondingSourceObject: {fileID: 0} 173 | m_PrefabInstance: {fileID: 0} 174 | m_PrefabAsset: {fileID: 0} 175 | serializedVersion: 6 176 | m_Component: 177 | - component: {fileID: 1004587381} 178 | - component: {fileID: 1004587380} 179 | - component: {fileID: 1004587379} 180 | - component: {fileID: 1004587382} 181 | m_Layer: 0 182 | m_Name: Main Camera 183 | m_TagString: MainCamera 184 | m_Icon: {fileID: 0} 185 | m_NavMeshLayer: 0 186 | m_StaticEditorFlags: 0 187 | m_IsActive: 1 188 | --- !u!81 &1004587379 189 | AudioListener: 190 | m_ObjectHideFlags: 0 191 | m_CorrespondingSourceObject: {fileID: 0} 192 | m_PrefabInstance: {fileID: 0} 193 | m_PrefabAsset: {fileID: 0} 194 | m_GameObject: {fileID: 1004587378} 195 | m_Enabled: 1 196 | --- !u!20 &1004587380 197 | Camera: 198 | m_ObjectHideFlags: 0 199 | m_CorrespondingSourceObject: {fileID: 0} 200 | m_PrefabInstance: {fileID: 0} 201 | m_PrefabAsset: {fileID: 0} 202 | m_GameObject: {fileID: 1004587378} 203 | m_Enabled: 1 204 | serializedVersion: 2 205 | m_ClearFlags: 1 206 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 207 | m_projectionMatrixMode: 1 208 | m_GateFitMode: 2 209 | m_FOVAxisMode: 0 210 | m_SensorSize: {x: 36, y: 24} 211 | m_LensShift: {x: 0, y: 0} 212 | m_FocalLength: 50 213 | m_NormalizedViewPortRect: 214 | serializedVersion: 2 215 | x: 0 216 | y: 0 217 | width: 1 218 | height: 1 219 | near clip plane: 0.3 220 | far clip plane: 1000 221 | field of view: 60 222 | orthographic: 1 223 | orthographic size: 5 224 | m_Depth: -1 225 | m_CullingMask: 226 | serializedVersion: 2 227 | m_Bits: 4294967295 228 | m_RenderingPath: -1 229 | m_TargetTexture: {fileID: 0} 230 | m_TargetDisplay: 0 231 | m_TargetEye: 3 232 | m_HDR: 1 233 | m_AllowMSAA: 1 234 | m_AllowDynamicResolution: 0 235 | m_ForceIntoRT: 0 236 | m_OcclusionCulling: 1 237 | m_StereoConvergence: 10 238 | m_StereoSeparation: 0.022 239 | --- !u!4 &1004587381 240 | Transform: 241 | m_ObjectHideFlags: 0 242 | m_CorrespondingSourceObject: {fileID: 0} 243 | m_PrefabInstance: {fileID: 0} 244 | m_PrefabAsset: {fileID: 0} 245 | m_GameObject: {fileID: 1004587378} 246 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 247 | m_LocalPosition: {x: 0, y: 0, z: -10} 248 | m_LocalScale: {x: 1, y: 1, z: 1} 249 | m_Children: [] 250 | m_Father: {fileID: 0} 251 | m_RootOrder: 0 252 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 253 | --- !u!114 &1004587382 254 | MonoBehaviour: 255 | m_ObjectHideFlags: 0 256 | m_CorrespondingSourceObject: {fileID: 0} 257 | m_PrefabInstance: {fileID: 0} 258 | m_PrefabAsset: {fileID: 0} 259 | m_GameObject: {fileID: 1004587378} 260 | m_Enabled: 1 261 | m_EditorHideFlags: 0 262 | m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} 263 | m_Name: 264 | m_EditorClassIdentifier: 265 | m_RenderShadows: 1 266 | m_RequiresDepthTextureOption: 2 267 | m_RequiresOpaqueTextureOption: 2 268 | m_CameraType: 0 269 | m_Cameras: [] 270 | m_RendererIndex: -1 271 | m_VolumeLayerMask: 272 | serializedVersion: 2 273 | m_Bits: 1 274 | m_VolumeTrigger: {fileID: 0} 275 | m_RenderPostProcessing: 0 276 | m_Antialiasing: 0 277 | m_AntialiasingQuality: 2 278 | m_StopNaN: 0 279 | m_Dithering: 0 280 | m_ClearDepth: 1 281 | m_AllowXRRendering: 1 282 | m_RequiresDepthTexture: 0 283 | m_RequiresColorTexture: 0 284 | m_Version: 2 285 | -------------------------------------------------------------------------------- /Assets/CameraToTerminalTest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87718e31062124542b42c077f3b2598e 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/PathfindingMaps.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dccc2b530c208a9458b8190cec4138ab 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/PathfindingMaps/ConsoleMat.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: ConsoleMat 11 | m_Shader: {fileID: 4800000, guid: 7ed6810dbf84d4d44a425e006f0f4836, type: 3} 12 | m_ShaderKeywords: _SCANLINES_NONE 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BaseMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _ClearCoatMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _EmissionMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _MainTex: 39 | m_Texture: {fileID: 2800000, guid: 76a705f0e5350064e8bb077f02130de6, type: 3} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MetallicGlossMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _OcclusionMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _SpecGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | m_Floats: 55 | - _AlphaClip: 0 56 | - _BGCutoff: 0.228 57 | - _Blend: 0 58 | - _BumpScale: 1 59 | - _ClearCoat: 0 60 | - _ClearCoatMask: 0 61 | - _Cull: 2 62 | - _Cutoff: 0.5 63 | - _DstBlend: 0 64 | - _EnvironmentReflections: 1 65 | - _GlossMapScale: 0 66 | - _Glossiness: 0 67 | - _GlossyReflections: 0 68 | - _HardLines: 0 69 | - _LineIntensity: 0.47 70 | - _Metallic: 0 71 | - _OcclusionStrength: 1 72 | - _QueueOffset: 0 73 | - _ReceiveShadows: 1 74 | - _ScanlineFrequency: 1 75 | - _Scanlines: 0 76 | - _ScanlinesFGOnly: 0 77 | - _ScreenBurn: 0 78 | - _ScreenBurnIntensity: 0.417 79 | - _Smoothness: 0.5 80 | - _SmoothnessTextureChannel: 0 81 | - _SpecularHighlights: 1 82 | - _SrcBlend: 1 83 | - _Surface: 0 84 | - _WorkflowMode: 1 85 | - _ZWrite: 1 86 | m_Colors: 87 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 88 | - _Color: {r: 1, g: 1, b: 1, a: 1} 89 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 90 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 91 | m_BuildTextureStacks: [] 92 | --- !u!114 &2787910267853946961 93 | MonoBehaviour: 94 | m_ObjectHideFlags: 11 95 | m_CorrespondingSourceObject: {fileID: 0} 96 | m_PrefabInstance: {fileID: 0} 97 | m_PrefabAsset: {fileID: 0} 98 | m_GameObject: {fileID: 0} 99 | m_Enabled: 1 100 | m_EditorHideFlags: 0 101 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 102 | m_Name: 103 | m_EditorClassIdentifier: 104 | version: 2 105 | -------------------------------------------------------------------------------- /Assets/PathfindingMaps/ConsoleMat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3f337c9cda59f3498d8f0723e32643a 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/PathfindingMaps/PathfindingMaps.cs: -------------------------------------------------------------------------------- 1 | //using RLTK; 2 | //using RLTK.MonoBehaviours; 3 | //using System.Collections; 4 | //using System.Collections.Generic; 5 | //using Unity.Burst; 6 | //using Unity.Collections; 7 | //using Unity.Jobs; 8 | //using Unity.Mathematics; 9 | //using UnityEngine; 10 | //using UnityEngine.Experimental.GlobalIllumination; 11 | //using UnityEngine.InputSystem; 12 | //using UnityEngine.Profiling; 13 | //using static RLTK.CodePage437; 14 | 15 | 16 | //namespace PathfindingMapsTest 17 | //{ 18 | // public static class Int2Extension 19 | // { 20 | // public static void Deconstruct(this int2 p, out int x, out int y) 21 | // { 22 | // x = p.x; 23 | // y = p.y; 24 | // } 25 | // } 26 | 27 | // public class PathfindingMaps : MonoBehaviour 28 | // { 29 | // [SerializeField] 30 | // SimpleConsoleProxy _console = null; 31 | 32 | // Controls _controls; 33 | // InputAction _leftMouse; 34 | // InputAction _rightMouse; 35 | // InputAction _middleMouse; 36 | // InputAction _lmbDrag; 37 | // InputAction _togglePathfinding; 38 | // InputAction _resizeMap; 39 | // InputAction _stepPathfinding; 40 | 41 | // bool _dragging = false; 42 | // HashSet _draggedPoints = new HashSet(); 43 | 44 | // int? _start = null; 45 | // int? _end = null; 46 | // TestMap _map; 47 | 48 | // bool _pathfindRunning; 49 | 50 | // AStar3 _aStar; 51 | // NativeList _path; 52 | 53 | // SlidingAverage _averageTime = new SlidingAverage(30, 0); 54 | 55 | // static Color _startColor = Color.blue; 56 | // static Color _endColor = Color.green; 57 | 58 | // [BurstCompile] 59 | // struct FindPathJob : IJob 60 | // { 61 | // public AStar3 AStar; 62 | // public NativeList Path; 63 | // public TestMap Map; 64 | 65 | // public void Execute() 66 | // { 67 | // AStar.FindPath(Map, Path); 68 | // } 69 | // } 70 | 71 | // private void OnEnable() 72 | // { 73 | // _controls = new Controls(); 74 | // _controls.Enable(); 75 | // _leftMouse = _controls.Default.LeftMouse; 76 | // _rightMouse = _controls.Default.RightMouse; 77 | // _middleMouse = _controls.Default.MiddleMouse; 78 | // _lmbDrag = _controls.Default.LMBDrag; 79 | // _togglePathfinding = _controls.Default.TogglePathfinding; 80 | // _resizeMap = _controls.Default.ResizeMap; 81 | // _stepPathfinding = _controls.Default.StepPathfinding; 82 | 83 | // _lmbDrag.performed += OnDragBegin; 84 | // _lmbDrag.canceled += OnDragEnd; 85 | 86 | // BuildArrays(); 87 | 88 | // } 89 | 90 | // private void OnDisable() 91 | // { 92 | // DisposeArrays(); 93 | // } 94 | 95 | // void BuildArrays() 96 | // { 97 | // _map = new TestMap(_console.Size, Allocator.Persistent); 98 | // _path = new NativeList(_console.CellCount, Allocator.Persistent); 99 | // _aStar = new AStar3(_console.CellCount, Allocator.Persistent); 100 | // } 101 | 102 | // void DisposeArrays() 103 | // { 104 | // _map.Dispose(); 105 | // _path.Dispose(); 106 | // _aStar.Dispose(); 107 | // } 108 | 109 | // private IEnumerator Start() 110 | // { 111 | // yield return null; 112 | 113 | // if (_console != null) 114 | // { 115 | // _console.ClearScreen(); 116 | // _console.FillBorder(ToCP437('#')); 117 | // } 118 | // BuildMapFromConsole(); 119 | 120 | // //BuildConsoleFromMap(); 121 | // //_pathfindRunning = true; 122 | // } 123 | 124 | // void BuildMapFromConsole() 125 | // { 126 | // //var (map, start, end) = GetHugeMap(Allocator.Persistent); 127 | // //_map = map; 128 | // //_start = start; 129 | // //_end = end; 130 | 131 | // GridHelper grid = new GridHelper(_console.Size); 132 | // var bytes = _map.GetData(); 133 | // var tiles = _console.ReadAllTiles(Allocator.Temp); 134 | // for (int i = 0; i < bytes.Length; ++i) 135 | // { 136 | // int2 p = grid.IndexToPos(i); 137 | // if (_console.Get(p.x, p.y).Value == ToCP437('#')) 138 | // { 139 | // //Debug.Log($"Setting path map wall at {p}"); 140 | // bytes[i] = 1; 141 | // } 142 | // else 143 | // bytes[i] = 0; 144 | // } 145 | // } 146 | 147 | // void BuildConsoleFromMap() 148 | // { 149 | // _console.ClearScreen(); 150 | // var data = _map.GetData(); 151 | // for( int i = 0; i < data.Length; ++i ) 152 | // if(data[i] != 0) 153 | // { 154 | // var p = _map.IndexToPos(i); 155 | // _console.Set(p.x, p.y, Color.white, Color.black, ToCP437('#')); 156 | // } 157 | 158 | // var start = _map.IndexToPos(_start.Value); 159 | // var end = _map.IndexToPos(_end.Value); 160 | // _console.Set(start.x, start.y, Color.blue, Color.black, ToCP437('S')); 161 | // _console.Set(end.x, end.y, Color.green, Color.black, ToCP437('E')); 162 | // } 163 | 164 | // int2 GetMouseConsolePosition() 165 | // { 166 | // float2 mouseXY = Mouse.current.position.ReadValue(); 167 | // float3 mousePos = new float3(mouseXY, transform.position.z); 168 | 169 | // var worldPos = Camera.main.ScreenToWorldPoint(mousePos); 170 | // int2 consolePos = _console.WorldToConsolePosition(worldPos); 171 | // return consolePos; 172 | // } 173 | 174 | // void ToggleGlyph(int2 p) 175 | // { 176 | // int x = p.x; 177 | // int y = p.y; 178 | // byte existing = _console.Get(x, y).Value; 179 | 180 | // int i = new GridHelper().PosToIndex(p); 181 | 182 | // if ((_start != null && i == _start.Value) || 183 | // (_end != null && i == _end.Value)) 184 | // return; 185 | 186 | // if (ToChar(existing) == '#') 187 | // { 188 | // _console.Set(x, y, Color.black, Color.black, ToCP437(' ')); 189 | // } 190 | // else 191 | // { 192 | // _console.Set(x, y, Color.white, Color.black, ToCP437('#')); 193 | // } 194 | 195 | // BuildMapFromConsole(); 196 | // } 197 | 198 | // private void Update() 199 | // { 200 | // if (_leftMouse.triggered) 201 | // { 202 | // int2 consolePos = GetMouseConsolePosition(); 203 | 204 | // if (_console.InBounds(consolePos)) 205 | // { 206 | // ToggleGlyph(consolePos); 207 | // } 208 | // } 209 | 210 | // if (_dragging) 211 | // { 212 | // OnDrag(); 213 | // } 214 | 215 | // if (_togglePathfinding.triggered) 216 | // { 217 | // _pathfindRunning = !_pathfindRunning; 218 | // //OnPathfind(); 219 | // } 220 | 221 | // if (_pathfindRunning) 222 | // { 223 | // OnPathfind(); 224 | // } 225 | 226 | // if (_middleMouse.triggered) 227 | // { 228 | // OnSetPathMarker(); 229 | // } 230 | 231 | // if(_stepPathfinding.triggered) 232 | // { 233 | // OnStepPathfinding(); 234 | // } 235 | // } 236 | 237 | // void SetTile(int i, char c, Color color = default, Color bg = default) 238 | // { 239 | // if (color == default) 240 | // color = Color.white; 241 | // if (bg == default) 242 | // bg = Color.black; 243 | 244 | // var p = new GridHelper(_console.Size).IndexToPos(i); 245 | // _console.Set(p.x, p.y, color, bg, ToCP437(c)); 246 | // } 247 | 248 | // void ClearTile(int i) 249 | // { 250 | // var p = new GridHelper(_console.Size).IndexToPos(i); 251 | // _console.Set(p.x, p.y, Color.white, Color.black, 0); 252 | // } 253 | 254 | // void ClearAStarTiles() 255 | // { 256 | // var open = _aStar.GetFrontier(Allocator.Temp); 257 | // var closed = _aStar.GetVisited(Allocator.Temp); 258 | 259 | // for (int i = 0; i < open.Length; ++i) 260 | // { 261 | // var node = open[i]; 262 | // ClearTile(node.Value); 263 | // } 264 | 265 | // for (int i = 0; i < closed.Length; ++i) 266 | // { 267 | // ClearTile(closed[i]); 268 | // } 269 | // } 270 | 271 | // void DrawStart() 272 | // { 273 | // if(_start != null) 274 | // SetTile(_start.Value, 'S', _startColor); 275 | // } 276 | 277 | // void DrawEnd() 278 | // { 279 | // if(_end != null ) 280 | // SetTile(_end.Value, 'E', _endColor); 281 | // } 282 | 283 | // void OnSetPathMarker() 284 | // { 285 | // ClearAStarTiles(); 286 | // ResetAStar(); 287 | 288 | // var mousePos = GetMouseConsolePosition(); 289 | // if (!_console.InBounds(mousePos)) 290 | // return; 291 | // ClearPath(); 292 | 293 | // var grid = new GridHelper(_console.Size); 294 | // int posIndex = grid.PosToIndex(mousePos); 295 | 296 | // if (_start == null) 297 | // { 298 | // _start = posIndex; 299 | // DrawStart(); 300 | // return; 301 | // } 302 | 303 | // if (_end == null) 304 | // { 305 | // _end = posIndex; 306 | // DrawEnd(); 307 | // ResetAStar(); 308 | // _aStar.SetStartEnd(_start.Value, _end.Value); 309 | 310 | // return; 311 | // } 312 | 313 | // ClearTile(_end.Value); 314 | // ClearTile(_start.Value); 315 | // _end = null; 316 | // _start = null; 317 | // } 318 | 319 | // void ClearPath() 320 | // { 321 | // for (int i = 1; i < _path.Length - 1; ++i) 322 | // { 323 | // ClearTile(_path[i]); 324 | // } 325 | // } 326 | 327 | // void OnStepPathfinding() 328 | // { 329 | // if (_start == null || _end == null) 330 | // { 331 | // Debug.Log("Can't step pathfinding - need a start and end"); 332 | // return; 333 | // } 334 | 335 | // //Debug.Log("Stepping path"); 336 | // if(!_aStar.Step(_map)) 337 | // { 338 | // Debug.Log("Pathfinding is complete"); 339 | // } 340 | 341 | // DrawVisitedTiles(); 342 | // } 343 | 344 | // void OnPathfind() 345 | // { 346 | // if (_start == null || _end == null) 347 | // return; 348 | 349 | // ResetAStar(); 350 | // _aStar.SetStartEnd(_start.Value, _end.Value); 351 | 352 | // Profiler.BeginSample("FindPath"); 353 | // new FindPathJob { AStar = _aStar, Map = _map, Path = _path }.Run(); 354 | // Profiler.EndSample(); 355 | 356 | // if (_path.IsEmpty) 357 | // Debug.Log("Couldn't find path!"); 358 | 359 | // //DrawVisitedTiles(); 360 | // //DrawStart(); 361 | // //DrawEnd(); 362 | // //DrawPath(); 363 | // } 364 | 365 | // void DrawVisitedTiles() 366 | // { 367 | // var frontier = _aStar.GetFrontier(Allocator.Temp); 368 | // var visited = _aStar.GetVisited(Allocator.Temp); 369 | 370 | // for (int i = 0; i < frontier.Length; ++i) 371 | // { 372 | // var node = frontier[i]; 373 | // //Debug.Log($"Open list node position {node.Value}: " + 374 | // // $"({_map.IndexToPos(node.Value)})"); ; 375 | // SetTile(node.Value, 'o', Color.white, Color.blue); 376 | // } 377 | 378 | // for (int i = 0; i < visited.Length; ++i) 379 | // { 380 | // if (visited[i] < 0 || visited[i] > _console.CellCount) 381 | // continue; 382 | // SetTile(visited[i], 'c', Color.white, Color.red); 383 | // } 384 | 385 | // DrawStart(); 386 | // DrawEnd(); 387 | // } 388 | 389 | // void DrawPath() 390 | // { 391 | // for (int i = 1; i < _path.Length - 1; ++i) 392 | // { 393 | // var prev = _map.IndexToPos(_path[i - 1]); 394 | // var curr = _map.IndexToPos(_path[i]); 395 | // var next = _map.IndexToPos(_path[i + 1]); 396 | 397 | // // Bitmasking based on which edge our previous and next positions are 398 | // int prevValue = BitValueFromDir(curr - prev); 399 | // int nextValue = BitValueFromDir(curr - next); 400 | // int bitValue = prevValue + nextValue; 401 | // char glyph = GlyphFromBitValue((byte)bitValue); 402 | // var col = Color.Lerp(_startColor, _endColor, (float)i / _path.Length); 403 | // SetTile(_path[i], glyph, col); 404 | // } 405 | // } 406 | 407 | // void OnDragBegin(InputAction.CallbackContext ctx) 408 | // { 409 | // var p = GetMouseConsolePosition(); 410 | // _draggedPoints.Add(p); 411 | // _dragging = true; 412 | // } 413 | 414 | // void OnDragEnd(InputAction.CallbackContext ctx) 415 | // { 416 | // _dragging = false; 417 | // _draggedPoints.Clear(); 418 | // } 419 | 420 | // private void OnDrag() 421 | // { 422 | // int2 p = GetMouseConsolePosition(); 423 | 424 | // if (!_console.InBounds(p)) 425 | // return; 426 | 427 | // if (!_draggedPoints.Contains(p)) 428 | // { 429 | // _draggedPoints.Add(p); 430 | // ToggleGlyph(p); 431 | // } 432 | // } 433 | 434 | // void ResetAStar() 435 | // { 436 | // ClearPath(); 437 | // _path.Clear(); 438 | // _aStar.Clear(); 439 | // } 440 | 441 | // private void OnGUI() 442 | // { 443 | // GUILayout.BeginVertical(GUI.skin.box); 444 | 445 | // GUILayout.Label("LMB to Toggle Walls"); 446 | // GUILayout.Label("Middle Mouse to place Start/End"); 447 | // GUILayout.Label("R to toggle pathfinding"); 448 | // GUILayout.Label("Arrows keys to resize map"); 449 | 450 | // GUILayout.Label($"Pathfinding : {_pathfindRunning}"); 451 | 452 | // if (!_pathfindRunning) 453 | // { 454 | // GUILayout.EndVertical(); 455 | // return; 456 | // } 457 | 458 | // if (_start == null || _end == null) 459 | // { 460 | // GUILayout.Label("Need both a start and end point"); 461 | // GUILayout.EndVertical(); 462 | // return; 463 | // } 464 | 465 | // if (_path.IsEmpty) 466 | // { 467 | // GUILayout.Label("Unable to find path!"); 468 | // return; 469 | // } 470 | 471 | // GUILayout.Label($"Average Pathfinding Time Per Frame: " + 472 | // $"{_averageTime.GetSmoothedValue()}"); 473 | 474 | // GUILayout.EndVertical(); 475 | // } 476 | 477 | // class SlidingAverage 478 | // { 479 | // long[] _buffer; 480 | // int _lastIndex; 481 | 482 | // public SlidingAverage(int numSamples, long initial) 483 | // { 484 | // _buffer = new long[numSamples]; 485 | // _lastIndex = 0; 486 | // Reset(initial); 487 | // } 488 | 489 | // public void Reset(long value) 490 | // { 491 | // for (int i = 0; i < _buffer.Length; ++i) 492 | // _buffer[i] = value; 493 | // } 494 | 495 | // public void Push(long value) 496 | // { 497 | // _buffer[_lastIndex] = value; 498 | 499 | // _lastIndex++; 500 | // if (_lastIndex >= _buffer.Length) 501 | // _lastIndex = 0; 502 | // } 503 | 504 | // public float GetSmoothedValue() 505 | // { 506 | // long sum = 0; 507 | // foreach (var v in _buffer) 508 | // sum += v; 509 | // return (float)((float)sum / _buffer.Length); 510 | // } 511 | // } 512 | 513 | // char ver = '│'; 514 | // char hor = '─'; 515 | // char upLeft = '┐'; 516 | // char upRight = '┌'; 517 | // char downLeft = '┘'; 518 | // char downRight = '└'; 519 | 520 | // char GlyphFromBitValue(byte val) => val switch 521 | // { 522 | // 3 => upRight, 523 | // 4 => upLeft, 524 | // 5 => upLeft, 525 | // 6 => hor, 526 | // 9 => ver, 527 | // 10 => downRight, 528 | // 12 => downLeft, 529 | // _ => ' ' 530 | // }; 531 | 532 | // byte BitValueFromDir(int2 dir) => dir switch 533 | // { 534 | // (0, 1) => 1 << 0, // 1 535 | // (-1, 0) => 1 << 1, // 2 536 | // (1, 0) => 1 << 2, // 4 537 | // (0, -1) => 1 << 3, // 8 538 | // _ => 0 539 | // }; 540 | 541 | // public static (TestMap, int, int) GetHugeMap(Allocator allocator) 542 | // { 543 | // int2 size = new int2(500, 500); 544 | // var map = new TestMap(size, allocator); 545 | 546 | // int x = size.x / 2; 547 | // for (int y = 0; y < size.y - 2; ++y) 548 | // map.SetTile(x, y, 1); 549 | 550 | 551 | // int start = map.PosToIndex(0, 0); 552 | // int end = map.PosToIndex(size.x - 1, 0); 553 | // return (map, start, end); 554 | // } 555 | // } 556 | 557 | //} 558 | -------------------------------------------------------------------------------- /Assets/PathfindingMaps/PathfindingMaps.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c905d3e0d960f4d469b26e49b3dd15d8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/PathfindingMaps/PathfindingMaps.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 0 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &1114609665 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 1114609669} 135 | - component: {fileID: 1114609668} 136 | - component: {fileID: 1114609667} 137 | - component: {fileID: 1114609666} 138 | - component: {fileID: 1114609670} 139 | m_Layer: 0 140 | m_Name: Console 141 | m_TagString: Untagged 142 | m_Icon: {fileID: 0} 143 | m_NavMeshLayer: 0 144 | m_StaticEditorFlags: 0 145 | m_IsActive: 1 146 | --- !u!114 &1114609666 147 | MonoBehaviour: 148 | m_ObjectHideFlags: 0 149 | m_CorrespondingSourceObject: {fileID: 0} 150 | m_PrefabInstance: {fileID: 0} 151 | m_PrefabAsset: {fileID: 0} 152 | m_GameObject: {fileID: 1114609665} 153 | m_Enabled: 1 154 | m_EditorHideFlags: 0 155 | m_Script: {fileID: 11500000, guid: b1dacebd9391b6042bc24da92f3ceff5, type: 3} 156 | m_Name: 157 | m_EditorClassIdentifier: 158 | _width: 35 159 | _height: 25 160 | _console: 161 | _size: 162 | x: 0 163 | y: 0 164 | _material: {fileID: 0} 165 | _isDirty: 0 166 | --- !u!33 &1114609667 167 | MeshFilter: 168 | m_ObjectHideFlags: 0 169 | m_CorrespondingSourceObject: {fileID: 0} 170 | m_PrefabInstance: {fileID: 0} 171 | m_PrefabAsset: {fileID: 0} 172 | m_GameObject: {fileID: 1114609665} 173 | m_Mesh: {fileID: 0} 174 | --- !u!23 &1114609668 175 | MeshRenderer: 176 | m_ObjectHideFlags: 0 177 | m_CorrespondingSourceObject: {fileID: 0} 178 | m_PrefabInstance: {fileID: 0} 179 | m_PrefabAsset: {fileID: 0} 180 | m_GameObject: {fileID: 1114609665} 181 | m_Enabled: 1 182 | m_CastShadows: 1 183 | m_ReceiveShadows: 1 184 | m_DynamicOccludee: 1 185 | m_MotionVectors: 1 186 | m_LightProbeUsage: 1 187 | m_ReflectionProbeUsage: 1 188 | m_RayTracingMode: 2 189 | m_RayTraceProcedural: 0 190 | m_RenderingLayerMask: 1 191 | m_RendererPriority: 0 192 | m_Materials: 193 | - {fileID: 2100000, guid: c3f337c9cda59f3498d8f0723e32643a, type: 2} 194 | m_StaticBatchInfo: 195 | firstSubMesh: 0 196 | subMeshCount: 0 197 | m_StaticBatchRoot: {fileID: 0} 198 | m_ProbeAnchor: {fileID: 0} 199 | m_LightProbeVolumeOverride: {fileID: 0} 200 | m_ScaleInLightmap: 1 201 | m_ReceiveGI: 1 202 | m_PreserveUVs: 0 203 | m_IgnoreNormalsForChartDetection: 0 204 | m_ImportantGI: 0 205 | m_StitchLightmapSeams: 1 206 | m_SelectedEditorRenderState: 3 207 | m_MinimumChartSize: 4 208 | m_AutoUVMaxDistance: 0.5 209 | m_AutoUVMaxAngle: 89 210 | m_LightmapParameters: {fileID: 0} 211 | m_SortingLayerID: 0 212 | m_SortingLayer: 0 213 | m_SortingOrder: 0 214 | m_AdditionalVertexStreams: {fileID: 0} 215 | --- !u!4 &1114609669 216 | Transform: 217 | m_ObjectHideFlags: 0 218 | m_CorrespondingSourceObject: {fileID: 0} 219 | m_PrefabInstance: {fileID: 0} 220 | m_PrefabAsset: {fileID: 0} 221 | m_GameObject: {fileID: 1114609665} 222 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 223 | m_LocalPosition: {x: 0, y: 0, z: 0} 224 | m_LocalScale: {x: 1, y: 1, z: 1} 225 | m_Children: [] 226 | m_Father: {fileID: 0} 227 | m_RootOrder: 1 228 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 229 | --- !u!114 &1114609670 230 | MonoBehaviour: 231 | m_ObjectHideFlags: 0 232 | m_CorrespondingSourceObject: {fileID: 0} 233 | m_PrefabInstance: {fileID: 0} 234 | m_PrefabAsset: {fileID: 0} 235 | m_GameObject: {fileID: 1114609665} 236 | m_Enabled: 1 237 | m_EditorHideFlags: 0 238 | m_Script: {fileID: 11500000, guid: c905d3e0d960f4d469b26e49b3dd15d8, type: 3} 239 | m_Name: 240 | m_EditorClassIdentifier: 241 | _console: {fileID: 1114609666} 242 | --- !u!1 &1121773562 243 | GameObject: 244 | m_ObjectHideFlags: 0 245 | m_CorrespondingSourceObject: {fileID: 0} 246 | m_PrefabInstance: {fileID: 0} 247 | m_PrefabAsset: {fileID: 0} 248 | serializedVersion: 6 249 | m_Component: 250 | - component: {fileID: 1121773567} 251 | - component: {fileID: 1121773566} 252 | - component: {fileID: 1121773565} 253 | - component: {fileID: 1121773564} 254 | - component: {fileID: 1121773563} 255 | - component: {fileID: 1121773568} 256 | - component: {fileID: 1121773569} 257 | m_Layer: 0 258 | m_Name: Main Camera 259 | m_TagString: MainCamera 260 | m_Icon: {fileID: 0} 261 | m_NavMeshLayer: 0 262 | m_StaticEditorFlags: 0 263 | m_IsActive: 1 264 | --- !u!114 &1121773563 265 | MonoBehaviour: 266 | m_ObjectHideFlags: 0 267 | m_CorrespondingSourceObject: {fileID: 0} 268 | m_PrefabInstance: {fileID: 0} 269 | m_PrefabAsset: {fileID: 0} 270 | m_GameObject: {fileID: 1121773562} 271 | m_Enabled: 1 272 | m_EditorHideFlags: 0 273 | m_Script: {fileID: 11500000, guid: 8d994d465cada224baad851e5b5d7eb5, type: 3} 274 | m_Name: 275 | m_EditorClassIdentifier: 276 | _consoleProxy: {fileID: 1114609666} 277 | --- !u!114 &1121773564 278 | MonoBehaviour: 279 | m_ObjectHideFlags: 0 280 | m_CorrespondingSourceObject: {fileID: 0} 281 | m_PrefabInstance: {fileID: 0} 282 | m_PrefabAsset: {fileID: 0} 283 | m_GameObject: {fileID: 1121773562} 284 | m_Enabled: 1 285 | m_EditorHideFlags: 0 286 | m_Script: {fileID: 11500000, guid: c88f5cead0c0b2a4eb05b5900433f8d1, type: 3} 287 | m_Name: 288 | m_EditorClassIdentifier: 289 | m_AssetsPPU: 8 290 | m_RefResolutionX: 320 291 | m_RefResolutionY: 180 292 | m_UpscaleRT: 1 293 | m_PixelSnapping: 0 294 | m_CropFrameX: 1 295 | m_CropFrameY: 1 296 | m_StretchFill: 0 297 | --- !u!81 &1121773565 298 | AudioListener: 299 | m_ObjectHideFlags: 0 300 | m_CorrespondingSourceObject: {fileID: 0} 301 | m_PrefabInstance: {fileID: 0} 302 | m_PrefabAsset: {fileID: 0} 303 | m_GameObject: {fileID: 1121773562} 304 | m_Enabled: 1 305 | --- !u!20 &1121773566 306 | Camera: 307 | m_ObjectHideFlags: 0 308 | m_CorrespondingSourceObject: {fileID: 0} 309 | m_PrefabInstance: {fileID: 0} 310 | m_PrefabAsset: {fileID: 0} 311 | m_GameObject: {fileID: 1121773562} 312 | m_Enabled: 1 313 | serializedVersion: 2 314 | m_ClearFlags: 1 315 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 316 | m_projectionMatrixMode: 1 317 | m_GateFitMode: 2 318 | m_FOVAxisMode: 0 319 | m_SensorSize: {x: 36, y: 24} 320 | m_LensShift: {x: 0, y: 0} 321 | m_FocalLength: 50 322 | m_NormalizedViewPortRect: 323 | serializedVersion: 2 324 | x: 0 325 | y: 0 326 | width: 1 327 | height: 1 328 | near clip plane: 0.3 329 | far clip plane: 1000 330 | field of view: 60 331 | orthographic: 1 332 | orthographic size: 5 333 | m_Depth: -1 334 | m_CullingMask: 335 | serializedVersion: 2 336 | m_Bits: 4294967295 337 | m_RenderingPath: -1 338 | m_TargetTexture: {fileID: 0} 339 | m_TargetDisplay: 0 340 | m_TargetEye: 3 341 | m_HDR: 1 342 | m_AllowMSAA: 1 343 | m_AllowDynamicResolution: 0 344 | m_ForceIntoRT: 0 345 | m_OcclusionCulling: 1 346 | m_StereoConvergence: 10 347 | m_StereoSeparation: 0.022 348 | --- !u!4 &1121773567 349 | Transform: 350 | m_ObjectHideFlags: 0 351 | m_CorrespondingSourceObject: {fileID: 0} 352 | m_PrefabInstance: {fileID: 0} 353 | m_PrefabAsset: {fileID: 0} 354 | m_GameObject: {fileID: 1121773562} 355 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 356 | m_LocalPosition: {x: 0, y: 0, z: -10} 357 | m_LocalScale: {x: 1, y: 1, z: 1} 358 | m_Children: [] 359 | m_Father: {fileID: 0} 360 | m_RootOrder: 0 361 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 362 | --- !u!114 &1121773568 363 | MonoBehaviour: 364 | m_ObjectHideFlags: 0 365 | m_CorrespondingSourceObject: {fileID: 0} 366 | m_PrefabInstance: {fileID: 0} 367 | m_PrefabAsset: {fileID: 0} 368 | m_GameObject: {fileID: 1121773562} 369 | m_Enabled: 1 370 | m_EditorHideFlags: 0 371 | m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} 372 | m_Name: 373 | m_EditorClassIdentifier: 374 | m_RenderShadows: 1 375 | m_RequiresDepthTextureOption: 2 376 | m_RequiresOpaqueTextureOption: 2 377 | m_CameraType: 0 378 | m_Cameras: [] 379 | m_RendererIndex: -1 380 | m_VolumeLayerMask: 381 | serializedVersion: 2 382 | m_Bits: 1 383 | m_VolumeTrigger: {fileID: 0} 384 | m_RenderPostProcessing: 0 385 | m_Antialiasing: 0 386 | m_AntialiasingQuality: 2 387 | m_StopNaN: 0 388 | m_Dithering: 0 389 | m_ClearDepth: 1 390 | m_AllowXRRendering: 1 391 | m_RequiresDepthTexture: 0 392 | m_RequiresColorTexture: 0 393 | m_Version: 2 394 | --- !u!114 &1121773569 395 | MonoBehaviour: 396 | m_ObjectHideFlags: 0 397 | m_CorrespondingSourceObject: {fileID: 0} 398 | m_PrefabInstance: {fileID: 0} 399 | m_PrefabAsset: {fileID: 0} 400 | m_GameObject: {fileID: 1121773562} 401 | m_Enabled: 1 402 | m_EditorHideFlags: 0 403 | m_Script: {fileID: 11500000, guid: c49b4cc203aa6414fae5c798d1d0e7d6, type: 3} 404 | m_Name: 405 | m_EditorClassIdentifier: 406 | m_EventMask: 407 | serializedVersion: 2 408 | m_Bits: 4294967295 409 | m_MaxRayIntersections: 0 410 | -------------------------------------------------------------------------------- /Assets/PathfindingMaps/PathfindingMaps.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6285643e20ec6c6418fe4a86d4f4391d 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/RuntimeResizeTest.cs: -------------------------------------------------------------------------------- 1 | using Sark.RenderUtils; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityEngine.InputSystem; 6 | 7 | public class RuntimeResizeTest : MonoBehaviour 8 | { 9 | TiledCamera _cam; 10 | 11 | Controls _controls; 12 | InputAction _resize; 13 | 14 | private void Awake() 15 | { 16 | _cam = GetComponent(); 17 | _controls = new Controls(); 18 | _controls.Enable(); 19 | 20 | _resize = _controls.Default.ResizeMap; 21 | } 22 | 23 | // Update is called once per frame 24 | void Update() 25 | { 26 | Vector2 resize = _resize.ReadValue(); 27 | int hor = (int)resize.x; 28 | int ver = (int)resize.y; 29 | 30 | var count = _cam.TileCount; 31 | count.x += hor; 32 | count.y += ver; 33 | _cam.TileCount = count; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Assets/RuntimeResizeTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7dd5c7d5c322304794aeee0b2504637 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Settings.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0735c275001a2c84dafdb30deced5d8d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/ForwardRenderer.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} 13 | m_Name: ForwardRenderer 14 | m_EditorClassIdentifier: 15 | m_RendererFeatures: [] 16 | m_RendererFeatureMap: 17 | postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} 18 | xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2} 19 | shaders: 20 | blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} 21 | copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3} 22 | screenSpaceShadowPS: {fileID: 4800000, guid: 0f854b35a0cf61a429bd5dcfea30eddd, type: 3} 23 | samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} 24 | tileDepthInfoPS: {fileID: 4800000, guid: f451c6bec16aa51408bdfd37f70aed12, type: 3} 25 | tileDeferredPS: {fileID: 4800000, guid: 344787727e03649488a1022c09fa74b5, type: 3} 26 | stencilDeferredPS: {fileID: 4800000, guid: e9155b26e1bc55942a41e518703fe304, type: 3} 27 | fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3} 28 | materialErrorPS: {fileID: 4800000, guid: 5fd9a8feb75a4b5894c241777f519d4e, type: 3} 29 | m_OpaqueLayerMask: 30 | serializedVersion: 2 31 | m_Bits: 4294967295 32 | m_TransparentLayerMask: 33 | serializedVersion: 2 34 | m_Bits: 4294967295 35 | m_DefaultStencilState: 36 | overrideStencilState: 0 37 | stencilReference: 0 38 | stencilCompareFunction: 8 39 | passOperation: 0 40 | failOperation: 0 41 | zFailOperation: 0 42 | m_ShadowTransparentReceive: 1 43 | m_RenderingMode: 0 44 | m_AccurateGbufferNormals: 0 45 | -------------------------------------------------------------------------------- /Assets/Settings/ForwardRenderer.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a8e21d5c33334b11b34a596161b9360 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/SampleSceneProfile.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &-7893295128165547882 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 3 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3} 13 | m_Name: Bloom 14 | m_EditorClassIdentifier: 15 | active: 1 16 | m_AdvancedMode: 0 17 | threshold: 18 | m_OverrideState: 1 19 | m_Value: 1 20 | min: 0 21 | intensity: 22 | m_OverrideState: 1 23 | m_Value: 1 24 | min: 0 25 | scatter: 26 | m_OverrideState: 0 27 | m_Value: 0.7 28 | min: 0 29 | max: 1 30 | clamp: 31 | m_OverrideState: 0 32 | m_Value: 65472 33 | min: 0 34 | tint: 35 | m_OverrideState: 0 36 | m_Value: {r: 1, g: 1, b: 1, a: 1} 37 | hdr: 0 38 | showAlpha: 0 39 | showEyeDropper: 1 40 | highQualityFiltering: 41 | m_OverrideState: 0 42 | m_Value: 0 43 | dirtTexture: 44 | m_OverrideState: 0 45 | m_Value: {fileID: 0} 46 | dirtIntensity: 47 | m_OverrideState: 0 48 | m_Value: 0 49 | min: 0 50 | --- !u!114 &-7011558710299706105 51 | MonoBehaviour: 52 | m_ObjectHideFlags: 3 53 | m_CorrespondingSourceObject: {fileID: 0} 54 | m_PrefabInstance: {fileID: 0} 55 | m_PrefabAsset: {fileID: 0} 56 | m_GameObject: {fileID: 0} 57 | m_Enabled: 1 58 | m_EditorHideFlags: 0 59 | m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3} 60 | m_Name: Vignette 61 | m_EditorClassIdentifier: 62 | active: 1 63 | m_AdvancedMode: 0 64 | color: 65 | m_OverrideState: 0 66 | m_Value: {r: 0, g: 0, b: 0, a: 1} 67 | hdr: 0 68 | showAlpha: 0 69 | showEyeDropper: 1 70 | center: 71 | m_OverrideState: 0 72 | m_Value: {x: 0.5, y: 0.5} 73 | intensity: 74 | m_OverrideState: 1 75 | m_Value: 0.25 76 | min: 0 77 | max: 1 78 | smoothness: 79 | m_OverrideState: 1 80 | m_Value: 0.4 81 | min: 0.01 82 | max: 1 83 | rounded: 84 | m_OverrideState: 0 85 | m_Value: 0 86 | --- !u!114 &11400000 87 | MonoBehaviour: 88 | m_ObjectHideFlags: 0 89 | m_CorrespondingSourceObject: {fileID: 0} 90 | m_PrefabInstance: {fileID: 0} 91 | m_PrefabAsset: {fileID: 0} 92 | m_GameObject: {fileID: 0} 93 | m_Enabled: 1 94 | m_EditorHideFlags: 0 95 | m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} 96 | m_Name: SampleSceneProfile 97 | m_EditorClassIdentifier: 98 | components: 99 | - {fileID: 849379129802519247} 100 | - {fileID: -7893295128165547882} 101 | - {fileID: -7011558710299706105} 102 | --- !u!114 &849379129802519247 103 | MonoBehaviour: 104 | m_ObjectHideFlags: 3 105 | m_CorrespondingSourceObject: {fileID: 0} 106 | m_PrefabInstance: {fileID: 0} 107 | m_PrefabAsset: {fileID: 0} 108 | m_GameObject: {fileID: 0} 109 | m_Enabled: 1 110 | m_EditorHideFlags: 0 111 | m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3} 112 | m_Name: Tonemapping 113 | m_EditorClassIdentifier: 114 | active: 1 115 | m_AdvancedMode: 0 116 | mode: 117 | m_OverrideState: 1 118 | m_Value: 2 119 | -------------------------------------------------------------------------------- /Assets/Settings/SampleSceneProfile.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 10fc4df2da32a41aaa32d77bc913491c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/UniversalRP-HighQuality.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} 13 | m_Name: UniversalRP-HighQuality 14 | m_EditorClassIdentifier: 15 | k_AssetVersion: 5 16 | k_AssetPreviousVersion: 5 17 | m_RendererType: 1 18 | m_RendererData: {fileID: 0} 19 | m_RendererDataList: 20 | - {fileID: 11400000, guid: 4a8e21d5c33334b11b34a596161b9360, type: 2} 21 | m_DefaultRendererIndex: 0 22 | m_RequireDepthTexture: 0 23 | m_RequireOpaqueTexture: 0 24 | m_OpaqueDownsampling: 1 25 | m_SupportsHDR: 1 26 | m_MSAA: 2 27 | m_RenderScale: 1 28 | m_MainLightRenderingMode: 1 29 | m_MainLightShadowsSupported: 1 30 | m_MainLightShadowmapResolution: 2048 31 | m_AdditionalLightsRenderingMode: 1 32 | m_AdditionalLightsPerObjectLimit: 4 33 | m_AdditionalLightShadowsSupported: 1 34 | m_AdditionalLightsShadowmapResolution: 512 35 | m_ShadowDistance: 50 36 | m_ShadowCascades: 1 37 | m_Cascade2Split: 0.25 38 | m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} 39 | m_ShadowDepthBias: 1 40 | m_ShadowNormalBias: 1 41 | m_SoftShadowsSupported: 1 42 | m_UseSRPBatcher: 1 43 | m_SupportsDynamicBatching: 0 44 | m_MixedLightingSupported: 1 45 | m_DebugLevel: 0 46 | m_ColorGradingMode: 0 47 | m_ColorGradingLutSize: 32 48 | m_ShadowType: 1 49 | m_LocalShadowsSupported: 0 50 | m_LocalShadowsAtlasResolution: 256 51 | m_MaxPixelLights: 0 52 | m_ShadowAtlasResolution: 256 53 | m_ShaderVariantLogLevel: 0 54 | -------------------------------------------------------------------------------- /Assets/Settings/UniversalRP-HighQuality.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19ba41d7c0026c3459d37c2fe90c55a0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/UniversalRP-LowQuality.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} 13 | m_Name: UniversalRP-LowQuality 14 | m_EditorClassIdentifier: 15 | k_AssetVersion: 5 16 | k_AssetPreviousVersion: 5 17 | m_RendererType: 1 18 | m_RendererData: {fileID: 0} 19 | m_RendererDataList: 20 | - {fileID: 11400000, guid: 4a8e21d5c33334b11b34a596161b9360, type: 2} 21 | m_DefaultRendererIndex: 0 22 | m_RequireDepthTexture: 0 23 | m_RequireOpaqueTexture: 0 24 | m_OpaqueDownsampling: 1 25 | m_SupportsHDR: 0 26 | m_MSAA: 1 27 | m_RenderScale: 1 28 | m_MainLightRenderingMode: 1 29 | m_MainLightShadowsSupported: 0 30 | m_MainLightShadowmapResolution: 2048 31 | m_AdditionalLightsRenderingMode: 0 32 | m_AdditionalLightsPerObjectLimit: 4 33 | m_AdditionalLightShadowsSupported: 0 34 | m_AdditionalLightsShadowmapResolution: 512 35 | m_ShadowDistance: 50 36 | m_ShadowCascades: 0 37 | m_Cascade2Split: 0.25 38 | m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} 39 | m_ShadowDepthBias: 1 40 | m_ShadowNormalBias: 1 41 | m_SoftShadowsSupported: 0 42 | m_UseSRPBatcher: 1 43 | m_SupportsDynamicBatching: 0 44 | m_MixedLightingSupported: 1 45 | m_DebugLevel: 0 46 | m_ColorGradingMode: 0 47 | m_ColorGradingLutSize: 16 48 | m_ShadowType: 1 49 | m_LocalShadowsSupported: 0 50 | m_LocalShadowsAtlasResolution: 256 51 | m_MaxPixelLights: 0 52 | m_ShadowAtlasResolution: 256 53 | m_ShaderVariantLogLevel: 0 54 | -------------------------------------------------------------------------------- /Assets/Settings/UniversalRP-LowQuality.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a31e9f9f9c9d4b9429ed0d1234e22103 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/UniversalRP-MediumQuality.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} 13 | m_Name: UniversalRP-MediumQuality 14 | m_EditorClassIdentifier: 15 | k_AssetVersion: 5 16 | k_AssetPreviousVersion: 5 17 | m_RendererType: 1 18 | m_RendererData: {fileID: 0} 19 | m_RendererDataList: 20 | - {fileID: 11400000, guid: 4a8e21d5c33334b11b34a596161b9360, type: 2} 21 | m_DefaultRendererIndex: 0 22 | m_RequireDepthTexture: 0 23 | m_RequireOpaqueTexture: 0 24 | m_OpaqueDownsampling: 1 25 | m_SupportsHDR: 0 26 | m_MSAA: 1 27 | m_RenderScale: 1 28 | m_MainLightRenderingMode: 1 29 | m_MainLightShadowsSupported: 1 30 | m_MainLightShadowmapResolution: 2048 31 | m_AdditionalLightsRenderingMode: 1 32 | m_AdditionalLightsPerObjectLimit: 4 33 | m_AdditionalLightShadowsSupported: 0 34 | m_AdditionalLightsShadowmapResolution: 512 35 | m_ShadowDistance: 50 36 | m_ShadowCascades: 0 37 | m_Cascade2Split: 0.25 38 | m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} 39 | m_ShadowDepthBias: 1 40 | m_ShadowNormalBias: 1 41 | m_SoftShadowsSupported: 0 42 | m_UseSRPBatcher: 1 43 | m_SupportsDynamicBatching: 0 44 | m_MixedLightingSupported: 1 45 | m_DebugLevel: 0 46 | m_ColorGradingMode: 0 47 | m_ColorGradingLutSize: 32 48 | m_ShadowType: 1 49 | m_LocalShadowsSupported: 0 50 | m_LocalShadowsAtlasResolution: 256 51 | m_MaxPixelLights: 0 52 | m_ShadowAtlasResolution: 256 53 | m_ShaderVariantLogLevel: 0 54 | -------------------------------------------------------------------------------- /Assets/Settings/UniversalRP-MediumQuality.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d847b876476d3d6468f5dfcd34266f96 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/SpriteCursor.cs: -------------------------------------------------------------------------------- 1 | using Sark.Terminals; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using UnityEngine.InputSystem; 7 | 8 | public class SpriteCursor : MonoBehaviour 9 | { 10 | [SerializeField] 11 | TerminalBehaviour _term; 12 | 13 | [SerializeField] 14 | Transform _cursor = null; 15 | 16 | // Update is called once per frame 17 | void Update() 18 | { 19 | var mouse = Mouse.current.position.ReadValue(); 20 | float3 mouseWorld = Camera.main.ScreenToWorldPoint(new float3(mouse, 0)); 21 | mouseWorld.z = -1; 22 | 23 | mouseWorld.xy = math.floor(mouseWorld.xy); 24 | 25 | _cursor.position = mouseWorld; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/SpriteCursor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29b423b668943f942ac458245e63e79e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.3.6](https://github.com/sarkahn/rltk_unity/compare/v0.3.5...v0.3.6) (2020-11-19) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * Updated terminals dependency ([6bc23fa](https://github.com/sarkahn/rltk_unity/commit/6bc23fa1aad8880505e5b0d0cc7c14dc6dcea9b8)) 7 | 8 | ## [0.3.5](https://github.com/sarkahn/rltk_unity/compare/v0.3.4...v0.3.5) (2020-11-19) 9 | 10 | 11 | ### Bug Fixes 12 | 13 | * Added renderutilities for drawing simple terminals without gameobjects ([e7c851e](https://github.com/sarkahn/rltk_unity/commit/e7c851ee7c0cba3b50ee7ea446139e95b5d13665)) 14 | 15 | ## [0.3.4](https://github.com/sarkahn/rltk_unity/compare/v0.3.3...v0.3.4) (2020-11-18) 16 | 17 | 18 | ### Bug Fixes 19 | 20 | * More dependency fixes ([c342baf](https://github.com/sarkahn/rltk_unity/commit/c342bafa37e33532368c5ee73f80d2271afb60d7)) 21 | 22 | ## [0.3.3](https://github.com/sarkahn/rltk_unity/compare/v0.3.2...v0.3.3) (2020-11-18) 23 | 24 | 25 | ### Bug Fixes 26 | 27 | * Forgot tiled_camera dependency ([7a3cea9](https://github.com/sarkahn/rltk_unity/commit/7a3cea9cf97c6de626c83a869b8eec8c088883a5)) 28 | 29 | ## [0.3.2](https://github.com/sarkahn/rltk_unity/compare/v0.3.1...v0.3.2) (2020-11-18) 30 | 31 | 32 | ### Bug Fixes 33 | 34 | * Forgot input system dependency ([432f87e](https://github.com/sarkahn/rltk_unity/commit/432f87e2844bacb9edaea6bf211182a340cf414c)) 35 | 36 | ## [0.3.1](https://github.com/sarkahn/rltk_unity/compare/v0.3.0...v0.3.1) (2020-11-18) 37 | 38 | 39 | ### Bug Fixes 40 | 41 | * Fix package dependency issue - wrong URP version ([bf4477e](https://github.com/sarkahn/rltk_unity/commit/bf4477e4a99484089206b6ad30d12de619b30d93)) 42 | 43 | # [0.3.0](https://github.com/sarkahn/rltk_unity/compare/v0.2.9...v0.3.0) (2020-11-18) 44 | 45 | 46 | ### Bug Fixes 47 | 48 | * updated to 2019.3.2f1 ([5d7ae08](https://github.com/sarkahn/rltk_unity/commit/5d7ae082688f71aaf2ba144d9fe070d8acd2b88c)) 49 | * Updated to 2020.2.0b10 ([4ba2631](https://github.com/sarkahn/rltk_unity/commit/4ba2631963634d42c54a0d907c66147889915fd4)) 50 | 51 | 52 | ### Features 53 | 54 | * Major rework ([b73bbb4](https://github.com/sarkahn/rltk_unity/commit/b73bbb4bfe35506dcd3f14d3213301be83782920)) 55 | 56 | ## [0.2.10] (2020-10-30) 57 | Converted to "embedded package". Updated to Unity 2020 and updated package dependencies 58 | 59 | ## [0.2.9](https://github.com/sarkahn/rltk_unity/compare/v0.2.8...v0.2.9) (2020-03-06) 60 | 61 | 62 | ### Bug Fixes 63 | 64 | * revert doc copies in bash script ([d7d9f0e](https://github.com/sarkahn/rltk_unity/commit/d7d9f0ee6e1c771c27eb9a870140243802629ae4)) 65 | 66 | ## [0.2.8](https://github.com/sarkahn/rltk_unity/compare/v0.2.7...v0.2.8) (2020-03-06) 67 | 68 | 69 | ### Bug Fixes 70 | 71 | * Error in bash script ([fdae813](https://github.com/sarkahn/rltk_unity/commit/fdae813e7990bfdc5cbbf097bc2aabb14ba38d98)) 72 | 73 | ## [0.2.7](https://github.com/sarkahn/rltk_unity/compare/v0.2.6...v0.2.7) (2020-03-06) 74 | 75 | 76 | ### Bug Fixes 77 | 78 | * Wrong package version ([3d59a63](https://github.com/sarkahn/rltk_unity/commit/3d59a63411d15adf26b447e2d7ce2b4efe6103ae)) 79 | -------------------------------------------------------------------------------- /Documentation~/images~/fovdemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sarkahn/rltk_unity/a68d0c02f70902fc9542a0f74dd0d14b125d577f/Documentation~/images~/fovdemo.png -------------------------------------------------------------------------------- /Documentation~/images~/pathfinddemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sarkahn/rltk_unity/a68d0c02f70902fc9542a0f74dd0d14b125d577f/Documentation~/images~/pathfinddemo.png -------------------------------------------------------------------------------- /Documentation~/images~/samples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sarkahn/rltk_unity/a68d0c02f70902fc9542a0f74dd0d14b125d577f/Documentation~/images~/samples.png -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Sark 4 | 5 | This project was originally built from the Roguelike Toolkit for Rust by TheBracket 6 | (Copyright 2019 Herbert Wolverson (DBA Bracket Productions)) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.2.10] (2020-10-30) 2 | Converted to "embedded package". Updated to Unity 2020 and updated package dependencies 3 | 4 | ## [0.2.9](https://github.com/sarkahn/rltk_unity/compare/v0.2.8...v0.2.9) (2020-03-06) 5 | 6 | 7 | ### Bug Fixes 8 | 9 | * revert doc copies in bash script ([d7d9f0e](https://github.com/sarkahn/rltk_unity/commit/d7d9f0ee6e1c771c27eb9a870140243802629ae4)) 10 | 11 | ## [0.2.8](https://github.com/sarkahn/rltk_unity/compare/v0.2.7...v0.2.8) (2020-03-06) 12 | 13 | 14 | ### Bug Fixes 15 | 16 | * Error in bash script ([fdae813](https://github.com/sarkahn/rltk_unity/commit/fdae813e7990bfdc5cbbf097bc2aabb14ba38d98)) 17 | 18 | ## [0.2.7](https://github.com/sarkahn/rltk_unity/compare/v0.2.6...v0.2.7) (2020-03-06) 19 | 20 | 21 | ### Bug Fixes 22 | 23 | * Wrong package version ([3d59a63](https://github.com/sarkahn/rltk_unity/commit/3d59a63411d15adf26b447e2d7ce2b4efe6103ae)) 24 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44f31f4195811394982a7f7e025c614f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Sark 4 | 5 | This project is a port of https://github.com/thebracket/rltk_rs 6 | (Copyright 2019 Herbert Wolverson (DBA Bracket Productions)) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 738f60d5a04fe864dbea2ae90dfce2d4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/README.md: -------------------------------------------------------------------------------- 1 | # The Roguelike Toolkit (RLTK) for Unity 2 | 3 | ![](Documentation~/images~/splash.png) 4 | 5 | This is a framework built specifically for creating roguelikes and rendering ascii efficiently and without artifacts inside Unity. While the API is made to be as simple and straightforward as possible, internally it utilizes Unity's Job system and Burst compiler to achieve great performance and avoid any memory allocations whenever possible. 6 | 7 | This code is based off [The Roguelike Toolkit (RLTK), implemented for Rust](https://github.com/thebracket/rltk_rs). 8 | 9 | ## How to Install 10 | 11 | RLTK is designed as a package. You can install it via the Package Manager: 12 | 13 | __+__ -> __"Add package from git url..."__ -> `https://github.com/sarkahn/rltk_unity.git` 14 | 15 | ## The Samples 16 | 17 | The samples demonstrate how to properly set up and write to a console. They can be imported from the package manager gui. 18 | 19 | ##### Samples/Noise 20 | 21 | ![](Documentation~/images~/noise.gif) 22 | 23 | ##### Samples/ShaderExample 24 | 25 | ![](Documentation~/images~/console_shader2.gif) 26 | 27 | 28 | ## The Consoles 29 | 30 | There are three primary console types, `SimpleConsole`, `NativeConsole` and `SimpleConsoleProxy`: 31 | 32 | ##### [SimpleConsole](Runtime/Consoles/SimpleConsole.cs) - Usage is demonstrated in the "ManualDraw" sample. 33 | * Provides a straightforward API for writing text to a console. 34 | * **NOT** a MonoBehaviour, you must construct and use it directly from code. 35 | * Must manually call `Draw()` and `Update()` every frame to render it. 36 | * Must call manually `Dispose()` before it goes out of scope to free internal [unmanaged memory](https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.html). 37 | 38 | 39 | 40 | ##### [NativeConsole](Runtime/Consoles/NativeConsole.cs) - Usage is demonstrated in the "Noise" sample. 41 | * Derived from `SimpleConsole`, provides a few more advanced functions for those familiar with Unity's [job system](https://docs.unity3d.com/2019.3/Documentation/Manual/JobSystem.html). 42 | * Same rules for `Draw()` and `Dispose()`. 43 | 44 | ##### [SimpleConsoleProxy](Runtime/MonoBehaviours/SimpleConsoleProxy.cs) - Usage is demonstrated in the "Hello World" sample. 45 | * A MonoBehaviour wrapped around a `SimpleConsole`. Allows you to easily reference and write to a console from other MonoBehaviours. 46 | * Console properties can be tweaked from the inspector. 47 | * No need to call `Dispose()` or `Draw()`. 48 | * Can be set up automatically using the menu option `GameObject/RLTK/Initialize Simple Console`. 49 | 50 | 51 | 52 | **IMPORTANT**: In order to avoid rendering artifacts you must make sure to keep the console position locked to the pixel grid (origin works) and have the viewport and camera set up properly. An easy way to automatically set up the camera is directly from code with a single function call to [RenderUtility.AdjustCameraToConsole](Runtime/Rendering/RenderUtility.cs#L112). 53 | 54 | 55 | If you're using SimpleConsoleProxy you can use the [LockCameraToConsole](Runtime/Monobehaviours/LockCameraToConsole.cs) MonoBehaviour instead. 56 | 57 | ## What does it do 58 | * You can write to a console with the `Set` and `Print` functions, or retrieve the native tiles from the console for use directly inside jobs. Consoles are fast enough to clear and draw a large number of tiles every frame, the way you would in a traditional roguelike. 59 | * There are field of view functions in the `FOV` class. 60 | 61 | ## How to use it 62 | 63 | For examples of how to use the different parts of the framework check the [samples](https://github.com/sarkahn/rltk_unity/tree/master/Assets/Samples) and [tests](https://github.com/sarkahn/rltk_unity/tree/master/Assets/Tests/Editor). 64 | 65 | Along with RLTK I am [developing a Roguelike that uses RLTK as a backend](https://github.com/sarkahn/rltk_unity_roguelike), based on the excellent [Roguelike Tutorial in Rust](https://bfnightly.bracketproductions.com/rustbook/chapter_1.html). It's being developed using Unity's ECS framework and should be of interest to anyone who would want to know how to actually make a game using RLTK. 66 | 67 | --- 68 | RLTK for Unity will always be free and the code will always be open source. With that being said I put quite a lot of work into it. If you find it useful, please consider donating. Any amount you can spare would really help me out a great deal - thank you! 69 | 70 | [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y54CX7AXFKQXG) -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 362739ea2fb91814c8ffa60430efcdf5 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fde1625edd56cc445a36fb68d18c67c6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/FieldOfView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5666a02815cba94189ed740ddda33d9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/FieldOfView/BeveledCorners.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | 7 | // From http://www.adammil.net/blog/v125_Roguelike_Vision_Algorithms.html#mine 8 | 9 | namespace RLTK.FieldOfView.BeveledCorners 10 | { 11 | 12 | public static class FOV 13 | { 14 | static public void Compute(int2 origin, int range, T map) 15 | where T : IVisibilityMap 16 | { 17 | map.SetVisible(origin); 18 | for (int octant = 0; octant < 8; octant++) 19 | ComputeOctant(octant, origin, range, 1, 20 | new Slope(1, 1), 21 | new Slope(0, 1), map); 22 | } 23 | 24 | 25 | static void ComputeOctant(int octant, int2 origin, int range, int x, Slope top, Slope bottom, T map) 26 | where T : IVisibilityMap 27 | { 28 | for (; x <= range; x++) 29 | { 30 | int2 yCoords = ComputeYCoordinates(octant, origin, x, map, 31 | ref top, ref bottom); 32 | 33 | int topY = yCoords.x; 34 | int bottomY = yCoords.y; 35 | 36 | if (!ComputeVisibility(topY, bottomY, 37 | range, octant, origin, x, map, 38 | ref top, ref bottom)) 39 | break; 40 | } 41 | } 42 | 43 | static int2 ComputeYCoordinates( 44 | int octant, int2 origin, int x, T map, 45 | ref Slope top, ref Slope bottom) 46 | where T : IVisibilityMap 47 | { 48 | int topY; 49 | if (top.x == 1) 50 | { 51 | topY = x; 52 | } 53 | else 54 | { 55 | topY = ((x * 2 - 1) * top.y + top.x) / (top.x * 2); 56 | if (BlocksLight(x, topY, octant, origin, map)) 57 | { 58 | if (top.GreaterOrEqual(topY * 2 + 1, x * 2) && !BlocksLight(x, topY + 1, octant, origin, map)) 59 | topY++; 60 | } 61 | else 62 | { 63 | int ax = x * 2; 64 | if (BlocksLight(x + 1, topY + 1, octant, origin, map)) 65 | ax++; 66 | if (top.Greater(topY * 2 + 1, ax)) 67 | topY++; 68 | } 69 | } 70 | 71 | int bottomY; 72 | if (bottom.y == 0) 73 | { 74 | bottomY = 0; 75 | } 76 | else 77 | { 78 | bottomY = ((x * 2 - 1) * bottom.y + bottom.x) / (bottom.x * 2); 79 | if (bottom.GreaterOrEqual(bottomY * 2 + 1, x * 2) && BlocksLight(x, bottomY, octant, origin, map) && 80 | !BlocksLight(x, bottomY + 1, octant, origin, map)) 81 | { 82 | bottomY++; 83 | } 84 | } 85 | return new int2(topY, bottomY); 86 | } 87 | 88 | static bool ComputeVisibility( 89 | int topY, int bottomY, 90 | int range, int octant, int2 origin, int x, T map, 91 | ref Slope top, ref Slope bottom) 92 | where T : IVisibilityMap 93 | { 94 | int wasOpaque = -1; 95 | for (int y = topY; y >= bottomY; y--) 96 | { 97 | if (range < 0 || map.Distance(0, new int2(x, y)) <= range) 98 | { 99 | bool isOpaque = BlocksLight(x, y, octant, origin, map); 100 | bool isVisible = 101 | isOpaque || 102 | ((y != topY || top.Greater(y * 4 - 1, x * 4 + 1)) && 103 | (y != bottomY || bottom.Less(y * 4 + 1, x * 4 - 1))); 104 | 105 | if (isVisible) 106 | SetVisible(x, y, octant, origin, map); 107 | 108 | if (x != range) 109 | { 110 | if (isOpaque) 111 | { 112 | if (wasOpaque == 0) 113 | { 114 | int nx = x * 2, ny = y * 2 + 1; 115 | if (BlocksLight(x, y + 1, octant, origin, map)) 116 | nx--; 117 | if (top.Greater(ny, nx)) 118 | { 119 | if (y == bottomY) 120 | { 121 | bottom = new Slope(ny, nx); 122 | break; 123 | } 124 | else 125 | ComputeOctant(octant, origin, range, x + 1, top, new Slope(ny, nx), map); 126 | } 127 | else 128 | { 129 | if (y == bottomY) 130 | return true; 131 | } 132 | } 133 | wasOpaque = 1; 134 | } 135 | else 136 | { 137 | if (wasOpaque > 0) 138 | { 139 | int nx = x * 2, ny = y * 2 + 1; 140 | if (BlocksLight(x + 1, y + 1, octant, origin, map)) 141 | nx++; 142 | if (bottom.GreaterOrEqual(ny, nx)) 143 | return false; 144 | top = new Slope(ny, nx); 145 | } 146 | wasOpaque = 0; 147 | } 148 | } 149 | } 150 | } 151 | 152 | return !(wasOpaque != 0); 153 | } 154 | 155 | // NOTE: the code duplication between BlocksLight and SetVisible is for performance. don't refactor the octant 156 | // translation out unless you don't mind an 18% drop in speed 157 | static bool BlocksLight(int x, int y, int octant, int2 origin, T map) where T : IVisibilityMap 158 | { 159 | int nx = origin.x, ny = origin.y; 160 | switch (octant) 161 | { 162 | case 0: nx += x; ny -= y; break; 163 | case 1: nx += y; ny -= x; break; 164 | case 2: nx -= y; ny -= x; break; 165 | case 3: nx -= x; ny -= y; break; 166 | case 4: nx -= x; ny += y; break; 167 | case 5: nx -= y; ny += x; break; 168 | case 6: nx += y; ny += x; break; 169 | case 7: nx += x; ny += y; break; 170 | } 171 | return map.IsOpaque(new int2((int)nx, (int)ny)); 172 | } 173 | 174 | static void SetVisible(int x, int y, int octant, int2 origin, T map) where T : IVisibilityMap 175 | { 176 | int nx = origin.x, ny = origin.y; 177 | switch (octant) 178 | { 179 | case 0: nx += x; ny -= y; break; 180 | case 1: nx += y; ny -= x; break; 181 | case 2: nx -= y; ny -= x; break; 182 | case 3: nx -= x; ny -= y; break; 183 | case 4: nx -= x; ny += y; break; 184 | case 5: nx -= y; ny += x; break; 185 | case 6: nx += y; ny += x; break; 186 | case 7: nx += x; ny += y; break; 187 | } 188 | map.SetVisible(new int2((int)nx, (int)ny)); 189 | } 190 | 191 | struct Slope // represents the slope Y/X as a rational number 192 | { 193 | public Slope(int y, int x) { this.y = y; this.x = x; } 194 | 195 | // this > y/x 196 | public bool Greater(int y, int x) { return this.y * x > this.x * y; } 197 | 198 | // this >= y/x 199 | public bool GreaterOrEqual(int y, int x) { return this.y * x >= this.x * y; } 200 | 201 | // this < y/x 202 | public bool Less(int y, int x) { return this.y * x < this.x * y; } 203 | 204 | public readonly int x, y; 205 | } 206 | 207 | } 208 | } -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/FieldOfView/BeveledCorners.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 713c66f133db0724fb93c52c160450b5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/FieldOfView/Bresenham.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | //using System; 4 | //using Unity.Collections; 5 | //using Unity.Mathematics; 6 | 7 | //namespace RLTK.FieldOfView.Bresenham 8 | //{ 9 | // public static class FOV 10 | // { 11 | // public static void Compute(int2 origin, int range, T visibilityMap) where T : IVisibilityMap 12 | // { 13 | // NativeHashSet pointSet = new NativeHashSet((range * 2) * (range * 2), Allocator.Temp); 14 | // BuildVisibleSet(origin, range, visibilityMap, pointSet); 15 | // var enumerator = pointSet.GetEnumerator(); 16 | // while (enumerator.MoveNext()) 17 | // visibilityMap.SetVisible(enumerator.Current); 18 | // } 19 | 20 | // static void BuildVisibleSet(int2 origin, int range, T visibilityMap, NativeHashSet buffer) 21 | // where T : IVisibilityMap 22 | // { 23 | // BresenhamCircle circle = new BresenhamCircle(origin, range); 24 | // var points = circle.GetPoints(Allocator.Temp); 25 | // for (int i = 0; i < points.Length; ++i) 26 | // { 27 | // var p = points[i]; 28 | 29 | // ScanFOVLine(origin, p, visibilityMap, buffer); 30 | // } 31 | // } 32 | 33 | // static void ScanFOVLine(int2 start, int2 end, T map, NativeHashSet pointSet) where T : IVisibilityMap 34 | // { 35 | // var line = new VectorLine(start, end); 36 | // var linePoints = line.GetPoints(Allocator.Temp); 37 | // for (int i = 0; i < linePoints.Length; ++i) 38 | // { 39 | // var p = linePoints[i]; 40 | 41 | // if (!map.IsInBounds(p)) 42 | // return; 43 | 44 | // pointSet.Add(p); 45 | 46 | // if (map.IsOpaque(p)) 47 | // return; 48 | // } 49 | // } 50 | 51 | 52 | // } 53 | 54 | //} -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/FieldOfView/Bresenham.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6291674a1a0da894fb0158f302d9e42f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/FieldOfView/IVisibilityMap.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | using System; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | 7 | namespace RLTK.FieldOfView 8 | { 9 | public interface IVisibilityMap 10 | { 11 | bool IsOpaque(int2 p); 12 | bool IsInBounds(int2 p); 13 | void SetVisible(int2 p); 14 | float Distance(int2 a, int2 b); 15 | } 16 | } -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/FieldOfView/IVisibilityMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ef930fa06ad8814aa7f840aa7dc3ab5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/RenderUtility.cs: -------------------------------------------------------------------------------- 1 | using Sark.RenderUtils; 2 | using Sark.Terminals; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using Unity.Mathematics; 6 | using UnityEngine; 7 | 8 | namespace RLTK 9 | { 10 | public static class RenderUtility 11 | { 12 | static Material _defaultMat; 13 | static Material DefaultMat 14 | { 15 | get 16 | { 17 | if(_defaultMat == null) 18 | { 19 | _defaultMat = Resources.Load("Terminal8x8"); 20 | } 21 | return _defaultMat; 22 | } 23 | } 24 | 25 | public static void AdjustCameraToTerminal(SimpleTerminal term) 26 | { 27 | var cam = Object.FindObjectOfType(); 28 | if(cam == null) 29 | { 30 | var mainCam = Camera.main; 31 | cam = mainCam.gameObject.AddComponent(); 32 | } 33 | cam.TileSize = new int2(8, 8); 34 | cam.TileCount = term.Size; 35 | } 36 | 37 | public static void RenderTerminal(SimpleTerminal term, float3 pos = default) 38 | { 39 | var mat = DefaultMat; 40 | var matrix = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one); 41 | Graphics.DrawMesh(term.Mesh, matrix, mat, 0); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/RenderUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ab6c78c84d451345b075da8a70b1c4c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04d0252b07cdcc349b5b89378e644f0b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/BasicPathingMap.cs: -------------------------------------------------------------------------------- 1 | using Sark.Common.GridUtil; 2 | using Sark.Pathfinding; 3 | using System; 4 | 5 | using Unity.Collections; 6 | using Unity.Mathematics; 7 | 8 | namespace Sark.RLTK.Samples 9 | { 10 | public struct BasicPathingMap : IPathingMap, IDisposable 11 | { 12 | int2 _size; 13 | NativeArray _points; 14 | 15 | public int2 Size => _size; 16 | public int Width => _size.x; 17 | public int Height => _size.y; 18 | 19 | public NativeArray Points => _points; 20 | 21 | public int Length => _points.Length; 22 | 23 | public BasicPathingMap(int w, int h, Allocator allocator) 24 | { 25 | _size = new int2(w, h); 26 | _points = new NativeArray(w * h, allocator); 27 | } 28 | 29 | public bool this[int i] => _points[i]; 30 | 31 | public void Clear() 32 | { 33 | for (int i = 0; i < _points.Length; ++i) 34 | _points[i] = false; 35 | } 36 | 37 | public bool IsObstacle(int2 p) 38 | { 39 | int i = PosToIndex(p); 40 | return _points[i]; 41 | } 42 | 43 | public void SetIsObstacle(int x, int y, bool b) => 44 | SetIsObstacle(new int2(x, y), b); 45 | 46 | public void SetIsObstacle(int2 p, bool b) 47 | { 48 | int i = PosToIndex(p); 49 | _points[i] = b; 50 | } 51 | 52 | public bool IsInBounds(int2 p) => 53 | Grid2D.InBounds(p, _size); 54 | 55 | int PosToIndex(int2 p) => Grid2D.PosToIndex(p, _size.x); 56 | int2 IndexToPos(int i) => Grid2D.IndexToPos(i, _size.x); 57 | 58 | public void GetAvailableExits(int posIndex, NativeList output) 59 | { 60 | int2 p = IndexToPos(posIndex); 61 | foreach (var d in Grid2D.Directions4Way) 62 | { 63 | int2 adj = p + d; 64 | if (!Grid2D.InBounds(adj, _size)) 65 | continue; 66 | 67 | if (!IsObstacle(adj)) 68 | output.Add(PosToIndex(adj)); 69 | } 70 | } 71 | 72 | public int GetCost(int a, int b) 73 | { 74 | return 1; 75 | } 76 | 77 | public float GetDistance(int a, int b) 78 | { 79 | int2 pa = Grid2D.IndexToPos(a, _size.x); 80 | int2 pb = Grid2D.IndexToPos(b, _size.x); 81 | return Grid2D.TaxicabDistance(pa, pb); 82 | } 83 | 84 | public void Dispose() 85 | { 86 | _points.Dispose(); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/BasicPathingMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69016d75fa06225439ff6aaa2dcfbf7f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/CameraToTerminalSize.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | using Sark.RenderUtils; 7 | using Sark.Terminals; 8 | 9 | [ExecuteAlways] 10 | [RequireComponent(typeof(TiledCamera))] 11 | public class CameraToTerminalSize : MonoBehaviour 12 | { 13 | [SerializeField] 14 | [HideInInspector] 15 | TiledCamera _cam; 16 | 17 | [SerializeField] 18 | TerminalBehaviour _terminal; 19 | 20 | private void OnEnable() 21 | { 22 | if (_cam == null) 23 | _cam = GetComponent(); 24 | 25 | if(_terminal == null) 26 | { 27 | if (_terminal == null) 28 | _terminal = FindObjectOfType(); 29 | } 30 | } 31 | 32 | #if UNITY_EDITOR 33 | void Update() 34 | { 35 | UpdateCamera(); 36 | } 37 | #endif 38 | 39 | void UpdateCamera() 40 | { 41 | if(_cam != null && _terminal != null) 42 | _cam.TileCount = _terminal.Size; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/CameraToTerminalSize.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b305c86061594348bc10e9cf6e9ac00 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/Controls.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 271d1bf328f1d9a4187c78dfe6456c4a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/Controls.inputactions: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Controls", 3 | "maps": [ 4 | { 5 | "name": "Default", 6 | "id": "0102dbf5-6879-45c3-bfa2-a91859414c8e", 7 | "actions": [ 8 | { 9 | "name": "MiddleMouse", 10 | "type": "Button", 11 | "id": "5abff5ba-b505-4772-b4b2-10aebb317ce5", 12 | "expectedControlType": "Button", 13 | "processors": "", 14 | "interactions": "" 15 | }, 16 | { 17 | "name": "RightMouse", 18 | "type": "Button", 19 | "id": "6018f984-4f08-4eff-b9f4-0c998a98c4ea", 20 | "expectedControlType": "Button", 21 | "processors": "", 22 | "interactions": "" 23 | }, 24 | { 25 | "name": "LMBDrag", 26 | "type": "Button", 27 | "id": "e1c47db8-6582-4fba-949e-214ef33aa7fd", 28 | "expectedControlType": "Button", 29 | "processors": "", 30 | "interactions": "Hold(duration=0.05)" 31 | }, 32 | { 33 | "name": "TogglePathfinding", 34 | "type": "Button", 35 | "id": "6970e37a-e244-4130-954d-d48f692b06a6", 36 | "expectedControlType": "Button", 37 | "processors": "", 38 | "interactions": "Hold(duration=0.05)" 39 | }, 40 | { 41 | "name": "ResizeMap", 42 | "type": "Value", 43 | "id": "b0256bed-5a07-4208-8c1f-f34fe1d6e05f", 44 | "expectedControlType": "Vector2", 45 | "processors": "", 46 | "interactions": "" 47 | }, 48 | { 49 | "name": "FindPath", 50 | "type": "Button", 51 | "id": "3521da9c-d5f2-4c86-a35b-6540de5680f5", 52 | "expectedControlType": "Button", 53 | "processors": "", 54 | "interactions": "" 55 | }, 56 | { 57 | "name": "AddNoise", 58 | "type": "Button", 59 | "id": "6632bb68-b546-4b3c-930f-80a5436bc3a1", 60 | "expectedControlType": "Button", 61 | "processors": "", 62 | "interactions": "" 63 | }, 64 | { 65 | "name": "ToggleControls", 66 | "type": "Button", 67 | "id": "189b6eb0-7b8e-4ff8-b9f5-a6b6f41598b0", 68 | "expectedControlType": "Button", 69 | "processors": "", 70 | "interactions": "" 71 | }, 72 | { 73 | "name": "Clear", 74 | "type": "Button", 75 | "id": "0fe068d4-abdb-49b5-8a36-a33fe124f3fe", 76 | "expectedControlType": "Button", 77 | "processors": "", 78 | "interactions": "" 79 | }, 80 | { 81 | "name": "Quit", 82 | "type": "Button", 83 | "id": "f7d297c7-6945-45b5-b374-4af00a6d9467", 84 | "expectedControlType": "Button", 85 | "processors": "", 86 | "interactions": "" 87 | } 88 | ], 89 | "bindings": [ 90 | { 91 | "name": "", 92 | "id": "975357c5-599c-426b-a030-8252055580ec", 93 | "path": "/middleButton", 94 | "interactions": "", 95 | "processors": "", 96 | "groups": "Default", 97 | "action": "MiddleMouse", 98 | "isComposite": false, 99 | "isPartOfComposite": false 100 | }, 101 | { 102 | "name": "", 103 | "id": "09027c7d-10e2-4317-91d2-1273854e0049", 104 | "path": "/rightButton", 105 | "interactions": "", 106 | "processors": "", 107 | "groups": "Default", 108 | "action": "RightMouse", 109 | "isComposite": false, 110 | "isPartOfComposite": false 111 | }, 112 | { 113 | "name": "", 114 | "id": "43c5ff83-cd68-4f4a-b30e-5849068a5379", 115 | "path": "/leftButton", 116 | "interactions": "", 117 | "processors": "", 118 | "groups": "Default", 119 | "action": "LMBDrag", 120 | "isComposite": false, 121 | "isPartOfComposite": false 122 | }, 123 | { 124 | "name": "", 125 | "id": "1abc5f4d-fa7e-4e8b-9349-b1d478cb0736", 126 | "path": "/r", 127 | "interactions": "", 128 | "processors": "", 129 | "groups": "", 130 | "action": "TogglePathfinding", 131 | "isComposite": false, 132 | "isPartOfComposite": false 133 | }, 134 | { 135 | "name": "Arrows", 136 | "id": "31c35802-b385-4607-a98f-2d85a5ac8a73", 137 | "path": "2DVector", 138 | "interactions": "", 139 | "processors": "", 140 | "groups": "", 141 | "action": "ResizeMap", 142 | "isComposite": true, 143 | "isPartOfComposite": false 144 | }, 145 | { 146 | "name": "up", 147 | "id": "af419c4e-0f0e-4178-b447-d1ea96b30a08", 148 | "path": "/upArrow", 149 | "interactions": "", 150 | "processors": "", 151 | "groups": "", 152 | "action": "ResizeMap", 153 | "isComposite": false, 154 | "isPartOfComposite": true 155 | }, 156 | { 157 | "name": "down", 158 | "id": "d8386b47-10ae-4d2f-9ab5-f05d2face08a", 159 | "path": "/downArrow", 160 | "interactions": "", 161 | "processors": "", 162 | "groups": "", 163 | "action": "ResizeMap", 164 | "isComposite": false, 165 | "isPartOfComposite": true 166 | }, 167 | { 168 | "name": "left", 169 | "id": "9d2d423c-d557-470a-8f24-1ddc26b78a34", 170 | "path": "/leftArrow", 171 | "interactions": "", 172 | "processors": "", 173 | "groups": "", 174 | "action": "ResizeMap", 175 | "isComposite": false, 176 | "isPartOfComposite": true 177 | }, 178 | { 179 | "name": "right", 180 | "id": "89c065f5-1ce2-4481-b361-1532e597d53d", 181 | "path": "/rightArrow", 182 | "interactions": "", 183 | "processors": "", 184 | "groups": "", 185 | "action": "ResizeMap", 186 | "isComposite": false, 187 | "isPartOfComposite": true 188 | }, 189 | { 190 | "name": "", 191 | "id": "c90344ee-35fa-4cca-b74b-08a25ecb18be", 192 | "path": "/space", 193 | "interactions": "", 194 | "processors": "", 195 | "groups": "", 196 | "action": "FindPath", 197 | "isComposite": false, 198 | "isPartOfComposite": false 199 | }, 200 | { 201 | "name": "", 202 | "id": "7434e69a-6c67-4ba6-81ca-b219fb00b199", 203 | "path": "/n", 204 | "interactions": "", 205 | "processors": "", 206 | "groups": "", 207 | "action": "AddNoise", 208 | "isComposite": false, 209 | "isPartOfComposite": false 210 | }, 211 | { 212 | "name": "", 213 | "id": "f03dcd4f-0ebb-474f-9cc2-3313fe2760ff", 214 | "path": "/f1", 215 | "interactions": "", 216 | "processors": "", 217 | "groups": "", 218 | "action": "ToggleControls", 219 | "isComposite": false, 220 | "isPartOfComposite": false 221 | }, 222 | { 223 | "name": "", 224 | "id": "e9174edb-3cb7-4b1e-bbe0-2f273beb7c56", 225 | "path": "/c", 226 | "interactions": "", 227 | "processors": "", 228 | "groups": "", 229 | "action": "Clear", 230 | "isComposite": false, 231 | "isPartOfComposite": false 232 | }, 233 | { 234 | "name": "", 235 | "id": "1c0be3ae-5cd4-4da5-8e25-b09e035e7f8d", 236 | "path": "/escape", 237 | "interactions": "", 238 | "processors": "", 239 | "groups": "", 240 | "action": "Quit", 241 | "isComposite": false, 242 | "isPartOfComposite": false 243 | } 244 | ] 245 | } 246 | ], 247 | "controlSchemes": [ 248 | { 249 | "name": "Default", 250 | "bindingGroup": "Default", 251 | "devices": [] 252 | } 253 | ] 254 | } -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/Controls.inputactions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a5c8d06a7b86b041a8096671fadf1b0 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} 11 | generateWrapperCode: 1 12 | wrapperCodePath: 13 | wrapperClassName: 14 | wrapperCodeNamespace: 15 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/ControlsTerminal.cs: -------------------------------------------------------------------------------- 1 | 2 | using System.Collections; 3 | using UnityEngine; 4 | 5 | using Sark.Common.CameraExtensions; 6 | using Unity.Mathematics; 7 | using Sark.Terminals; 8 | using UnityEngine.InputSystem; 9 | using System.Collections.Generic; 10 | 11 | namespace Sark.RLTK.Samples 12 | { 13 | public class ControlsTerminal : MonoBehaviour 14 | { 15 | [SerializeField] 16 | TerminalBehaviour _parent = null; 17 | TerminalBehaviour _term; 18 | int2 _lastSize; 19 | 20 | Controls _controls; 21 | 22 | string _displayText = null; 23 | float avg = 0F; //declare this variable outside Update 24 | //run this in Update() 25 | 26 | [SerializeField] 27 | List _strings = new List(); 28 | 29 | private void Awake() 30 | { 31 | _term = GetComponent(); 32 | } 33 | 34 | private void OnEnable() 35 | { 36 | if (_parent == null) 37 | Debug.LogError("Error enabling controls terminal - set a parent in the inspector"); 38 | 39 | _controls = new Controls(); 40 | _controls.Enable(); 41 | 42 | _controls.Default.ToggleControls.performed += ToggleVisibility; 43 | } 44 | 45 | public void SetDisplayText(string str) 46 | { 47 | _displayText = str; 48 | Print(); 49 | } 50 | 51 | // Start is called before the first frame update 52 | IEnumerator Start() 53 | { 54 | yield return null; 55 | yield return null; 56 | yield return null; 57 | Print(); 58 | Align(); 59 | } 60 | 61 | private void LateUpdate() 62 | { 63 | avg += ((Time.deltaTime / Time.timeScale) - avg) * 0.03f; //run this every frame 64 | if (!_parent.Size.Equals(_lastSize)) 65 | { 66 | _lastSize = _parent.Size; 67 | Align(); 68 | } 69 | 70 | if (Keyboard.current.vKey.wasPressedThisFrame) 71 | QualitySettings.vSyncCount = (QualitySettings.vSyncCount + 1) % 3; 72 | 73 | Print(); 74 | } 75 | 76 | void Print() 77 | { 78 | string vsync = QualitySettings.vSyncCount switch 79 | { 80 | 1 => "60", 81 | 2 => "30", 82 | _ => "OFF" 83 | }; 84 | 85 | _term.Resize(_term.Width, _strings.Count + 3); 86 | Align(); 87 | int y = _term.Size.y - 1; 88 | for(int i = 0; i < _strings.Count; ++i) 89 | { 90 | _term.Print(2, y--, _strings[i]); 91 | } 92 | 93 | _term.Print(2, y--, $"VSync {vsync} FPS {1F / avg} "); 94 | --y; 95 | if (!string.IsNullOrEmpty(_displayText)) 96 | _term.Print(1, y--, _displayText + " "); 97 | 98 | //_term.Print(1, y--, "CONTROLS"); 99 | //_term.Print(1, y--, "F1 - Toggle help"); 100 | //_term.Print(1, y--, "LMB + Drag - Place/Remove walls"); 101 | //_term.Print(1, y--, "N - Add noise to the map"); 102 | //_term.Print(1, y--, "C - Clear"); 103 | //_term.Print(1, y--, "Arrow Keys - Resize"); 104 | //_term.Print(1, y--, "RMB - place start/end points"); 105 | //_term.Print(1, y--, "Space - Find Path"); 106 | //_term.Print(1, y--, $"VSync {vsync} FPS {1F / avg} "); 107 | //--y; 108 | //if (!string.IsNullOrEmpty(_displayText)) 109 | // _term.Print(1, y--, _displayText + " "); 110 | } 111 | 112 | 113 | void Align() 114 | { 115 | float3 p = transform.position; 116 | float2 viewportPosition = new float2(0, 1); 117 | float2 align = new float2(1, -1); 118 | float2 size = _term.GetWorldSize().xy; 119 | p.xy = Camera.main.GetAlignedViewportPosition(viewportPosition, align, size).xy; 120 | transform.position = p; 121 | } 122 | 123 | void ToggleVisibility(InputAction.CallbackContext ctx) 124 | { 125 | float3 p = transform.position; 126 | if (p.z == -1) 127 | p.z = 1; 128 | else 129 | p.z = -1; 130 | 131 | transform.position = p; 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/ControlsTerminal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 177d2ebd85e3959498ac6907fc43d25a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/DraggingControls.cs: -------------------------------------------------------------------------------- 1 | using Sark.Terminals; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using UnityEngine.InputSystem; 7 | 8 | public class DraggingControls : MonoBehaviour 9 | { 10 | TerminalBehaviour _term; 11 | 12 | Controls _controls; 13 | InputAction _lmbDrag; 14 | 15 | bool _dragging = false; 16 | HashSet _draggedPoints = new HashSet(); 17 | 18 | public System.Action OnPointDragged; 19 | public System.Action OnDragStarted; 20 | public System.Action> OnDragEnded; 21 | 22 | private void OnEnable() 23 | { 24 | _controls = new Controls(); 25 | _controls.Enable(); 26 | 27 | _lmbDrag = _controls.Default.LMBDrag; 28 | _lmbDrag.performed += OnDragBegin; 29 | _lmbDrag.canceled += OnDragEnd; 30 | 31 | _term = GetComponent(); 32 | } 33 | 34 | void OnDragBegin(InputAction.CallbackContext ctx) 35 | { 36 | var p = GetMouseConsolePosition(); 37 | if (!_term.IsInBounds(p)) 38 | return; 39 | 40 | OnDragStarted?.Invoke(p); 41 | //_draggedPoints.Add(p); 42 | _dragging = true; 43 | } 44 | 45 | void OnDragEnd(InputAction.CallbackContext ctx) 46 | { 47 | _dragging = false; 48 | 49 | OnDragEnded?.Invoke(_draggedPoints); 50 | 51 | _draggedPoints.Clear(); 52 | } 53 | 54 | void OnDrag() 55 | { 56 | int2 p = GetMouseConsolePosition(); 57 | 58 | if(!_term.IsInBounds(p) || _draggedPoints.Contains(p)) 59 | return; 60 | 61 | _draggedPoints.Add(p); 62 | OnPointDragged?.Invoke(p); 63 | } 64 | 65 | int2 GetMouseConsolePosition() 66 | { 67 | float2 mouseXY = Mouse.current.position.ReadValue(); 68 | float3 mousePos = new float3(mouseXY, transform.position.z); 69 | 70 | float3 worldPos = Camera.main.ScreenToWorldPoint(mousePos); 71 | int2 tileIndex = _term.WorldPosToTileIndex(worldPos); 72 | return tileIndex; 73 | } 74 | 75 | private void Update() 76 | { 77 | if (_dragging) 78 | OnDrag(); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/DraggingControls.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13a61fa6cc1527f46971e061a5700c5e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/InteractiveTerminal.cs: -------------------------------------------------------------------------------- 1 | using Sark.RenderUtils; 2 | using Sark.Terminals; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using Unity.Burst; 6 | using Unity.Collections; 7 | using Unity.Jobs; 8 | using Unity.Mathematics; 9 | using UnityEngine; 10 | using UnityEngine.InputSystem; 11 | 12 | using static Sark.Terminals.CodePage437; 13 | 14 | namespace Sark.RLTK.Samples 15 | { 16 | public class InteractiveTerminal : MonoBehaviour 17 | { 18 | [SerializeField] 19 | int2 _size = new int2(80, 40); 20 | 21 | bool _dirty = false; 22 | 23 | protected BasicPathingMap _map; 24 | protected TerminalBehaviour _term; 25 | 26 | protected Controls _controls; 27 | 28 | InputAction _addNoise; 29 | InputAction _resize; 30 | InputAction _clear; 31 | 32 | DraggingControls _drag; 33 | MapNoise _noise = new MapNoise(); 34 | 35 | bool _addingWalls = false; 36 | bool _resizing = false; 37 | 38 | public BasicPathingMap GetMap() => _map; 39 | 40 | protected virtual void OnEnable() 41 | { 42 | _term = GetComponent(); 43 | _drag = GetComponent(); 44 | _drag.OnPointDragged += OnPointDragged; 45 | _drag.OnDragEnded += OnDragEnded; 46 | _drag.OnDragStarted += OnDragStarted; 47 | 48 | _controls = new Controls(); 49 | _controls.Enable(); 50 | 51 | _addNoise = _controls.Default.AddNoise; 52 | _resize = _controls.Default.ResizeMap; 53 | _clear = _controls.Default.Clear; 54 | 55 | _map = new BasicPathingMap(_size.x, _size.y, Allocator.Persistent); 56 | } 57 | 58 | protected virtual IEnumerator Start() 59 | { 60 | _term.Resize(_size.x, _size.y); 61 | SetDirty(); 62 | 63 | yield return null; 64 | //Debug.Log($"Resizing terminal to {_size}"); 65 | } 66 | 67 | protected virtual void OnDisable() 68 | { 69 | _drag.OnDragEnded -= OnDragEnded; 70 | _drag.OnPointDragged -= OnPointDragged; 71 | 72 | _map.Dispose(); 73 | } 74 | 75 | void Update() 76 | { 77 | HandleClear(); 78 | HandleResize(); 79 | HandleNoise(); 80 | 81 | BeforeDraw(); 82 | 83 | if (_dirty) 84 | { 85 | _dirty = false; 86 | 87 | DrawTerminal(); 88 | 89 | AfterDraw(); 90 | } 91 | } 92 | 93 | protected void SetDirty() { _dirty = true; } 94 | 95 | protected virtual void BeforeDraw() { } 96 | protected virtual void AfterDraw() { } 97 | protected virtual void OnClear() { } 98 | protected virtual void OnMapChanged(int2 p) { } 99 | protected virtual void OnResized(int2 newSize) { } 100 | 101 | void HandleResize() 102 | { 103 | if (_resize.triggered && !_resizing) 104 | { 105 | _resizing = true; 106 | var vec = _resize.ReadValue(); 107 | 108 | var newSize = _size; 109 | newSize.x += (int)vec.x; 110 | newSize.y += (int)vec.y; 111 | 112 | newSize = math.max(1, newSize); 113 | 114 | if (!_size.Equals(newSize)) 115 | { 116 | FindObjectOfType().TileCount = newSize; 117 | 118 | _size = newSize; 119 | 120 | _map.Dispose(); 121 | _map = new BasicPathingMap(_size.x, _size.y, Allocator.Persistent); 122 | 123 | _term.Resize(_size.x, _size.y); 124 | _dirty = true; 125 | 126 | OnResized(_size); 127 | } 128 | } 129 | else 130 | _resizing = false; 131 | } 132 | 133 | void HandleNoise() 134 | { 135 | if (_addNoise.triggered) 136 | { 137 | DoNoise(); 138 | } 139 | } 140 | 141 | void HandleClear() 142 | { 143 | if (_clear.triggered) 144 | Clear(); 145 | } 146 | 147 | void OnDragStarted(int2 p) 148 | { 149 | _addingWalls = !_map.IsObstacle(p); 150 | } 151 | 152 | void OnPointDragged(int2 p) 153 | { 154 | _map.SetIsObstacle(p, _addingWalls); 155 | OnMapChanged(p); 156 | _dirty = true; 157 | } 158 | 159 | void OnDragEnded(HashSet points) 160 | { 161 | _addingWalls = false; 162 | } 163 | 164 | protected void DoNoise() 165 | { 166 | Clear(); 167 | SetDirty(); 168 | _noise.AddNoiseToMap(_map); 169 | } 170 | 171 | [BurstCompile] 172 | struct RebuildConsoleFromMapJob : IJob 173 | { 174 | public TileData Tiles; 175 | public NativeArray Map; 176 | public void Execute() 177 | { 178 | for (int i = 0; i < Map.Length; ++i) 179 | { 180 | var t = Tiles[i]; 181 | t.glyph = Map[i] ? ToCP437('#') : ToCP437(' '); 182 | t.fgColor = Color.white; 183 | t.bgColor = Color.black; 184 | Tiles[i] = t; 185 | } 186 | } 187 | } 188 | 189 | void Clear() 190 | { 191 | _map.Clear(); 192 | OnClear(); 193 | } 194 | 195 | void DrawTerminal() 196 | { 197 | _term.SetDirty(); 198 | 199 | //Debug.Log($"Drawing Terminal. MapSize {_map.Size}. TermSize {_term.Size}. TilesSize {_term.Tiles.Size}"); 200 | 201 | new RebuildConsoleFromMapJob 202 | { 203 | Tiles = _term.Tiles, 204 | Map = _map.Points 205 | }.Run(); 206 | } 207 | 208 | protected int2 GetMouseConsolePosition() 209 | { 210 | float2 mouseXY = Mouse.current.position.ReadValue(); 211 | float3 mousePos = new float3(mouseXY, transform.position.z); 212 | 213 | float3 worldPos = Camera.main.ScreenToWorldPoint(mousePos); 214 | int2 tileIndex = _term.WorldPosToTileIndex(worldPos); 215 | return tileIndex; 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/InteractiveTerminal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79252bd6c8d4e9544a9a73f433db384f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/MapNoise.cs: -------------------------------------------------------------------------------- 1 | using Sark.Common.GridUtil; 2 | 3 | using Unity.Burst; 4 | using Unity.Jobs; 5 | using Unity.Mathematics; 6 | 7 | using Random = Unity.Mathematics.Random; 8 | 9 | namespace Sark.RLTK.Samples 10 | { 11 | public class MapNoise 12 | { 13 | public void AddNoiseToMap(BasicPathingMap map) 14 | { 15 | Random rand = new Random((uint)UnityEngine.Random.Range(1, int.MaxValue)); 16 | 17 | int iters = rand.NextInt(1, 16); 18 | float per = rand.NextFloat(0.15f, 0.75f); 19 | float scale = rand.NextFloat(0.01f, .2f); 20 | int low = rand.NextInt(0, 10); 21 | int high = rand.NextInt(low + 5, low + 15); 22 | int thresh = rand.NextInt(low, high); 23 | 24 | new NoiseJob 25 | { 26 | Iterations = iters, 27 | Persistence = per, 28 | Scale = scale, 29 | Low = low, 30 | High = high, 31 | Threshold = thresh, 32 | Map = map 33 | }.Run(); 34 | } 35 | 36 | [BurstCompile] 37 | struct NoiseJob : IJob 38 | { 39 | public BasicPathingMap Map; 40 | public int Iterations; 41 | public float Persistence; 42 | public float Scale; 43 | public int Low; 44 | public int High; 45 | public int Threshold; 46 | 47 | public void Execute() 48 | { 49 | for (int i = 0; i < Map.Length; ++i) 50 | { 51 | int2 p = Grid2D.IndexToPos(i, Map.Size.x); 52 | float noise = SumOctave(p.x, p.y, 53 | Iterations, Persistence, Scale, Low, High); 54 | if (noise >= Threshold) 55 | { 56 | Map.SetIsObstacle(p.x, p.y, true); 57 | } 58 | } 59 | } 60 | } 61 | 62 | static float SumOctave( 63 | int x, int y, 64 | int iterations, float persistence, float scale, 65 | int low, int high) 66 | { 67 | float maxAmp = 0; 68 | float amp = 1; 69 | float freq = scale; 70 | float v = 0; 71 | 72 | for (int i = 0; i < iterations; ++i) 73 | { 74 | v += noise.snoise(new float2(x * freq, y * freq)) * amp; 75 | maxAmp += amp; 76 | amp *= persistence; 77 | freq *= 2; 78 | } 79 | 80 | v /= maxAmp; 81 | 82 | v = v * (high - low) / 2f + (high + low) / 2f; 83 | 84 | return v; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/SampleScripts/MapNoise.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cebb79f3fbabdd841b0a4f4bd35215dc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Sark.RLTK.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sark.RLTK.Runtime", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:df380645f10b7bc4b97d4f5eb6303d95", 6 | "GUID:15fc0a57446b3144c949da3e2b9737a9", 7 | "GUID:d8b63aba1907145bea998dd612889d6b", 8 | "GUID:2665a8d13d1b3f18800f46e256720795", 9 | "GUID:e0cd26848372d4e5c891c569017e11f1", 10 | "GUID:8a2eafa29b15f444eb6d74f94a930e1d", 11 | "GUID:c51471e3aa1693642b24763147328a2e", 12 | "GUID:95d094c764f5f734489a95a337660cb3", 13 | "GUID:b8c9c7241ae5ebe40a9be59499692c24", 14 | "GUID:ee83c71eeb028bc488a0d56ff3deada8", 15 | "GUID:75469ad4d38634e559750d17036d5f7c" 16 | ], 17 | "includePlatforms": [], 18 | "excludePlatforms": [], 19 | "allowUnsafeCode": true, 20 | "overrideReferences": false, 21 | "precompiledReferences": [], 22 | "autoReferenced": true, 23 | "defineConstraints": [], 24 | "versionDefines": [], 25 | "noEngineReferences": false 26 | } -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Sark.RLTK.Runtime.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44b930416f788d0449e9dce56820cadb 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/Authoring.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 623bd7b1808930748921e68cfa66572e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/Authoring/ConsoleAuthoring.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Entities; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | 7 | namespace RLTK.Scrapped 8 | { 9 | 10 | struct SimpleConsoleData : IComponentData 11 | { 12 | public int Width; 13 | public int Height; 14 | } 15 | 16 | // A hybrid component to let us tweak console parameters from inside the editor. 17 | // A component system can query for this to build a console for the ECS world. 18 | 19 | // This doesn't work so well. The hybrid renderer uses shared component data on renderers and sets those 20 | // SCD values based on material and mesh. So for a procedural mesh that would mean it has to move chunks 21 | // every time we change something in it. For now it makes more sense to use other rendering options. 22 | [RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] 23 | [RequiresEntityConversion] 24 | public class ConsoleAuthoring : MonoBehaviour, IConvertGameObjectToEntity 25 | { 26 | public int Width = 16; 27 | public int Height = 16; 28 | public ConsoleBackendType Backend = ConsoleBackendType.SimpleMesh; 29 | 30 | Entity _entity; 31 | 32 | void Awake() 33 | { 34 | // If our mesh and material aren't initialized before conversion the 35 | // conversion will fail. 36 | GetComponent().sharedMesh = new Mesh(); 37 | var renderer = GetComponent(); 38 | if (renderer.sharedMaterial == null) 39 | renderer.sharedMaterial = new Material(Shader.Find("Custom/GlyphShader")); 40 | } 41 | 42 | 43 | public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) 44 | { 45 | 46 | dstManager.AddComponentData(entity, new SimpleConsoleData 47 | { 48 | Width = Width, 49 | Height = Height, 50 | }); 51 | 52 | _entity = entity; 53 | } 54 | 55 | #if UNITY_EDITOR 56 | private void OnValidate() 57 | { 58 | Width = math.max(1, Width); 59 | Height = math.max(1, Height); 60 | } 61 | #endif 62 | 63 | public enum ConsoleBackendType 64 | { 65 | SimpleMesh, 66 | }; 67 | } 68 | } -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/Authoring/ConsoleAuthoring.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2da8f6bc8760f0b4dab404a26a99bf22 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/RuntimeTests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9ad3f6ab5956dd4897e03d4bb1df0c6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/RuntimeTests/SimpleConsoleSystem.cs: -------------------------------------------------------------------------------- 1 | using RLTK; 2 | using RLTK.Consoles; 3 | using RLTK.Consoles.Backend; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using Unity.Collections; 7 | using Unity.Entities; 8 | using Unity.Jobs; 9 | using UnityEngine; 10 | namespace RLTK.Scrapped 11 | { 12 | 13 | // Scrapped for now. RenderMesh is not an appropriate system for 14 | // procedural meshes. The console mesh must exist in a builtin renderer. 15 | // or using Graphics.Draw*. 16 | [DisableAutoCreation] 17 | [AlwaysSynchronizeSystem] 18 | public class SimpleConsoleSystem : JobComponentSystem 19 | { 20 | SimpleConsole _console; 21 | 22 | struct ConsoleInitialized : IComponentData { } 23 | 24 | protected override void OnCreate() 25 | { 26 | //var authoringData = Object.FindObjectOfType(); 27 | 28 | //if( authoringData != null ) 29 | // InitConsole(authoringData); 30 | } 31 | 32 | void InitConsole(SimpleConsoleData data, Mesh mesh) 33 | { 34 | 35 | IConsoleBackend backend = null; 36 | 37 | int w = data.Width; 38 | int h = data.Height; 39 | 40 | backend = new SimpleMeshBackend(w, h, mesh); 41 | 42 | 43 | //switch(data.Backend) 44 | //{ 45 | // default: 46 | // backend = new SimpleMeshBackend(w, h, filter.sharedMesh); 47 | // break; 48 | //} 49 | 50 | _console = new SimpleConsole( 51 | w, 52 | h, 53 | backend, 54 | Allocator.Persistent); 55 | } 56 | 57 | protected override void OnDestroy() 58 | { 59 | _console?.Dispose(); 60 | } 61 | 62 | protected override JobHandle OnUpdate(JobHandle inputDeps) 63 | { 64 | //Entities 65 | // .WithoutBurst() 66 | // .WithNone() 67 | // .WithStructuralChanges() 68 | // .ForEach((Entity e, in SimpleConsoleData data, in RenderMesh renderMesh) => 69 | // { 70 | // EntityManager.AddComponent(e); 71 | 72 | // InitConsole(data, renderMesh.mesh); 73 | // }).Run(); 74 | 75 | return default; 76 | } 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/RuntimeTests/SimpleConsoleSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7d5e31a04fb6ed42b2472f79a7a4210 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/RuntimeTests/TestData.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 534a05e90777c0442b8c34011a5a2c8a, type: 3} 13 | m_Name: TestData 14 | m_EditorClassIdentifier: 15 | _meshFilter: {fileID: 0} 16 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Runtime/Scrapped~/RuntimeTests/TestData.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 045c20c24cddf2e4c96d0d752a0b4930 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85acf40a6dbee9842a1af7fa24277cf0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/FOVDemo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29465a8a2ce267041a8ed23b84fa7899 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/FOVDemo/FOVDemo.cs: -------------------------------------------------------------------------------- 1 | using RLTK.FieldOfView; 2 | using RLTK.FieldOfView.BeveledCorners; 3 | using Sark.Common.GridUtil; 4 | using Sark.RLTK.Samples; 5 | using Sark.Terminals; 6 | using Sark.Terminals.TerminalExtensions; 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using Unity.Burst; 10 | using Unity.Collections; 11 | using Unity.Jobs; 12 | using Unity.Mathematics; 13 | using UnityEngine; 14 | using UnityEngine.InputSystem; 15 | 16 | namespace Sark.RLTK.Samples 17 | { 18 | public class FOVDemo : InteractiveTerminal 19 | { 20 | VisibilityMap _visibility; 21 | 22 | bool _visibilityMapOn = false; 23 | 24 | [SerializeField] 25 | int _range = 8; 26 | 27 | bool _scrolling = false; 28 | 29 | protected override IEnumerator Start() 30 | { 31 | base.Start(); 32 | 33 | yield return null; 34 | 35 | DoNoise(); 36 | } 37 | 38 | protected override void OnEnable() 39 | { 40 | base.OnEnable(); 41 | 42 | _visibility = new VisibilityMap(_map.Width, _map.Height, _map, Allocator.Persistent); 43 | } 44 | 45 | protected override void OnDisable() 46 | { 47 | base.OnDisable(); 48 | 49 | _visibility.Dispose(); 50 | } 51 | 52 | protected override void BeforeDraw() 53 | { 54 | base.BeforeDraw(); 55 | 56 | float2 scroll = Mouse.current.scroll.ReadValue(); 57 | if (scroll.y != 0 && !_scrolling) 58 | { 59 | _scrolling = true; 60 | _range += (int)math.sign(scroll.y); 61 | } 62 | else 63 | _scrolling = false; 64 | 65 | if (Keyboard.current.spaceKey.wasPressedThisFrame) 66 | { 67 | _visibilityMapOn = !_visibilityMapOn; 68 | SetDirty(); 69 | } 70 | 71 | var p = GetMouseConsolePosition(); 72 | if (!_term.IsInBounds(p)) 73 | return; 74 | 75 | if(_visibilityMapOn) 76 | { 77 | _visibility.Clear(); 78 | new FOVJob 79 | { 80 | Map = _visibility, 81 | Origin = p, 82 | Range = _range 83 | }.Run(); 84 | 85 | SetDirty(); 86 | } 87 | } 88 | 89 | protected override void AfterDraw() 90 | { 91 | base.AfterDraw(); 92 | 93 | if (!_visibilityMapOn) 94 | return; 95 | 96 | _term.ClearScreen(); 97 | var tiles = _term.Tiles; 98 | 99 | new DrawMapJob 100 | { 101 | Visibility = _visibility, 102 | Tiles = tiles 103 | }.Run(); 104 | 105 | _term.SetDirty(); 106 | _term.ImmediateUpdate(); 107 | } 108 | protected override void OnResized(int2 newSize) 109 | { 110 | _visibility.Dispose(); 111 | _visibility = new VisibilityMap(_map.Width, _map.Height, _map, Allocator.Persistent); 112 | } 113 | } 114 | 115 | [BurstCompile] 116 | struct DrawMapJob : IJob 117 | { 118 | public VisibilityMap Visibility; 119 | public TileData Tiles; 120 | public void Execute() 121 | { 122 | for (int i = 0; i < Visibility.Length; ++i) 123 | { 124 | int2 p = Grid2D.IndexToPos(i, Visibility.Width); 125 | if (Visibility[i]) 126 | { 127 | if (Visibility.IsOpaque(p)) 128 | Tiles.Set(p.x, p.y, '#'); 129 | else 130 | Tiles.Set(p.x, p.y, '.'); 131 | } 132 | } 133 | } 134 | } 135 | 136 | [BurstCompile] 137 | struct FOVJob : IJob 138 | { 139 | public VisibilityMap Map; 140 | public int Range; 141 | public int2 Origin; 142 | 143 | public void Execute() 144 | { 145 | FOV.Compute(Origin, Range, Map); 146 | } 147 | } 148 | 149 | struct VisibilityMap : IVisibilityMap 150 | { 151 | BasicPathingMap opaque; 152 | NativeArray visible; 153 | int2 size; 154 | 155 | public int Width => size.x; 156 | public int Height => size.y; 157 | public int Length => visible.Length; 158 | 159 | public VisibilityMap(int w, int h, BasicPathingMap obstacleMap, Allocator allocator) 160 | { 161 | size = new int2(w, h); 162 | visible = new NativeArray(w * h, allocator); 163 | opaque = obstacleMap; 164 | } 165 | 166 | public bool this[int i] => visible[i]; 167 | 168 | public int PosToIndex(int2 p) => 169 | Grid2D.PosToIndex(p, Width); 170 | 171 | public bool IsInBounds(int2 p) => 172 | Grid2D.InBounds(p, size); 173 | 174 | public float Distance(int2 a, int2 b) 175 | { 176 | return math.distance(a, b); 177 | } 178 | 179 | public bool IsOpaque(int2 p) 180 | { 181 | if (!IsInBounds(p)) 182 | return true; 183 | return opaque.IsObstacle(p); 184 | } 185 | 186 | public void SetVisible(int2 p) 187 | { 188 | if (!IsInBounds(p)) 189 | return; 190 | visible[PosToIndex(p)] = true; 191 | } 192 | 193 | public void Clear() 194 | { 195 | for (int i = 0; i < visible.Length; ++i) 196 | visible[i] = false; 197 | } 198 | 199 | public void Dispose() 200 | { 201 | visible.Dispose(); 202 | } 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/FOVDemo/FOVDemo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c21755c649932214a870532777dfafa1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/FOVDemo/FOVDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a733b93bd5a39bd40ac3360a69982007 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/PathfindingDemo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e774dec1ef10a7c4689d8e0e51c8d3e1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/PathfindingDemo/PathfindingDemo.cs: -------------------------------------------------------------------------------- 1 | using Sark.Common.GridUtil; 2 | using Sark.Pathfinding; 3 | using Sark.Terminals; 4 | using Sark.Terminals.TerminalExtensions; 5 | using System.Diagnostics; 6 | using Unity.Burst; 7 | using Unity.Collections; 8 | using Unity.Jobs; 9 | using Unity.Mathematics; 10 | using UnityEngine; 11 | using UnityEngine.InputSystem; 12 | 13 | namespace Sark.RLTK.Samples 14 | { 15 | public class PathfindingDemo : InteractiveTerminal 16 | { 17 | int2? _start; 18 | int2? _end; 19 | Color _startColor = Color.blue; 20 | Color _endColor = Color.green; 21 | 22 | AStar _aStar; 23 | NativeList _path; 24 | 25 | InputAction _rmb; 26 | InputAction _pathfind; 27 | 28 | ControlsTerminal _controlsTerm; 29 | 30 | bool _firstRun = true; 31 | 32 | protected override void OnEnable() 33 | { 34 | base.OnEnable(); 35 | 36 | _rmb = _controls.Default.RightMouse; 37 | _pathfind = _controls.Default.FindPath; 38 | 39 | _aStar = new AStar(_map.Length, Allocator.Persistent); 40 | _path = new NativeList(_map.Length, Allocator.Persistent); 41 | 42 | _controlsTerm = FindObjectOfType(); 43 | } 44 | 45 | protected override void OnDisable() 46 | { 47 | base.OnDisable(); 48 | _aStar.Dispose(); 49 | _path.Dispose(); 50 | } 51 | 52 | protected override void BeforeDraw() 53 | { 54 | HandleSetStartEnd(); 55 | HandlePathfind(); 56 | } 57 | 58 | protected override void AfterDraw() 59 | { 60 | DrawPath(); 61 | DrawStartEnd(); 62 | } 63 | 64 | protected override void OnClear() 65 | { 66 | ClearStartEnd(); 67 | ClearPath(); 68 | } 69 | 70 | protected override void OnMapChanged(int2 p) 71 | { 72 | ClearPath(); 73 | if (_start != null && _start.Value.Equals(p)) 74 | _start = null; 75 | if (_end != null && _end.Value.Equals(p)) 76 | _end = null; 77 | } 78 | 79 | void HandleSetStartEnd() 80 | { 81 | if (_rmb.triggered) 82 | { 83 | int2 p = GetMouseConsolePosition(); 84 | if (!_map.IsInBounds(p)) 85 | return; 86 | 87 | ClearPath(); 88 | 89 | if (_start == null) 90 | { 91 | _start = p; 92 | _map.SetIsObstacle(p, false); 93 | SetDirty(); 94 | return; 95 | } 96 | 97 | if (_end == null) 98 | { 99 | _end = p; 100 | _map.SetIsObstacle(p, false); 101 | SetDirty(); 102 | return; 103 | } 104 | 105 | ClearStartEnd(); 106 | 107 | SetDirty(); 108 | } 109 | } 110 | 111 | void HandlePathfind() 112 | { 113 | if (_pathfind.triggered && _start != null && _end != null) 114 | { 115 | ClearPath(); 116 | 117 | int start = Grid2D.PosToIndex(_start.Value, _term.Width); 118 | int end = Grid2D.PosToIndex(_end.Value, _term.Width); 119 | 120 | if (_firstRun) 121 | { 122 | FindPath(start, end); 123 | _firstRun = false; 124 | ClearPath(); 125 | } 126 | FindPath(start, end); 127 | 128 | SetDirty(); 129 | } 130 | } 131 | 132 | void FindPath(int start, int end) 133 | { 134 | var sw = new Stopwatch(); 135 | sw.Start(); 136 | new FindPathJob 137 | { 138 | AStar = _aStar, 139 | Map = _map, 140 | Path = _path, 141 | Start = start, 142 | End = end, 143 | }.Run(); 144 | sw.Stop(); 145 | 146 | if (_path.Length > 0) 147 | _controlsTerm.SetDisplayText($"Path took {sw.Elapsed.TotalMilliseconds} ms"); 148 | else 149 | { 150 | _controlsTerm.SetDisplayText($"Couldn't find path!"); 151 | } 152 | } 153 | 154 | void DrawStartEnd() 155 | { 156 | if (_start != null) 157 | { 158 | _term.Set(_start.Value.x, _start.Value.y, _startColor, 'S'); 159 | } 160 | 161 | if (_end != null) 162 | { 163 | _term.Set(_end.Value.x, _end.Value.y, _endColor, 'E'); 164 | } 165 | } 166 | 167 | void DrawPath() 168 | { 169 | if (_end == null || _start == null) 170 | return; 171 | 172 | new DrawPathJob 173 | { 174 | AStar = _aStar, 175 | Tiles = _term.Tiles, 176 | StartColor = _startColor, 177 | EndColor = _endColor, 178 | Path = _path, 179 | }.Run(); 180 | 181 | DrawStartEnd(); 182 | } 183 | 184 | void ClearStartEnd() 185 | { 186 | _start = null; 187 | _end = null; 188 | } 189 | 190 | void ClearPath() 191 | { 192 | _path.Clear(); 193 | _aStar.Clear(); 194 | } 195 | 196 | [BurstCompile] 197 | struct DrawPathJob : IJob 198 | { 199 | public TileData Tiles; 200 | public AStar AStar; 201 | public NativeList Path; 202 | public Color StartColor; 203 | public Color EndColor; 204 | 205 | public void Execute() 206 | { 207 | var visited = AStar.GetVisited(Allocator.Temp); 208 | 209 | for (int i = 0; i < visited.Length; ++i) 210 | { 211 | int2 point = Grid2D.IndexToPos(visited[i], Tiles.Width); 212 | Tiles.Set(point.x, point.y, Color.red, '.'); 213 | } 214 | 215 | for (int i = 0; i < Path.Length; ++i) 216 | { 217 | Color col = Color.Lerp(StartColor, EndColor, (float)i / Path.Length); 218 | int2 point = Grid2D.IndexToPos(Path[i], Tiles.Width); 219 | Tiles.Set(point.x, point.y, col, '█'); 220 | } 221 | } 222 | } 223 | 224 | [BurstCompile] 225 | struct FindPathJob : IJob 226 | { 227 | public AStar AStar; 228 | public NativeList Path; 229 | public BasicPathingMap Map; 230 | public int Start; 231 | public int End; 232 | 233 | public void Execute() 234 | { 235 | AStar.FindPath(Map, Start, End, Path); 236 | } 237 | } 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/PathfindingDemo/PathfindingDemo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f2d4d183ef100a4cbf75fa954b4dd71 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/PathfindingDemo/PathfindingDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8adfa2c902dffb74f89ab3cf9c9fdca8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/Sark.RLTK.Samples.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sark.RLTK.Samples", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:95d094c764f5f734489a95a337660cb3", 6 | "GUID:b8c9c7241ae5ebe40a9be59499692c24", 7 | "GUID:75469ad4d38634e559750d17036d5f7c", 8 | "GUID:c51471e3aa1693642b24763147328a2e", 9 | "GUID:e0cd26848372d4e5c891c569017e11f1", 10 | "GUID:d8b63aba1907145bea998dd612889d6b", 11 | "GUID:8a2eafa29b15f444eb6d74f94a930e1d", 12 | "GUID:44b930416f788d0449e9dce56820cadb", 13 | "GUID:2665a8d13d1b3f18800f46e256720795" 14 | ], 15 | "includePlatforms": [], 16 | "excludePlatforms": [], 17 | "allowUnsafeCode": false, 18 | "overrideReferences": false, 19 | "precompiledReferences": [], 20 | "autoReferenced": true, 21 | "defineConstraints": [], 22 | "versionDefines": [], 23 | "noEngineReferences": false 24 | } -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/Samples/Sark.RLTK.Samples.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88c8a29250e784748b0aa52ef33ab8e4 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.sark.rltk_unity", 3 | "displayName": "RLTK", 4 | "version": "0.3.6", 5 | "unity": "2020.2", 6 | "unityRelease": "0b8", 7 | "description": "Roguelike Toolkit: A framework for developing traditional text based roguelikes in Unity. Ported from rltk_rs.", 8 | "keywords": [ 9 | "rltk", 10 | "roguelike" 11 | ], 12 | "dependencies": { 13 | "com.unity.burst": "1.3.9", 14 | "com.unity.collections": "0.12.0-preview.13", 15 | "com.unity.jobs": "0.5.0-preview.14", 16 | "com.unity.mathematics": "1.1.0", 17 | "com.unity.render-pipelines.universal": "10.1.0", 18 | "com.sark.common": "0.2.2", 19 | "com.sark.terminals": "0.0.8", 20 | "com.sark.pathfinding": "0.0.5", 21 | "com.sark.tiled_camera": "0.1.2", 22 | "com.unity.inputsystem": "1.1.0-preview.2" 23 | }, 24 | "author": { 25 | "name": "Sark", 26 | "email": "sarkahn@gmail.com", 27 | "url": "https://github.com/sarkahn/" 28 | }, 29 | "samples": [ 30 | { 31 | "displayName": "Pathfinding Demo", 32 | "description": "Shows off pathfinding using an interactive terminal.", 33 | "path": "Samples~/PathfindingDemo" 34 | }, 35 | { 36 | "displayName": "FOV Demo", 37 | "description": "Shows off FOV using an interactive terminal.", 38 | "path": "Samples~/FOVDemo" 39 | } 40 | ], 41 | "type": "tool" 42 | } 43 | -------------------------------------------------------------------------------- /Packages/com.sark.rltk_unity/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31af82696fc07854d96aafd10bfa2486 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.sark.common": "0.2.2", 4 | "com.sark.pathfinding": "0.0.5", 5 | "com.sark.terminals": "0.0.7", 6 | "com.sark.tiled_camera": "0.1.2", 7 | "com.unity.burst": "1.3.9", 8 | "com.unity.collab-proxy": "1.3.9", 9 | "com.unity.ide.rider": "2.0.7", 10 | "com.unity.ide.visualstudio": "2.0.3", 11 | "com.unity.ide.vscode": "1.2.2", 12 | "com.unity.inputsystem": "1.1.0-preview.2", 13 | "com.unity.render-pipelines.universal": "10.1.0", 14 | "com.unity.test-framework": "1.1.18", 15 | "com.unity.test-framework.performance": "2.3.1-preview", 16 | "com.unity.textmeshpro": "3.0.1", 17 | "com.unity.timeline": "1.4.3", 18 | "com.unity.ugui": "1.0.0", 19 | "com.unity.modules.ai": "1.0.0", 20 | "com.unity.modules.androidjni": "1.0.0", 21 | "com.unity.modules.animation": "1.0.0", 22 | "com.unity.modules.assetbundle": "1.0.0", 23 | "com.unity.modules.audio": "1.0.0", 24 | "com.unity.modules.cloth": "1.0.0", 25 | "com.unity.modules.director": "1.0.0", 26 | "com.unity.modules.imageconversion": "1.0.0", 27 | "com.unity.modules.imgui": "1.0.0", 28 | "com.unity.modules.jsonserialize": "1.0.0", 29 | "com.unity.modules.particlesystem": "1.0.0", 30 | "com.unity.modules.physics": "1.0.0", 31 | "com.unity.modules.physics2d": "1.0.0", 32 | "com.unity.modules.screencapture": "1.0.0", 33 | "com.unity.modules.terrain": "1.0.0", 34 | "com.unity.modules.terrainphysics": "1.0.0", 35 | "com.unity.modules.tilemap": "1.0.0", 36 | "com.unity.modules.ui": "1.0.0", 37 | "com.unity.modules.uielements": "1.0.0", 38 | "com.unity.modules.umbra": "1.0.0", 39 | "com.unity.modules.unityanalytics": "1.0.0", 40 | "com.unity.modules.unitywebrequest": "1.0.0", 41 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 42 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 43 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 44 | "com.unity.modules.unitywebrequestwww": "1.0.0", 45 | "com.unity.modules.vehicles": "1.0.0", 46 | "com.unity.modules.video": "1.0.0", 47 | "com.unity.modules.vr": "1.0.0", 48 | "com.unity.modules.wind": "1.0.0", 49 | "com.unity.modules.xr": "1.0.0" 50 | }, 51 | "scopedRegistries": [ 52 | { 53 | "name": "package.openupm.com", 54 | "url": "https://package.openupm.com", 55 | "scopes": [ 56 | "com.openupm", 57 | "com.sark.common", 58 | "com.sark.pathfinding", 59 | "com.sark.terminals", 60 | "com.sark.tiled_camera" 61 | ] 62 | } 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.sark.common": { 4 | "version": "0.2.2", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": { 8 | "com.unity.mathematics": "1.1.0", 9 | "com.unity.collections": "0.14.0-preview.16" 10 | }, 11 | "url": "https://package.openupm.com" 12 | }, 13 | "com.sark.pathfinding": { 14 | "version": "0.0.5", 15 | "depth": 0, 16 | "source": "registry", 17 | "dependencies": { 18 | "com.unity.mathematics": "1.1.0", 19 | "com.unity.collections": "0.14.0-preview.16", 20 | "com.unity.burst": "1.3.9", 21 | "com.unity.jobs": "0.7.0-preview.17", 22 | "com.sark.common": "0.2.0" 23 | }, 24 | "url": "https://package.openupm.com" 25 | }, 26 | "com.sark.rltk_unity": { 27 | "version": "file:com.sark.rltk_unity", 28 | "depth": 0, 29 | "source": "embedded", 30 | "dependencies": { 31 | "com.unity.burst": "1.3.9", 32 | "com.unity.collections": "0.12.0-preview.13", 33 | "com.unity.jobs": "0.5.0-preview.14", 34 | "com.unity.mathematics": "1.1.0", 35 | "com.unity.render-pipelines.universal": "10.1.0", 36 | "com.sark.common": "0.2.2", 37 | "com.sark.terminals": "0.0.8", 38 | "com.sark.pathfinding": "0.0.5", 39 | "com.sark.tiled_camera": "0.1.2", 40 | "com.unity.inputsystem": "1.1.0-preview.2" 41 | } 42 | }, 43 | "com.sark.terminals": { 44 | "version": "0.0.8", 45 | "depth": 1, 46 | "source": "registry", 47 | "dependencies": { 48 | "com.unity.mathematics": "1.1.0", 49 | "com.unity.collections": "0.14.0-preview.16", 50 | "com.unity.burst": "1.3.9", 51 | "com.unity.jobs": "0.7.0-preview.17", 52 | "com.sark.common": "0.2.1" 53 | }, 54 | "url": "https://package.openupm.com" 55 | }, 56 | "com.sark.tiled_camera": { 57 | "version": "0.1.2", 58 | "depth": 0, 59 | "source": "registry", 60 | "dependencies": { 61 | "com.unity.render-pipelines.universal": "10.1.0", 62 | "com.unity.mathematics": "1.1.0" 63 | }, 64 | "url": "https://package.openupm.com" 65 | }, 66 | "com.unity.burst": { 67 | "version": "1.3.9", 68 | "depth": 0, 69 | "source": "registry", 70 | "dependencies": { 71 | "com.unity.mathematics": "1.2.1" 72 | }, 73 | "url": "https://packages.unity.com" 74 | }, 75 | "com.unity.collab-proxy": { 76 | "version": "1.3.9", 77 | "depth": 0, 78 | "source": "registry", 79 | "dependencies": {}, 80 | "url": "https://packages.unity.com" 81 | }, 82 | "com.unity.collections": { 83 | "version": "0.14.0-preview.16", 84 | "depth": 1, 85 | "source": "registry", 86 | "dependencies": { 87 | "com.unity.test-framework.performance": "2.3.1-preview", 88 | "com.unity.burst": "1.3.7" 89 | }, 90 | "url": "https://packages.unity.com" 91 | }, 92 | "com.unity.ext.nunit": { 93 | "version": "1.0.0", 94 | "depth": 1, 95 | "source": "registry", 96 | "dependencies": {}, 97 | "url": "https://packages.unity.com" 98 | }, 99 | "com.unity.ide.rider": { 100 | "version": "2.0.7", 101 | "depth": 0, 102 | "source": "registry", 103 | "dependencies": { 104 | "com.unity.test-framework": "1.1.1" 105 | }, 106 | "url": "https://packages.unity.com" 107 | }, 108 | "com.unity.ide.visualstudio": { 109 | "version": "2.0.3", 110 | "depth": 0, 111 | "source": "registry", 112 | "dependencies": {}, 113 | "url": "https://packages.unity.com" 114 | }, 115 | "com.unity.ide.vscode": { 116 | "version": "1.2.2", 117 | "depth": 0, 118 | "source": "registry", 119 | "dependencies": {}, 120 | "url": "https://packages.unity.com" 121 | }, 122 | "com.unity.inputsystem": { 123 | "version": "1.1.0-preview.2", 124 | "depth": 0, 125 | "source": "registry", 126 | "dependencies": {}, 127 | "url": "https://packages.unity.com" 128 | }, 129 | "com.unity.jobs": { 130 | "version": "0.7.0-preview.17", 131 | "depth": 1, 132 | "source": "registry", 133 | "dependencies": { 134 | "com.unity.collections": "0.14.0-preview.16", 135 | "com.unity.mathematics": "1.2.1" 136 | }, 137 | "url": "https://packages.unity.com" 138 | }, 139 | "com.unity.mathematics": { 140 | "version": "1.2.1", 141 | "depth": 1, 142 | "source": "registry", 143 | "dependencies": {}, 144 | "url": "https://packages.unity.com" 145 | }, 146 | "com.unity.nuget.newtonsoft-json": { 147 | "version": "2.0.0-preview", 148 | "depth": 1, 149 | "source": "registry", 150 | "dependencies": {}, 151 | "url": "https://packages.unity.com" 152 | }, 153 | "com.unity.render-pipelines.core": { 154 | "version": "10.1.0", 155 | "depth": 1, 156 | "source": "registry", 157 | "dependencies": { 158 | "com.unity.ugui": "1.0.0" 159 | }, 160 | "url": "https://packages.unity.com" 161 | }, 162 | "com.unity.render-pipelines.universal": { 163 | "version": "10.1.0", 164 | "depth": 0, 165 | "source": "registry", 166 | "dependencies": { 167 | "com.unity.mathematics": "1.1.0", 168 | "com.unity.render-pipelines.core": "10.1.0", 169 | "com.unity.shadergraph": "10.1.0" 170 | }, 171 | "url": "https://packages.unity.com" 172 | }, 173 | "com.unity.searcher": { 174 | "version": "4.3.1", 175 | "depth": 2, 176 | "source": "registry", 177 | "dependencies": {}, 178 | "url": "https://packages.unity.com" 179 | }, 180 | "com.unity.shadergraph": { 181 | "version": "10.1.0", 182 | "depth": 1, 183 | "source": "registry", 184 | "dependencies": { 185 | "com.unity.render-pipelines.core": "10.1.0", 186 | "com.unity.searcher": "4.3.1" 187 | }, 188 | "url": "https://packages.unity.com" 189 | }, 190 | "com.unity.test-framework": { 191 | "version": "1.1.18", 192 | "depth": 0, 193 | "source": "registry", 194 | "dependencies": { 195 | "com.unity.ext.nunit": "1.0.0", 196 | "com.unity.modules.imgui": "1.0.0", 197 | "com.unity.modules.jsonserialize": "1.0.0" 198 | }, 199 | "url": "https://packages.unity.com" 200 | }, 201 | "com.unity.test-framework.performance": { 202 | "version": "2.3.1-preview", 203 | "depth": 0, 204 | "source": "registry", 205 | "dependencies": { 206 | "com.unity.test-framework": "1.1.0", 207 | "com.unity.nuget.newtonsoft-json": "2.0.0-preview" 208 | }, 209 | "url": "https://packages.unity.com" 210 | }, 211 | "com.unity.textmeshpro": { 212 | "version": "3.0.1", 213 | "depth": 0, 214 | "source": "registry", 215 | "dependencies": { 216 | "com.unity.ugui": "1.0.0" 217 | }, 218 | "url": "https://packages.unity.com" 219 | }, 220 | "com.unity.timeline": { 221 | "version": "1.4.3", 222 | "depth": 0, 223 | "source": "registry", 224 | "dependencies": { 225 | "com.unity.modules.director": "1.0.0", 226 | "com.unity.modules.animation": "1.0.0", 227 | "com.unity.modules.audio": "1.0.0", 228 | "com.unity.modules.particlesystem": "1.0.0" 229 | }, 230 | "url": "https://packages.unity.com" 231 | }, 232 | "com.unity.ugui": { 233 | "version": "1.0.0", 234 | "depth": 0, 235 | "source": "builtin", 236 | "dependencies": { 237 | "com.unity.modules.ui": "1.0.0", 238 | "com.unity.modules.imgui": "1.0.0" 239 | } 240 | }, 241 | "com.unity.modules.ai": { 242 | "version": "1.0.0", 243 | "depth": 0, 244 | "source": "builtin", 245 | "dependencies": {} 246 | }, 247 | "com.unity.modules.androidjni": { 248 | "version": "1.0.0", 249 | "depth": 0, 250 | "source": "builtin", 251 | "dependencies": {} 252 | }, 253 | "com.unity.modules.animation": { 254 | "version": "1.0.0", 255 | "depth": 0, 256 | "source": "builtin", 257 | "dependencies": {} 258 | }, 259 | "com.unity.modules.assetbundle": { 260 | "version": "1.0.0", 261 | "depth": 0, 262 | "source": "builtin", 263 | "dependencies": {} 264 | }, 265 | "com.unity.modules.audio": { 266 | "version": "1.0.0", 267 | "depth": 0, 268 | "source": "builtin", 269 | "dependencies": {} 270 | }, 271 | "com.unity.modules.cloth": { 272 | "version": "1.0.0", 273 | "depth": 0, 274 | "source": "builtin", 275 | "dependencies": { 276 | "com.unity.modules.physics": "1.0.0" 277 | } 278 | }, 279 | "com.unity.modules.director": { 280 | "version": "1.0.0", 281 | "depth": 0, 282 | "source": "builtin", 283 | "dependencies": { 284 | "com.unity.modules.audio": "1.0.0", 285 | "com.unity.modules.animation": "1.0.0" 286 | } 287 | }, 288 | "com.unity.modules.imageconversion": { 289 | "version": "1.0.0", 290 | "depth": 0, 291 | "source": "builtin", 292 | "dependencies": {} 293 | }, 294 | "com.unity.modules.imgui": { 295 | "version": "1.0.0", 296 | "depth": 0, 297 | "source": "builtin", 298 | "dependencies": {} 299 | }, 300 | "com.unity.modules.jsonserialize": { 301 | "version": "1.0.0", 302 | "depth": 0, 303 | "source": "builtin", 304 | "dependencies": {} 305 | }, 306 | "com.unity.modules.particlesystem": { 307 | "version": "1.0.0", 308 | "depth": 0, 309 | "source": "builtin", 310 | "dependencies": {} 311 | }, 312 | "com.unity.modules.physics": { 313 | "version": "1.0.0", 314 | "depth": 0, 315 | "source": "builtin", 316 | "dependencies": {} 317 | }, 318 | "com.unity.modules.physics2d": { 319 | "version": "1.0.0", 320 | "depth": 0, 321 | "source": "builtin", 322 | "dependencies": {} 323 | }, 324 | "com.unity.modules.screencapture": { 325 | "version": "1.0.0", 326 | "depth": 0, 327 | "source": "builtin", 328 | "dependencies": { 329 | "com.unity.modules.imageconversion": "1.0.0" 330 | } 331 | }, 332 | "com.unity.modules.subsystems": { 333 | "version": "1.0.0", 334 | "depth": 1, 335 | "source": "builtin", 336 | "dependencies": { 337 | "com.unity.modules.jsonserialize": "1.0.0" 338 | } 339 | }, 340 | "com.unity.modules.terrain": { 341 | "version": "1.0.0", 342 | "depth": 0, 343 | "source": "builtin", 344 | "dependencies": {} 345 | }, 346 | "com.unity.modules.terrainphysics": { 347 | "version": "1.0.0", 348 | "depth": 0, 349 | "source": "builtin", 350 | "dependencies": { 351 | "com.unity.modules.physics": "1.0.0", 352 | "com.unity.modules.terrain": "1.0.0" 353 | } 354 | }, 355 | "com.unity.modules.tilemap": { 356 | "version": "1.0.0", 357 | "depth": 0, 358 | "source": "builtin", 359 | "dependencies": { 360 | "com.unity.modules.physics2d": "1.0.0" 361 | } 362 | }, 363 | "com.unity.modules.ui": { 364 | "version": "1.0.0", 365 | "depth": 0, 366 | "source": "builtin", 367 | "dependencies": {} 368 | }, 369 | "com.unity.modules.uielements": { 370 | "version": "1.0.0", 371 | "depth": 0, 372 | "source": "builtin", 373 | "dependencies": { 374 | "com.unity.modules.ui": "1.0.0", 375 | "com.unity.modules.imgui": "1.0.0", 376 | "com.unity.modules.jsonserialize": "1.0.0", 377 | "com.unity.modules.uielementsnative": "1.0.0" 378 | } 379 | }, 380 | "com.unity.modules.uielementsnative": { 381 | "version": "1.0.0", 382 | "depth": 1, 383 | "source": "builtin", 384 | "dependencies": { 385 | "com.unity.modules.ui": "1.0.0", 386 | "com.unity.modules.imgui": "1.0.0", 387 | "com.unity.modules.jsonserialize": "1.0.0" 388 | } 389 | }, 390 | "com.unity.modules.umbra": { 391 | "version": "1.0.0", 392 | "depth": 0, 393 | "source": "builtin", 394 | "dependencies": {} 395 | }, 396 | "com.unity.modules.unityanalytics": { 397 | "version": "1.0.0", 398 | "depth": 0, 399 | "source": "builtin", 400 | "dependencies": { 401 | "com.unity.modules.unitywebrequest": "1.0.0", 402 | "com.unity.modules.jsonserialize": "1.0.0" 403 | } 404 | }, 405 | "com.unity.modules.unitywebrequest": { 406 | "version": "1.0.0", 407 | "depth": 0, 408 | "source": "builtin", 409 | "dependencies": {} 410 | }, 411 | "com.unity.modules.unitywebrequestassetbundle": { 412 | "version": "1.0.0", 413 | "depth": 0, 414 | "source": "builtin", 415 | "dependencies": { 416 | "com.unity.modules.assetbundle": "1.0.0", 417 | "com.unity.modules.unitywebrequest": "1.0.0" 418 | } 419 | }, 420 | "com.unity.modules.unitywebrequestaudio": { 421 | "version": "1.0.0", 422 | "depth": 0, 423 | "source": "builtin", 424 | "dependencies": { 425 | "com.unity.modules.unitywebrequest": "1.0.0", 426 | "com.unity.modules.audio": "1.0.0" 427 | } 428 | }, 429 | "com.unity.modules.unitywebrequesttexture": { 430 | "version": "1.0.0", 431 | "depth": 0, 432 | "source": "builtin", 433 | "dependencies": { 434 | "com.unity.modules.unitywebrequest": "1.0.0", 435 | "com.unity.modules.imageconversion": "1.0.0" 436 | } 437 | }, 438 | "com.unity.modules.unitywebrequestwww": { 439 | "version": "1.0.0", 440 | "depth": 0, 441 | "source": "builtin", 442 | "dependencies": { 443 | "com.unity.modules.unitywebrequest": "1.0.0", 444 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 445 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 446 | "com.unity.modules.audio": "1.0.0", 447 | "com.unity.modules.assetbundle": "1.0.0", 448 | "com.unity.modules.imageconversion": "1.0.0" 449 | } 450 | }, 451 | "com.unity.modules.vehicles": { 452 | "version": "1.0.0", 453 | "depth": 0, 454 | "source": "builtin", 455 | "dependencies": { 456 | "com.unity.modules.physics": "1.0.0" 457 | } 458 | }, 459 | "com.unity.modules.video": { 460 | "version": "1.0.0", 461 | "depth": 0, 462 | "source": "builtin", 463 | "dependencies": { 464 | "com.unity.modules.audio": "1.0.0", 465 | "com.unity.modules.ui": "1.0.0", 466 | "com.unity.modules.unitywebrequest": "1.0.0" 467 | } 468 | }, 469 | "com.unity.modules.vr": { 470 | "version": "1.0.0", 471 | "depth": 0, 472 | "source": "builtin", 473 | "dependencies": { 474 | "com.unity.modules.jsonserialize": "1.0.0", 475 | "com.unity.modules.physics": "1.0.0", 476 | "com.unity.modules.xr": "1.0.0" 477 | } 478 | }, 479 | "com.unity.modules.wind": { 480 | "version": "1.0.0", 481 | "depth": 0, 482 | "source": "builtin", 483 | "dependencies": {} 484 | }, 485 | "com.unity.modules.xr": { 486 | "version": "1.0.0", 487 | "depth": 0, 488 | "source": "builtin", 489 | "dependencies": { 490 | "com.unity.modules.physics": "1.0.0", 491 | "com.unity.modules.jsonserialize": "1.0.0", 492 | "com.unity.modules.subsystems": "1.0.0" 493 | } 494 | } 495 | } 496 | } 497 | -------------------------------------------------------------------------------- /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 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 0 20 | -------------------------------------------------------------------------------- /ProjectSettings/BurstAotSettings_StandaloneWindows.json: -------------------------------------------------------------------------------- 1 | { 2 | "MonoBehaviour": { 3 | "Version": 3, 4 | "EnableBurstCompilation": true, 5 | "EnableOptimisations": true, 6 | "EnableSafetyChecks": false, 7 | "EnableDebugInAllBuilds": false, 8 | "UsePlatformSDKLinker": false, 9 | "CpuMinTargetX32": 0, 10 | "CpuMaxTargetX32": 0, 11 | "CpuMinTargetX64": 0, 12 | "CpuMaxTargetX64": 0, 13 | "CpuTargetsX32": 6, 14 | "CpuTargetsX64": 72 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ProjectSettings/BurstAotSettings_WebGL.json: -------------------------------------------------------------------------------- 1 | { 2 | "MonoBehaviour": { 3 | "Version": 3, 4 | "EnableBurstCompilation": true, 5 | "EnableOptimisations": true, 6 | "EnableSafetyChecks": false, 7 | "EnableDebugInAllBuilds": false, 8 | "CpuMinTargetX32": 0, 9 | "CpuMaxTargetX32": 0, 10 | "CpuMinTargetX64": 0, 11 | "CpuMaxTargetX64": 0 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | serializedVersion: 13 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0.1 18 | m_ClothInterCollisionStiffness: 0.2 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ClothGravity: {x: 0, y: -9.81, z: 0} 26 | m_ContactPairsMode: 0 27 | m_BroadphaseType: 0 28 | m_WorldBounds: 29 | m_Center: {x: 0, y: 0, z: 0} 30 | m_Extent: {x: 250, y: 250, z: 250} 31 | m_WorldSubdivisions: 8 32 | m_FrictionType: 0 33 | m_EnableEnhancedDeterminism: 0 34 | m_EnableUnifiedHeightmaps: 1 35 | m_SolverType: 0 36 | m_DefaultMaxAngularSpeed: 7 37 | -------------------------------------------------------------------------------- /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: Packages/com.sark.rltk_unity/Samples/FOVDemo/FOVDemo.unity 10 | guid: a733b93bd5a39bd40ac3360a69982007 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /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: 11 7 | m_SerializationMode: 2 8 | m_LineEndingsForNewScripts: 0 9 | m_DefaultBehaviorMode: 1 10 | m_PrefabRegularEnvironment: {fileID: 0} 11 | m_PrefabUIEnvironment: {fileID: 0} 12 | m_SpritePackerMode: 0 13 | m_SpritePackerPaddingPower: 1 14 | m_EtcTextureCompressorBehavior: 1 15 | m_EtcTextureFastCompressor: 1 16 | m_EtcTextureNormalCompressor: 2 17 | m_EtcTextureBestCompressor: 4 18 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp 19 | m_ProjectGenerationRootNamespace: 20 | m_EnableTextureStreamingInEditMode: 1 21 | m_EnableTextureStreamingInPlayMode: 1 22 | m_AsyncShaderCompilation: 1 23 | m_CachingShaderPreprocessor: 1 24 | m_PrefabModeAllowAutoSave: 1 25 | m_EnterPlayModeOptionsEnabled: 0 26 | m_EnterPlayModeOptions: 3 27 | m_GameObjectNamingDigits: 1 28 | m_GameObjectNamingScheme: 0 29 | m_AssetNamingUsesSpace: 1 30 | m_UseLegacyProbeSampleCount: 0 31 | m_SerializeInlineMappingsOnOneLine: 1 32 | m_DisableCookiesInLightmapper: 1 33 | m_AssetPipelineMode: 1 34 | m_CacheServerMode: 0 35 | m_CacheServerEndpoint: 36 | m_CacheServerNamespacePrefix: default 37 | m_CacheServerEnableDownload: 1 38 | m_CacheServerEnableUpload: 1 39 | m_CacheServerEnableAuth: 0 40 | m_CacheServerEnableTls: 0 41 | -------------------------------------------------------------------------------- /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: 13 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_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 41 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 42 | m_PreloadedShaders: [] 43 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 44 | type: 0} 45 | m_CustomRenderPipeline: {fileID: 11400000, guid: 19ba41d7c0026c3459d37c2fe90c55a0, 46 | type: 2} 47 | m_TransparencySortMode: 0 48 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 49 | m_DefaultRenderingPath: 1 50 | m_DefaultMobileRenderingPath: 1 51 | m_TierSettings: [] 52 | m_LightmapStripping: 0 53 | m_FogStripping: 0 54 | m_InstancingStripping: 0 55 | m_LightmapKeepPlain: 1 56 | m_LightmapKeepDirCombined: 1 57 | m_LightmapKeepDynamicPlain: 1 58 | m_LightmapKeepDynamicDirCombined: 1 59 | m_LightmapKeepShadowMask: 1 60 | m_LightmapKeepSubtractive: 1 61 | m_FogKeepLinear: 1 62 | m_FogKeepExp: 1 63 | m_FogKeepExp2: 1 64 | m_AlbedoSwatchInfos: [] 65 | m_LightsUseLinearIntensity: 1 66 | m_LightsUseColorTemperature: 0 67 | m_LogWhenShaderIsCompiled: 0 68 | m_AllowEnlightenSupportForUpgradedProject: 1 69 | -------------------------------------------------------------------------------- /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 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | - serializedVersion: 3 297 | m_Name: Enable Debug Button 1 298 | descriptiveName: 299 | descriptiveNegativeName: 300 | negativeButton: 301 | positiveButton: left ctrl 302 | altNegativeButton: 303 | altPositiveButton: joystick button 8 304 | gravity: 0 305 | dead: 0 306 | sensitivity: 0 307 | snap: 0 308 | invert: 0 309 | type: 0 310 | axis: 0 311 | joyNum: 0 312 | - serializedVersion: 3 313 | m_Name: Enable Debug Button 2 314 | descriptiveName: 315 | descriptiveNegativeName: 316 | negativeButton: 317 | positiveButton: backspace 318 | altNegativeButton: 319 | altPositiveButton: joystick button 9 320 | gravity: 0 321 | dead: 0 322 | sensitivity: 0 323 | snap: 0 324 | invert: 0 325 | type: 0 326 | axis: 0 327 | joyNum: 0 328 | - serializedVersion: 3 329 | m_Name: Debug Reset 330 | descriptiveName: 331 | descriptiveNegativeName: 332 | negativeButton: 333 | positiveButton: left alt 334 | altNegativeButton: 335 | altPositiveButton: joystick button 1 336 | gravity: 0 337 | dead: 0 338 | sensitivity: 0 339 | snap: 0 340 | invert: 0 341 | type: 0 342 | axis: 0 343 | joyNum: 0 344 | - serializedVersion: 3 345 | m_Name: Debug Next 346 | descriptiveName: 347 | descriptiveNegativeName: 348 | negativeButton: 349 | positiveButton: page down 350 | altNegativeButton: 351 | altPositiveButton: joystick button 5 352 | gravity: 0 353 | dead: 0 354 | sensitivity: 0 355 | snap: 0 356 | invert: 0 357 | type: 0 358 | axis: 0 359 | joyNum: 0 360 | - serializedVersion: 3 361 | m_Name: Debug Previous 362 | descriptiveName: 363 | descriptiveNegativeName: 364 | negativeButton: 365 | positiveButton: page up 366 | altNegativeButton: 367 | altPositiveButton: joystick button 4 368 | gravity: 0 369 | dead: 0 370 | sensitivity: 0 371 | snap: 0 372 | invert: 0 373 | type: 0 374 | axis: 0 375 | joyNum: 0 376 | - serializedVersion: 3 377 | m_Name: Debug Validate 378 | descriptiveName: 379 | descriptiveNegativeName: 380 | negativeButton: 381 | positiveButton: return 382 | altNegativeButton: 383 | altPositiveButton: joystick button 0 384 | gravity: 0 385 | dead: 0 386 | sensitivity: 0 387 | snap: 0 388 | invert: 0 389 | type: 0 390 | axis: 0 391 | joyNum: 0 392 | - serializedVersion: 3 393 | m_Name: Debug Persistent 394 | descriptiveName: 395 | descriptiveNegativeName: 396 | negativeButton: 397 | positiveButton: right shift 398 | altNegativeButton: 399 | altPositiveButton: joystick button 2 400 | gravity: 0 401 | dead: 0 402 | sensitivity: 0 403 | snap: 0 404 | invert: 0 405 | type: 0 406 | axis: 0 407 | joyNum: 0 408 | - serializedVersion: 3 409 | m_Name: Debug Multiplier 410 | descriptiveName: 411 | descriptiveNegativeName: 412 | negativeButton: 413 | positiveButton: left shift 414 | altNegativeButton: 415 | altPositiveButton: joystick button 3 416 | gravity: 0 417 | dead: 0 418 | sensitivity: 0 419 | snap: 0 420 | invert: 0 421 | type: 0 422 | axis: 0 423 | joyNum: 0 424 | - serializedVersion: 3 425 | m_Name: Debug Horizontal 426 | descriptiveName: 427 | descriptiveNegativeName: 428 | negativeButton: left 429 | positiveButton: right 430 | altNegativeButton: 431 | altPositiveButton: 432 | gravity: 1000 433 | dead: 0.001 434 | sensitivity: 1000 435 | snap: 0 436 | invert: 0 437 | type: 0 438 | axis: 0 439 | joyNum: 0 440 | - serializedVersion: 3 441 | m_Name: Debug Vertical 442 | descriptiveName: 443 | descriptiveNegativeName: 444 | negativeButton: down 445 | positiveButton: up 446 | altNegativeButton: 447 | altPositiveButton: 448 | gravity: 1000 449 | dead: 0.001 450 | sensitivity: 1000 451 | snap: 0 452 | invert: 0 453 | type: 0 454 | axis: 0 455 | joyNum: 0 456 | - serializedVersion: 3 457 | m_Name: Debug Vertical 458 | descriptiveName: 459 | descriptiveNegativeName: 460 | negativeButton: down 461 | positiveButton: up 462 | altNegativeButton: 463 | altPositiveButton: 464 | gravity: 1000 465 | dead: 0.001 466 | sensitivity: 1000 467 | snap: 0 468 | invert: 0 469 | type: 2 470 | axis: 6 471 | joyNum: 0 472 | - serializedVersion: 3 473 | m_Name: Debug Horizontal 474 | descriptiveName: 475 | descriptiveNegativeName: 476 | negativeButton: left 477 | positiveButton: right 478 | altNegativeButton: 479 | altPositiveButton: 480 | gravity: 1000 481 | dead: 0.001 482 | sensitivity: 1000 483 | snap: 0 484 | invert: 0 485 | type: 2 486 | axis: 5 487 | joyNum: 0 488 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 1 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 1 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.com 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | - m_Id: scoped:package.openupm.com 28 | m_Name: package.openupm.com 29 | m_Url: https://package.openupm.com 30 | m_Scopes: 31 | - com.openupm 32 | - com.sark.common 33 | - com.sark.pathfinding 34 | - com.sark.terminals 35 | - com.sark.tiled_camera 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_UserSelectedRegistryName: 39 | m_UserAddingNewScopedRegistry: 0 40 | m_RegistryInfoDraft: 41 | m_ErrorMessage: 42 | m_Original: 43 | m_Id: scoped:package.openupm.com 44 | m_Name: package.openupm.com 45 | m_Url: https://package.openupm.com 46 | m_Scopes: 47 | - com.openupm 48 | - com.sark.common 49 | - com.sark.pathfinding 50 | - com.sark.terminals 51 | - com.sark.tiled_camera 52 | m_IsDefault: 0 53 | m_Capabilities: 0 54 | m_Modified: 0 55 | m_Name: package.openupm.com 56 | m_Url: https://package.openupm.com 57 | m_Scopes: 58 | - com.openupm 59 | - com.sark.common 60 | - com.sark.pathfinding 61 | - com.sark.terminals 62 | - com.sark.tiled_camera 63 | m_SelectedScopeIndex: 0 64 | -------------------------------------------------------------------------------- /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 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: 463065d4f17d1d94d848aa127b94dd43, 13 | type: 2} 14 | - type: 15 | m_NativeTypeID: 1020 16 | m_ManagedTypePPtr: {fileID: 0} 17 | m_ManagedTypeFallback: 18 | defaultPresets: 19 | - m_Preset: {fileID: 2655988077585873504, guid: e7689051185d12f4298e1ebb2693a29f, 20 | type: 2} 21 | - type: 22 | m_NativeTypeID: 1006 23 | m_ManagedTypePPtr: {fileID: 0} 24 | m_ManagedTypeFallback: 25 | defaultPresets: 26 | - m_Preset: {fileID: 2655988077585873504, guid: e8537455c6c08bd4e8bf0be3707da685, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.2.0b10 2 | m_EditorVersionWithRevision: 2020.2.0b10 (19f63eee530c) 3 | -------------------------------------------------------------------------------- /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: 2 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 20 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | skinWeights: 2 22 | textureQuality: 0 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.4 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 16 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | customRenderPipeline: {fileID: 11400000, guid: a31e9f9f9c9d4b9429ed0d1234e22103, type: 2} 44 | excludedTargetPlatforms: [] 45 | - serializedVersion: 2 46 | name: Medium 47 | pixelLightCount: 1 48 | shadows: 1 49 | shadowResolution: 0 50 | shadowProjection: 1 51 | shadowCascades: 1 52 | shadowDistance: 20 53 | shadowNearPlaneOffset: 3 54 | shadowCascade2Split: 0.33333334 55 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 56 | shadowmaskMode: 0 57 | skinWeights: 2 58 | textureQuality: 0 59 | anisotropicTextures: 1 60 | antiAliasing: 0 61 | softParticles: 0 62 | softVegetation: 0 63 | realtimeReflectionProbes: 0 64 | billboardsFaceCameraPosition: 0 65 | vSyncCount: 1 66 | lodBias: 0.7 67 | maximumLODLevel: 0 68 | streamingMipmapsActive: 0 69 | streamingMipmapsAddAllCameras: 1 70 | streamingMipmapsMemoryBudget: 512 71 | streamingMipmapsRenderersPerFrame: 512 72 | streamingMipmapsMaxLevelReduction: 2 73 | streamingMipmapsMaxFileIORequests: 1024 74 | particleRaycastBudget: 64 75 | asyncUploadTimeSlice: 2 76 | asyncUploadBufferSize: 16 77 | asyncUploadPersistentBuffer: 1 78 | resolutionScalingFixedDPIFactor: 1 79 | customRenderPipeline: {fileID: 11400000, guid: d847b876476d3d6468f5dfcd34266f96, type: 2} 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: High 83 | pixelLightCount: 2 84 | shadows: 2 85 | shadowResolution: 1 86 | shadowProjection: 1 87 | shadowCascades: 2 88 | shadowDistance: 40 89 | shadowNearPlaneOffset: 3 90 | shadowCascade2Split: 0.33333334 91 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 92 | shadowmaskMode: 1 93 | skinWeights: 2 94 | textureQuality: 0 95 | anisotropicTextures: 1 96 | antiAliasing: 2 97 | softParticles: 0 98 | softVegetation: 1 99 | realtimeReflectionProbes: 1 100 | billboardsFaceCameraPosition: 1 101 | vSyncCount: 1 102 | lodBias: 1 103 | maximumLODLevel: 0 104 | streamingMipmapsActive: 0 105 | streamingMipmapsAddAllCameras: 1 106 | streamingMipmapsMemoryBudget: 512 107 | streamingMipmapsRenderersPerFrame: 512 108 | streamingMipmapsMaxLevelReduction: 2 109 | streamingMipmapsMaxFileIORequests: 1024 110 | particleRaycastBudget: 256 111 | asyncUploadTimeSlice: 2 112 | asyncUploadBufferSize: 16 113 | asyncUploadPersistentBuffer: 1 114 | resolutionScalingFixedDPIFactor: 1 115 | customRenderPipeline: {fileID: 11400000, guid: 19ba41d7c0026c3459d37c2fe90c55a0, type: 2} 116 | excludedTargetPlatforms: [] 117 | m_PerPlatformDefaultQuality: 118 | Android: 1 119 | Lumin: 2 120 | Nintendo Switch: 2 121 | PS4: 2 122 | Stadia: 2 123 | Standalone: 2 124 | WebGL: 1 125 | Windows Store Apps: 2 126 | XboxOne: 2 127 | iPhone: 1 128 | tvOS: 1 129 | -------------------------------------------------------------------------------- /ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "ignore": false, 8 | "defaultInstantiationMode": 0, 9 | "supportsModification": true 10 | }, 11 | { 12 | "userAdded": false, 13 | "type": "UnityEditor.Animations.AnimatorController", 14 | "ignore": false, 15 | "defaultInstantiationMode": 0, 16 | "supportsModification": true 17 | }, 18 | { 19 | "userAdded": false, 20 | "type": "UnityEngine.AnimatorOverrideController", 21 | "ignore": false, 22 | "defaultInstantiationMode": 0, 23 | "supportsModification": true 24 | }, 25 | { 26 | "userAdded": false, 27 | "type": "UnityEditor.Audio.AudioMixerController", 28 | "ignore": false, 29 | "defaultInstantiationMode": 0, 30 | "supportsModification": true 31 | }, 32 | { 33 | "userAdded": false, 34 | "type": "UnityEngine.ComputeShader", 35 | "ignore": true, 36 | "defaultInstantiationMode": 1, 37 | "supportsModification": true 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEngine.Cubemap", 42 | "ignore": false, 43 | "defaultInstantiationMode": 0, 44 | "supportsModification": true 45 | }, 46 | { 47 | "userAdded": false, 48 | "type": "UnityEngine.GameObject", 49 | "ignore": false, 50 | "defaultInstantiationMode": 0, 51 | "supportsModification": true 52 | }, 53 | { 54 | "userAdded": false, 55 | "type": "UnityEditor.LightingDataAsset", 56 | "ignore": false, 57 | "defaultInstantiationMode": 0, 58 | "supportsModification": false 59 | }, 60 | { 61 | "userAdded": false, 62 | "type": "UnityEngine.LightingSettings", 63 | "ignore": false, 64 | "defaultInstantiationMode": 0, 65 | "supportsModification": true 66 | }, 67 | { 68 | "userAdded": false, 69 | "type": "UnityEngine.Material", 70 | "ignore": false, 71 | "defaultInstantiationMode": 0, 72 | "supportsModification": true 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEditor.MonoScript", 77 | "ignore": true, 78 | "defaultInstantiationMode": 1, 79 | "supportsModification": true 80 | }, 81 | { 82 | "userAdded": false, 83 | "type": "UnityEngine.PhysicMaterial", 84 | "ignore": false, 85 | "defaultInstantiationMode": 0, 86 | "supportsModification": true 87 | }, 88 | { 89 | "userAdded": false, 90 | "type": "UnityEngine.PhysicsMaterial2D", 91 | "ignore": false, 92 | "defaultInstantiationMode": 0, 93 | "supportsModification": true 94 | }, 95 | { 96 | "userAdded": false, 97 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 98 | "ignore": false, 99 | "defaultInstantiationMode": 0, 100 | "supportsModification": true 101 | }, 102 | { 103 | "userAdded": false, 104 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 105 | "ignore": false, 106 | "defaultInstantiationMode": 0, 107 | "supportsModification": true 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Rendering.VolumeProfile", 112 | "ignore": false, 113 | "defaultInstantiationMode": 0, 114 | "supportsModification": true 115 | }, 116 | { 117 | "userAdded": false, 118 | "type": "UnityEditor.SceneAsset", 119 | "ignore": false, 120 | "defaultInstantiationMode": 0, 121 | "supportsModification": false 122 | }, 123 | { 124 | "userAdded": false, 125 | "type": "UnityEngine.Shader", 126 | "ignore": true, 127 | "defaultInstantiationMode": 1, 128 | "supportsModification": true 129 | }, 130 | { 131 | "userAdded": false, 132 | "type": "UnityEngine.ShaderVariantCollection", 133 | "ignore": true, 134 | "defaultInstantiationMode": 1, 135 | "supportsModification": true 136 | }, 137 | { 138 | "userAdded": false, 139 | "type": "UnityEngine.Texture", 140 | "ignore": false, 141 | "defaultInstantiationMode": 0, 142 | "supportsModification": true 143 | }, 144 | { 145 | "userAdded": false, 146 | "type": "UnityEngine.Texture2D", 147 | "ignore": false, 148 | "defaultInstantiationMode": 0, 149 | "supportsModification": true 150 | }, 151 | { 152 | "userAdded": false, 153 | "type": "UnityEngine.Timeline.TimelineAsset", 154 | "ignore": false, 155 | "defaultInstantiationMode": 0, 156 | "supportsModification": true 157 | } 158 | ], 159 | "defaultDependencyTypeInfo": { 160 | "userAdded": false, 161 | "type": "", 162 | "ignore": false, 163 | "defaultInstantiationMode": 1, 164 | "supportsModification": true 165 | }, 166 | "newSceneOverride": 0 167 | } -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /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: 0.02 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/URPProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 247994e1f5a72c2419c26a37e9334c01, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_LastMaterialVersion: 3 16 | -------------------------------------------------------------------------------- /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 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![openupm](https://img.shields.io/npm/v/com.sark.rltk_unity?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.sark.rltk_unity/) 2 | 3 | # The Roguelike Toolkit (RLTK) for Unity 4 | 5 | RLTK is a set of tools used for building pixel perfect ascii-based roguelikes in Unity. The tools are separated into a few individual packages, while this package uses all those separate tools to host a few demos showing off them off. 6 | 7 | This framework was originally based on [The Roguelike Toolkit (RLTK), implemented for Rust](https://github.com/thebracket/rltk_rs) by TheBracket. 8 | 9 | ##### The Individual Packages: 10 | * __Pathfinding__: [Github](https://github.com/sarkahn/pathfinding) - [OpenUPM](https://openupm.com/packages/com.sark.pathfinding/) - A simple generic pathfinding solution that's usable in jobs and burst. 11 | * __Terminals__: [Github](https://github.com/sarkahn/terminals) - [OpenUPM](https://openupm.com/packages/com.sark.terminals/) - A set of terminals used for rendering pixel perfect ascii terminals in Unity. 12 | * __Tiled Camera__: [Github](https://github.com/sarkahn/tiledcamera) - [OpenUPM](https://openupm.com/packages/com.sark.tiled_camera/) - A camera utility for defining your pixel perfect viewport in terms of tiles. 13 | * __Common__: [Github](https://github.com/sarkahn/common) - [OpenUPM](https://openupm.com/packages/com.sark.common/) - Common utilities I use in various places. 14 | 15 | ## Demos 16 | 17 | ##### Pathfinding 18 | 19 | ![](Documentation~/images~/pathfinddemo.png) 20 | *Demonstrates the pathfinding library using an interactive terminal* 21 | 22 | ##### FOV 23 | 24 | ![](Documentation~/images~/fovdemo.png) 25 | *Demonstrates the FOV algorithm using an interactive terminal* 26 | 27 | ------ 28 | 29 | The RLTK demos can be imported from the package manager: 30 | 31 | ![](Documentation~/images~/samples.png) 32 | 33 | ------ 34 | 35 | ##### Roguelike Tutorial 36 | 37 | In addition to the above samples included in this package, I am [developing a Roguelike that uses RLTK as a backend](https://github.com/sarkahn/rltk_unity_roguelike), based on the excellent [Roguelike Tutorial in Rust](https://bfnightly.bracketproductions.com/rustbook/chapter_1.html). It's being developed using Unity's ECS framework and should be of interest to anyone who would want to know how to actually make a game using RLTK. 38 | 39 | ## How to Install 40 | 41 | ##### Via [OpenUPM](https://openupm.com/): 42 | ``` 43 | npm install -g openupm-cli 44 | openupm add com.sark.rltk_unity 45 | ``` 46 | 47 | *This will automatically install required dependencies* 48 | 49 | --- 50 | RLTK for Unity will always be free and the code will always be open source. With that being said I put quite a lot of work into it. If you find it useful, please consider donating. Any amount you can spare would really help me out a great deal - thank you! 51 | 52 | [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y54CX7AXFKQXG) -------------------------------------------------------------------------------- /UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedScenePath-0: 9 | value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d 10 | flags: 0 11 | RecentlyUsedScenePath-1: 12 | value: 3350570d04520c48420d032f5e305e021d590c23202d22332c241821e3af0031eee232cae6373a2e3836ea2f10701431fb1e10 13 | flags: 0 14 | RecentlyUsedScenePath-2: 15 | value: 224247031146466b0c1a0424192d5b191810352b3c3b69002c3d1535ebee3031ece01be8f7297129370bfb25 16 | flags: 0 17 | RecentlyUsedScenePath-3: 18 | value: 224247031146466b0c1a0424192d5b230616151e293b327e38271427fb 19 | flags: 0 20 | RecentlyUsedScenePath-4: 21 | value: 2242470311464672031a093011204b1900122c2f3e252f3e2c25521aecf4312ae3e422e0f13f0b392b0fe63205324f2afc031d12 22 | flags: 0 23 | RecentlyUsedScenePath-5: 24 | value: 3350570d04520c48420d032f5e305e021d590a26382319252320092aadd33535f2eb33faa80a3e283104e63200370f38bd3a081ffe0d03051507f30935fa1d1c5fd016cc0ed1 25 | flags: 0 26 | RecentlyUsedScenePath-6: 27 | value: 3350570d04520c48420d032f5e305e021d590a26382319252320092aadd33535f2eb33faa80a3e283104e63200370f38d60f0404b93b0b1f1908f40015f61e1435c015ca54dd1115df00 28 | flags: 0 29 | RecentlyUsedScenePath-7: 30 | value: 3350570d04520c48420d032f5e305e021d590a26382319252320092aadd33535f2eb33faa81c100a1d07e2334b182e09d60f0404b81e04020517 31 | flags: 0 32 | RecentlyUsedScenePath-8: 33 | value: 22424703114646780c030930111750241305152322292a04283a097df7ee3d2cfb 34 | flags: 0 35 | vcSharedLogLevel: 36 | value: 0d5e400f0650 37 | flags: 0 38 | m_VCAutomaticAdd: 1 39 | m_VCDebugCom: 0 40 | m_VCDebugCmd: 0 41 | m_VCDebugOut: 0 42 | m_SemanticMergeMode: 2 43 | m_VCShowFailedCheckout: 1 44 | m_VCOverwriteFailedCheckoutAssets: 1 45 | m_VCProjectOverlayIcons: 1 46 | m_VCHierarchyOverlayIcons: 1 47 | m_VCOtherOverlayIcons: 1 48 | m_VCAllowAsyncUpdate: 1 49 | --------------------------------------------------------------------------------