├── .gitignore ├── Documentation.meta ├── Documentation ├── copies_moving.gif ├── copies_moving.gif.meta ├── copies_spawning.gif ├── copies_spawning.gif.meta ├── moving_element.gif ├── moving_element.gif.meta ├── static_element.gif └── static_element.gif.meta ├── Editor.meta ├── Editor ├── Attributes.meta ├── Attributes │ ├── AbstractAttributes.meta │ ├── AbstractAttributes │ │ ├── ConditionalAttribute.cs │ │ ├── ConditionalAttribute.cs.meta │ │ ├── CustomAttribute.cs │ │ └── CustomAttribute.cs.meta │ ├── DisableInPlayModeAttribute.cs │ ├── DisableInPlayModeAttribute.cs.meta │ ├── HideIfAttribute.cs │ ├── HideIfAttribute.cs.meta │ ├── HideInPlayModeAttribute.cs │ ├── HideInPlayModeAttribute.cs.meta │ ├── LeftToggleAttribute.cs │ ├── LeftToggleAttribute.cs.meta │ ├── ReadOnlyAttribute.cs │ ├── ReadOnlyAttribute.cs.meta │ ├── ShowIfAttribute.cs │ ├── ShowIfAttribute.cs.meta │ ├── ShowInPlayModeAttribute.cs │ └── ShowInPlayModeAttribute.cs.meta ├── Drawers.meta ├── Drawers │ ├── AbstractDrawers.meta │ ├── AbstractDrawers │ │ ├── BasePropertyDrawer.cs │ │ ├── BasePropertyDrawer.cs.meta │ │ ├── ConditionalAttributeDrawer.cs │ │ └── ConditionalAttributeDrawer.cs.meta │ ├── DisableInPlayModeAttributeDrawer.cs │ ├── DisableInPlayModeAttributeDrawer.cs.meta │ ├── HideIfAttributeDrawer.cs │ ├── HideIfAttributeDrawer.cs.meta │ ├── HideInPlayModeAttributeDrawer.cs │ ├── HideInPlayModeAttributeDrawer.cs.meta │ ├── LeftToggleAttributeDrawer.cs │ ├── LeftToggleAttributeDrawer.cs.meta │ ├── ReadOnlyAttributeDrawer.cs │ ├── ReadOnlyAttributeDrawer.cs.meta │ ├── ShowIfAttributeDrawer.cs │ ├── ShowIfAttributeDrawer.cs.meta │ ├── ShowInPlayModeAttributeDrawer.cs │ └── ShowInPlayModeAttributeDrawer.cs.meta ├── Extensions.meta ├── Extensions │ ├── ObjectExtensions.cs │ ├── ObjectExtensions.cs.meta │ ├── ObjectReflectionExtensions.cs │ ├── ObjectReflectionExtensions.cs.meta │ ├── SerializedPropertyExtensions.cs │ ├── SerializedPropertyExtensions.cs.meta │ ├── StringExtensions.cs │ ├── StringExtensions.cs.meta │ ├── SystemTypeExtensions.cs │ └── SystemTypeExtensions.cs.meta ├── HelperMethods.meta ├── HelperMethods │ ├── EditorUtil.cs │ ├── EditorUtil.cs.meta │ ├── HelperMethods.cs │ └── HelperMethods.cs.meta ├── com.pixelrouge.parallaxersystemforunity.Editor.asmdef └── com.pixelrouge.parallaxersystemforunity.Editor.asmdef.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── Helpers.meta ├── Helpers │ ├── Direction.cs │ ├── Direction.cs.meta │ ├── Extensions.cs │ ├── Extensions.cs.meta │ ├── MathLibrary.cs │ └── MathLibrary.cs.meta ├── ParallaxElement.cs ├── ParallaxElement.cs.meta ├── ParallaxExpansibleElement.cs ├── ParallaxExpansibleElement.cs.meta ├── ParallaxManager.cs ├── ParallaxManager.cs.meta ├── ParallaxMovingElement.cs ├── ParallaxMovingElement.cs.meta ├── ParallaxPlane.cs ├── ParallaxPlane.cs.meta ├── ParallaxStaticElement.cs ├── ParallaxStaticElement.cs.meta ├── com.pixelrouge.parallaxersystemforunity.Runtime.asmdef └── com.pixelrouge.parallaxersystemforunity.Runtime.asmdef.meta ├── Samples.meta ├── Samples ├── Animations.meta ├── Animations │ ├── Player.controller │ ├── Player.controller.meta │ ├── idle.anim │ ├── idle.anim.meta │ ├── walk.anim │ └── walk.anim.meta ├── DemoScene.unity ├── DemoScene.unity.meta ├── Graphics.meta ├── Graphics │ ├── Character.meta │ ├── Character │ │ ├── platformChar_idle.png │ │ ├── platformChar_idle.png.meta │ │ ├── platformChar_walk1.png │ │ ├── platformChar_walk1.png.meta │ │ ├── platformChar_walk2.png │ │ └── platformChar_walk2.png.meta │ ├── Scenery.meta │ ├── Scenery │ │ ├── backgroundForest.png │ │ ├── backgroundForest.png.meta │ │ ├── cloud1.png │ │ ├── cloud1.png.meta │ │ ├── cloud4.png │ │ ├── cloud4.png.meta │ │ ├── foreground.png │ │ ├── foreground.png.meta │ │ ├── hillsLarge.png │ │ ├── hillsLarge.png.meta │ │ ├── sun.png │ │ ├── sun.png.meta │ │ ├── trees_background.png │ │ └── trees_background.png.meta │ ├── Tileset.meta │ └── Tileset │ │ ├── TilesetAssets.meta │ │ ├── TilesetAssets │ │ ├── ParallaxDemo.prefab │ │ ├── ParallaxDemo.prefab.meta │ │ ├── platformPack_tile001.asset │ │ └── platformPack_tile001.asset.meta │ │ ├── platformPack_tile001.png │ │ └── platformPack_tile001.png.meta ├── Scripts.meta └── Scripts │ ├── CameraFollow.cs │ ├── CameraFollow.cs.meta │ ├── PlayerController.cs │ ├── PlayerController.cs.meta │ ├── com.pixelrouge.parallaxersystemforunity.Samples.asmdef │ └── com.pixelrouge.parallaxersystemforunity.Samples.asmdef.meta ├── Third Party Notices.md ├── Third Party Notices.md.meta ├── package.json └── package.json.meta /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.obj 73 | *.iobj 74 | *.pch 75 | *.pdb 76 | *.ipdb 77 | *.pgc 78 | *.pgd 79 | *.rsp 80 | *.sbr 81 | *.tlb 82 | *.tli 83 | *.tlh 84 | *.tmp 85 | *.tmp_proj 86 | *_wpftmp.csproj 87 | *.log 88 | *.vspscc 89 | *.vssscc 90 | .builds 91 | *.pidb 92 | *.svclog 93 | *.scc 94 | 95 | # Chutzpah Test files 96 | _Chutzpah* 97 | 98 | # Visual C++ cache files 99 | ipch/ 100 | *.aps 101 | *.ncb 102 | *.opendb 103 | *.opensdf 104 | *.sdf 105 | *.cachefile 106 | *.VC.db 107 | *.VC.VC.opendb 108 | 109 | # Visual Studio profiler 110 | *.psess 111 | *.vsp 112 | *.vspx 113 | *.sap 114 | 115 | # Visual Studio Trace Files 116 | *.e2e 117 | 118 | # TFS 2012 Local Workspace 119 | $tf/ 120 | 121 | # Guidance Automation Toolkit 122 | *.gpState 123 | 124 | # ReSharper is a .NET coding add-in 125 | _ReSharper*/ 126 | *.[Rr]e[Ss]harper 127 | *.DotSettings.user 128 | 129 | # TeamCity is a build add-in 130 | _TeamCity* 131 | 132 | # DotCover is a Code Coverage Tool 133 | *.dotCover 134 | 135 | # AxoCover is a Code Coverage Tool 136 | .axoCover/* 137 | !.axoCover/settings.json 138 | 139 | # Visual Studio code coverage results 140 | *.coverage 141 | *.coveragexml 142 | 143 | # NCrunch 144 | _NCrunch_* 145 | .*crunch*.local.xml 146 | nCrunchTemp_* 147 | 148 | # MightyMoose 149 | *.mm.* 150 | AutoTest.Net/ 151 | 152 | # Web workbench (sass) 153 | .sass-cache/ 154 | 155 | # Installshield output folder 156 | [Ee]xpress/ 157 | 158 | # DocProject is a documentation generator add-in 159 | DocProject/buildhelp/ 160 | DocProject/Help/*.HxT 161 | DocProject/Help/*.HxC 162 | DocProject/Help/*.hhc 163 | DocProject/Help/*.hhk 164 | DocProject/Help/*.hhp 165 | DocProject/Help/Html2 166 | DocProject/Help/html 167 | 168 | # Click-Once directory 169 | publish/ 170 | 171 | # Publish Web Output 172 | *.[Pp]ublish.xml 173 | *.azurePubxml 174 | # Note: Comment the next line if you want to checkin your web deploy settings, 175 | # but database connection strings (with potential passwords) will be unencrypted 176 | *.pubxml 177 | *.publishproj 178 | 179 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 180 | # checkin your Azure Web App publish settings, but sensitive information contained 181 | # in these scripts will be unencrypted 182 | PublishScripts/ 183 | 184 | # NuGet Packages 185 | *.nupkg 186 | # NuGet Symbol Packages 187 | *.snupkg 188 | # The packages folder can be ignored because of Package Restore 189 | **/[Pp]ackages/* 190 | # except build/, which is used as an MSBuild target. 191 | !**/[Pp]ackages/build/ 192 | # Uncomment if necessary however generally it will be regenerated when needed 193 | #!**/[Pp]ackages/repositories.config 194 | # NuGet v3's project.json files produces more ignorable files 195 | *.nuget.props 196 | *.nuget.targets 197 | 198 | # Microsoft Azure Build Output 199 | csx/ 200 | *.build.csdef 201 | 202 | # Microsoft Azure Emulator 203 | ecf/ 204 | rcf/ 205 | 206 | # Windows Store app package directories and files 207 | AppPackages/ 208 | BundleArtifacts/ 209 | Package.StoreAssociation.xml 210 | _pkginfo.txt 211 | *.appx 212 | *.appxbundle 213 | *.appxupload 214 | 215 | # Visual Studio cache files 216 | # files ending in .cache can be ignored 217 | *.[Cc]ache 218 | # but keep track of directories ending in .cache 219 | !?*.[Cc]ache/ 220 | 221 | # Others 222 | ClientBin/ 223 | ~$* 224 | *~ 225 | *.dbmdl 226 | *.dbproj.schemaview 227 | *.jfm 228 | *.pfx 229 | *.publishsettings 230 | orleans.codegen.cs 231 | 232 | # Including strong name files can present a security risk 233 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 234 | #*.snk 235 | 236 | # Since there are multiple workflows, uncomment next line to ignore bower_components 237 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 238 | #bower_components/ 239 | 240 | # RIA/Silverlight projects 241 | Generated_Code/ 242 | 243 | # Backup & report files from converting an old project file 244 | # to a newer Visual Studio version. Backup files are not needed, 245 | # because we have git ;-) 246 | _UpgradeReport_Files/ 247 | Backup*/ 248 | UpgradeLog*.XML 249 | UpgradeLog*.htm 250 | ServiceFabricBackup/ 251 | *.rptproj.bak 252 | 253 | # SQL Server files 254 | *.mdf 255 | *.ldf 256 | *.ndf 257 | 258 | # Business Intelligence projects 259 | *.rdl.data 260 | *.bim.layout 261 | *.bim_*.settings 262 | *.rptproj.rsuser 263 | *- [Bb]ackup.rdl 264 | *- [Bb]ackup ([0-9]).rdl 265 | *- [Bb]ackup ([0-9][0-9]).rdl 266 | 267 | # Microsoft Fakes 268 | FakesAssemblies/ 269 | 270 | # GhostDoc plugin setting file 271 | *.GhostDoc.xml 272 | 273 | # Node.js Tools for Visual Studio 274 | .ntvs_analysis.dat 275 | node_modules/ 276 | 277 | # Visual Studio 6 build log 278 | *.plg 279 | 280 | # Visual Studio 6 workspace options file 281 | *.opt 282 | 283 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 284 | *.vbw 285 | 286 | # Visual Studio LightSwitch build output 287 | **/*.HTMLClient/GeneratedArtifacts 288 | **/*.DesktopClient/GeneratedArtifacts 289 | **/*.DesktopClient/ModelManifest.xml 290 | **/*.Server/GeneratedArtifacts 291 | **/*.Server/ModelManifest.xml 292 | _Pvt_Extensions 293 | 294 | # Paket dependency manager 295 | .paket/paket.exe 296 | paket-files/ 297 | 298 | # FAKE - F# Make 299 | .fake/ 300 | 301 | # CodeRush personal settings 302 | .cr/personal 303 | 304 | # Python Tools for Visual Studio (PTVS) 305 | __pycache__/ 306 | *.pyc 307 | 308 | # Cake - Uncomment if you are using it 309 | # tools/** 310 | # !tools/packages.config 311 | 312 | # Tabs Studio 313 | *.tss 314 | 315 | # Telerik's JustMock configuration file 316 | *.jmconfig 317 | 318 | # BizTalk build output 319 | *.btp.cs 320 | *.btm.cs 321 | *.odx.cs 322 | *.xsd.cs 323 | 324 | # OpenCover UI analysis results 325 | OpenCover/ 326 | 327 | # Azure Stream Analytics local run output 328 | ASALocalRun/ 329 | 330 | # MSBuild Binary and Structured Log 331 | *.binlog 332 | 333 | # NVidia Nsight GPU debugger configuration file 334 | *.nvuser 335 | 336 | # MFractors (Xamarin productivity tool) working folder 337 | .mfractor/ 338 | 339 | # Local History for Visual Studio 340 | .localhistory/ 341 | 342 | # BeatPulse healthcheck temp database 343 | healthchecksdb 344 | 345 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 346 | MigrationBackup/ 347 | 348 | # Ionide (cross platform F# VS Code tools) working folder 349 | .ionide/ 350 | 351 | # MemoryCaptures can get excessive in size. 352 | # They also could contain extremely sensitive data 353 | /[Mm]emoryCaptures/ 354 | 355 | # Asset meta data should only be ignored when the corresponding asset is also ignored 356 | !/[Aa]ssets/**/*.meta 357 | 358 | # Uncomment this line if you wish to ignore the asset store tools plugin 359 | # /[Aa]ssets/AssetStoreTools* 360 | 361 | # Autogenerated Jetbrains Rider plugin 362 | /[Aa]ssets/Plugins/Editor/JetBrains* 363 | 364 | # Visual Studio cache directory 365 | .vs/ 366 | 367 | # Gradle cache directory 368 | .gradle/ 369 | 370 | # Autogenerated VS/MD/Consulo solution and project files 371 | ExportedObj/ 372 | .consulo/ 373 | *.csproj 374 | *.unityproj 375 | *.sln 376 | *.suo 377 | *.tmp 378 | *.user 379 | *.userprefs 380 | *.pidb 381 | *.booproj 382 | *.svd 383 | *.pdb 384 | *.mdb 385 | *.opendb 386 | *.VC.db 387 | 388 | # Unity3D generated meta files 389 | *.pidb.meta 390 | *.pdb.meta 391 | *.mdb.meta 392 | 393 | # Unity3D generated file on crash reports 394 | sysinfo.txt 395 | 396 | # Builds 397 | *.apk 398 | *.aab 399 | *.unitypackage 400 | 401 | # Crashlytics generated file 402 | crashlytics-build.properties 403 | 404 | # Packed Addressables 405 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 406 | 407 | # Temporary auto-generated Android Assets 408 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 409 | /[Aa]ssets/[Ss]treamingAssets/aa/* -------------------------------------------------------------------------------- /Documentation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7dc173354a9d89409ec2c754265afa0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Documentation/copies_moving.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Documentation/copies_moving.gif -------------------------------------------------------------------------------- /Documentation/copies_moving.gif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ba5267f11c9a014cbb14f558d0de841 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Documentation/copies_spawning.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Documentation/copies_spawning.gif -------------------------------------------------------------------------------- /Documentation/copies_spawning.gif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d2e9bf034af7324bbd29e5cc3a9ddc3 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Documentation/moving_element.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Documentation/moving_element.gif -------------------------------------------------------------------------------- /Documentation/moving_element.gif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25cf3d01738b70144865ec531447194b 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Documentation/static_element.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Documentation/static_element.gif -------------------------------------------------------------------------------- /Documentation/static_element.gif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d417c0e769a00146b6bb6d457ed0ba4 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a2bd67db25aa7442905b16e5ae8cfed 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c959d29d25f16440a373fc3a5e49746 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Attributes/AbstractAttributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26ea1c6df5c6ae346884c2c1bdc72077 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Attributes/AbstractAttributes/ConditionalAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PixelRouge.Parallaxer.InspectorAttributes 4 | { 5 | /// 6 | /// Base class for comparison attributes. 7 | /// 8 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] 9 | public abstract class ConditionalAttribute : CustomAttribute 10 | { 11 | public string PropertyName = null; 12 | public System.Object TargetConditionValue = null; 13 | 14 | /// 15 | /// Comparison is true if 16 | /// is true. 17 | /// 18 | public ConditionalAttribute(string comparedPropertyName) 19 | { 20 | PropertyName = comparedPropertyName; 21 | TargetConditionValue = null; 22 | } 23 | 24 | /// 25 | /// Comparison is true if 26 | /// has a value of . 27 | /// 28 | public ConditionalAttribute(string comparedPropertyName, System.Object targetConditionValue) 29 | { 30 | PropertyName = comparedPropertyName; 31 | TargetConditionValue = targetConditionValue; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Editor/Attributes/AbstractAttributes/ConditionalAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f403d95430511ae4f811970c9f61873d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/AbstractAttributes/CustomAttribute.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace PixelRouge.Parallaxer.InspectorAttributes 4 | { 5 | [System.AttributeUsage(System.AttributeTargets.All, Inherited = false, AllowMultiple = true)] 6 | public abstract class CustomAttribute : PropertyAttribute 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Editor/Attributes/AbstractAttributes/CustomAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f2bfe0a9cbf1bc44892f3db9830e012 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/DisableInPlayModeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PixelRouge.Parallaxer.InspectorAttributes 4 | { 5 | /// 6 | /// Make the field read-only when the editor is in play mode. 7 | /// 8 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = true)] 9 | public sealed class DisableInPlayModeAttribute : CustomAttribute 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Editor/Attributes/DisableInPlayModeAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b7288060710ccc47aaf891c82b3ae6b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/HideIfAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace PixelRouge.Parallaxer.InspectorAttributes 2 | { 3 | /// 4 | /// Hides property if provided condition is met. 5 | /// 6 | public sealed class HideIfAttribute : ConditionalAttribute 7 | { 8 | /// 9 | /// Hides field if is true. 10 | /// 11 | public HideIfAttribute(string comparedPropertyName) : base(comparedPropertyName) 12 | { 13 | } 14 | 15 | /// 16 | /// Hides field if 17 | /// has a value of . 18 | /// 19 | public HideIfAttribute(string comparedPropertyName, object targetConditionValue) : base(comparedPropertyName, targetConditionValue) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Editor/Attributes/HideIfAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 379abc525791a5f44bee2acfdecd94ae 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/HideInPlayModeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PixelRouge.Parallaxer.InspectorAttributes 4 | { 5 | /// 6 | /// Hide the field if it is in Play Mode. 7 | /// 8 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] 9 | public sealed class HideInPlayModeAttribute : CustomAttribute 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Editor/Attributes/HideInPlayModeAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a901e44486498b4dba86b87192bc46a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/LeftToggleAttribute.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace PixelRouge.Parallaxer.InspectorAttributes 4 | { 5 | /// 6 | /// Set the boolean checkbox at the left of the field's label. 7 | /// 8 | public sealed class LeftToggleAttribute : PropertyAttribute 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Editor/Attributes/LeftToggleAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1552ca3efff305c46a8b5bfca63247d8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/ReadOnlyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | /// 7 | /// Prevent a serialized field from being edited in inspector. 8 | /// 9 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] 10 | public sealed class ReadOnlyAttribute : PropertyAttribute 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /Editor/Attributes/ReadOnlyAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee698ada0a0941e4c8b6286ab2043076 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/ShowIfAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace PixelRouge.Parallaxer.InspectorAttributes 2 | { 3 | /// 4 | /// Shows property if provided condition is met. 5 | /// 6 | public sealed class ShowIfAttribute : ConditionalAttribute 7 | { 8 | /// 9 | /// Shows field if is true. 10 | /// 11 | public ShowIfAttribute(string comparedPropertyName) : base(comparedPropertyName) 12 | { 13 | } 14 | 15 | /// 16 | /// Shows field if 17 | /// has a value of . 18 | /// 19 | public ShowIfAttribute(string comparedPropertyName, object targetConditionValue) : base(comparedPropertyName, targetConditionValue) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Editor/Attributes/ShowIfAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 088042769c8412d4dbcd8f84b32c3341 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Attributes/ShowInPlayModeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using System; 6 | 7 | namespace PixelRouge.Parallaxer.InspectorAttributes 8 | { 9 | /// 10 | /// Show the field only if it is in Play Mode. 11 | /// 12 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] 13 | public sealed class ShowInPlayModeAttribute : CustomAttribute 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Editor/Attributes/ShowInPlayModeAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a4ce4049ca662640ad76cf566b87eda 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 822c85b069cbec2469663225c626bac2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Drawers/AbstractDrawers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b92a28e9f0c2c448a4a98268739ccc8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Drawers/AbstractDrawers/BasePropertyDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Reflection; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.IO; 7 | using System; 8 | using PixelRouge.Parallaxer.Extensions; 9 | 10 | namespace PixelRouge.Parallaxer.InspectorAttributes 11 | { 12 | public abstract class BasePropertyDrawer: PropertyDrawer 13 | { 14 | public virtual float GetHelpBoxHeight() 15 | { 16 | return EditorGUIUtility.singleLineHeight * 2.0f; 17 | } 18 | 19 | protected void DrawProperty(Rect position, SerializedProperty property, GUIContent label) 20 | { 21 | // Property is hidden, no need to draw. 22 | if (IsHidden(property)) 23 | return; 24 | 25 | // If has Label and/or Icon attributes, return label value with them added in. 26 | label = AddLabelAttributes(property, label); 27 | 28 | // Disable property if it should. 29 | if (HasDisablingAttribute(property)) 30 | EditorGUI.BeginDisabledGroup(true); 31 | 32 | // Check for special cases for drawing, if none are met, draw field as simple as possible. 33 | if (property.GetAttribute() != null) 34 | DrawFieldWithToggleOnTheLeft(position, property, label); 35 | else 36 | DrawPropertySimple(position, property, label); 37 | 38 | // Restore GUI status if field was disabled. 39 | if (HasDisablingAttribute(property)) 40 | EditorGUI.EndDisabledGroup(); 41 | } 42 | 43 | protected void DrawErrorMessage(Rect position, string errorMessage) 44 | { 45 | var padding = EditorGUIUtility.standardVerticalSpacing; 46 | 47 | var highlightRect = new Rect(position.x - padding, position.y - padding, 48 | position.width + (padding * 2), position.height + (padding * 2)); 49 | 50 | EditorGUI.DrawRect(highlightRect, Color.red); 51 | 52 | var contentColor = GUI.contentColor; 53 | GUI.contentColor = Color.white; 54 | EditorGUI.LabelField(position, errorMessage); 55 | GUI.contentColor = contentColor; 56 | } 57 | 58 | protected void DrawFieldWithToggleOnTheLeft(Rect position, SerializedProperty property, GUIContent label) 59 | { 60 | if (property.propertyType != SerializedPropertyType.Boolean) 61 | { 62 | var message = "ERROR! Not a boolean field."; 63 | DrawErrorMessage(position, message); 64 | return; 65 | } 66 | 67 | label = EditorGUI.BeginProperty(position, label, property); 68 | EditorGUI.BeginChangeCheck(); 69 | var value = EditorGUI.ToggleLeft(position, label, property.boolValue); 70 | 71 | if (EditorGUI.EndChangeCheck()) 72 | property.boolValue = value; 73 | 74 | EditorGUI.EndProperty(); 75 | } 76 | 77 | protected Texture2D FindIcon(string iconPath) 78 | { 79 | var path = Path.Combine(Application.dataPath, iconPath); 80 | var image = File.ReadAllBytes(path); 81 | 82 | if (image == null) 83 | return null; 84 | 85 | var iconTexture = new Texture2D(1, 1); 86 | iconTexture.LoadImage(image); 87 | iconTexture.name = "PrefabIcon"; 88 | iconTexture.Apply(); 89 | return iconTexture; 90 | } 91 | 92 | protected void DrawPropertySimple(Rect position, SerializedProperty property, GUIContent label) 93 | { 94 | EditorGUI.PropertyField(position, property, label, property.isExpanded); 95 | } 96 | 97 | protected void DrawEnumFlagsField(Rect position, SerializedProperty property, GUIContent label) 98 | { 99 | Enum targetEnum = property.GetTargetObjectOfProperty() as Enum; 100 | 101 | if (targetEnum == null) 102 | { 103 | var message = "ERROR! EnumFlags attribute can only be used on enums."; 104 | DrawErrorMessage(position, message); 105 | return; 106 | } 107 | 108 | EditorGUI.BeginProperty(position, label, property); 109 | Enum updatedEnum = EditorGUI.EnumFlagsField(position, label.text, targetEnum); 110 | property.intValue = (int) Convert.ChangeType(updatedEnum, targetEnum.GetType()); 111 | EditorGUI.EndProperty(); 112 | property.serializedObject.ApplyModifiedProperties(); 113 | } 114 | 115 | protected void ShowNullFieldWarning(SerializedProperty property, string fieldName) 116 | { 117 | if (property.propertyType != SerializedPropertyType.ObjectReference) 118 | return; 119 | 120 | if (property.objectReferenceValue != null) 121 | return; 122 | 123 | EditorGUILayout.HelpBox($"The value of the field \"{fieldName}\" cannot be null.", MessageType.Error); 124 | } 125 | 126 | private bool HasDisablingAttribute(SerializedProperty property) 127 | { 128 | var readonlyAttribute = property.GetAttribute(); 129 | 130 | if (readonlyAttribute != null) 131 | return true; 132 | 133 | var disablePlayModeAttribute = property.GetAttribute(); 134 | 135 | if ((disablePlayModeAttribute != null) && (Application.isPlaying)) 136 | return true; 137 | 138 | return false; 139 | } 140 | 141 | private bool IsHidden(SerializedProperty property) 142 | { 143 | var hideInPlayModeAttribute = property.GetAttribute(); 144 | 145 | if ((hideInPlayModeAttribute != null) && (Application.isPlaying)) 146 | return true; 147 | 148 | return false; 149 | } 150 | 151 | private GUIContent AddLabelAttributes(SerializedProperty property, GUIContent label) 152 | { 153 | return label; 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /Editor/Drawers/AbstractDrawers/BasePropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df904efe79c75804486ae6b01fcfabb4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/AbstractDrawers/ConditionalAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | using System.Reflection; 4 | using PixelRouge.Parallaxer.Extensions; 5 | 6 | namespace PixelRouge.Parallaxer.InspectorAttributes 7 | { 8 | public abstract class ConditionalAttributeDrawer : BasePropertyDrawer 9 | { 10 | public enum PropertyDrawing 11 | { 12 | Show, Hide, Disable, Enable 13 | } 14 | 15 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 16 | { 17 | PropertyDrawing drawing = GetPropertyDrawing(); 18 | 19 | if (IsComparisonValid(property)) 20 | { 21 | switch (drawing) 22 | { 23 | case PropertyDrawing.Show: 24 | DrawProperty(position, property, label); 25 | break; 26 | case PropertyDrawing.Hide: 27 | break; 28 | case PropertyDrawing.Enable: 29 | GUI.enabled = true; 30 | DrawProperty(position, property, label); 31 | break; 32 | case PropertyDrawing.Disable: 33 | GUI.enabled = false; 34 | DrawProperty(position, property, label); 35 | GUI.enabled = true; 36 | break; 37 | default: 38 | throw new System.ArgumentOutOfRangeException(); 39 | } 40 | } 41 | else 42 | { 43 | switch (drawing) 44 | { 45 | case PropertyDrawing.Show: 46 | break; 47 | case PropertyDrawing.Hide: 48 | DrawProperty(position, property, label); 49 | break; 50 | case PropertyDrawing.Enable: 51 | GUI.enabled = false; 52 | DrawProperty(position, property, label); 53 | GUI.enabled = true; 54 | break; 55 | case PropertyDrawing.Disable: 56 | GUI.enabled = true; 57 | DrawProperty(position, property, label); 58 | break; 59 | default: 60 | throw new System.ArgumentOutOfRangeException(); 61 | } 62 | } 63 | } 64 | 65 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 66 | { 67 | if (IsComparisonValid(property)) 68 | { 69 | if (GetPropertyDrawing() == PropertyDrawing.Hide) 70 | return 0f; 71 | } 72 | else 73 | { 74 | if (GetPropertyDrawing() == PropertyDrawing.Show) 75 | return 0f; 76 | } 77 | 78 | return base.GetPropertyHeight(property, label); 79 | } 80 | 81 | protected abstract PropertyDrawing GetPropertyDrawing(); 82 | 83 | private bool IsComparisonValid(SerializedProperty property) 84 | { 85 | System.Object objectInstance = property.GetTargetObjectWithProperty(); 86 | var comparisonAttribute = attribute as ConditionalAttribute; 87 | FieldInfo field = objectInstance.GetField(comparisonAttribute.PropertyName); 88 | PropertyInfo nonSerializedMember = objectInstance.GetProperty(comparisonAttribute.PropertyName); 89 | 90 | var objectValue = field != null ? field.GetValue(objectInstance) : 91 | nonSerializedMember.GetValue(objectInstance); 92 | 93 | if (!objectValue.ToBool(out bool memberValue)) 94 | Debug.LogError($"Value {objectValue} is not a boolean"); 95 | 96 | if (comparisonAttribute.TargetConditionValue == null) 97 | return memberValue; 98 | 99 | if (!comparisonAttribute.TargetConditionValue.ToBool(out bool targetConditionValue)) 100 | Debug.LogError($"Value {comparisonAttribute.TargetConditionValue} is not a boolean"); 101 | 102 | return memberValue == targetConditionValue; 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /Editor/Drawers/AbstractDrawers/ConditionalAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bef743365c4ad6248b6dda0dd4db6bb6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/DisableInPlayModeAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | [CustomPropertyDrawer(typeof(DisableInPlayModeAttribute))] 7 | public class DisableInPlayModeAttributeDrawer : BasePropertyDrawer 8 | { 9 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 10 | { 11 | return EditorGUI.GetPropertyHeight(property, label, true); 12 | } 13 | 14 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 15 | { 16 | DrawProperty(position, property, label); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Editor/Drawers/DisableInPlayModeAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33379e8e5ea46704caf695b33a1e276e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/HideIfAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | [CustomPropertyDrawer(typeof(HideIfAttribute))] 7 | public class HideIfAttributeDrawer : ConditionalAttributeDrawer 8 | { 9 | protected override PropertyDrawing GetPropertyDrawing() 10 | { 11 | return PropertyDrawing.Hide; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Editor/Drawers/HideIfAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ebd114b86b28004fb3e7f4fc64736a4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/HideInPlayModeAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | [CustomPropertyDrawer(typeof(HideInPlayModeAttribute))] 7 | public class HideInPlayModeAttributeDrawer : BasePropertyDrawer 8 | { 9 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 10 | { 11 | if (Application.isPlaying) 12 | return 0f; 13 | 14 | return base.GetPropertyHeight(property, label); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Editor/Drawers/HideInPlayModeAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fccfe4a393c233c4fb335c84aa813417 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/LeftToggleAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | [CustomPropertyDrawer(typeof(LeftToggleAttribute))] 7 | public class LeftToggleAttributeDrawer : BasePropertyDrawer 8 | { 9 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 10 | { 11 | DrawFieldWithToggleOnTheLeft(position, property, label); 12 | } 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /Editor/Drawers/LeftToggleAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cfa930dc6413904c979b1500c4fb657 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/ReadOnlyAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | [CustomPropertyDrawer(typeof(ReadOnlyAttribute))] 7 | public class ReadOnlyAttributeDrawer : BasePropertyDrawer 8 | { 9 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 10 | { 11 | EditorGUI.BeginDisabledGroup(true); 12 | EditorGUI.PropertyField(position, property, label, property.isExpanded); 13 | EditorGUI.EndDisabledGroup(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Editor/Drawers/ReadOnlyAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0517013c90054fb4d9a858043b8f26e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/ShowIfAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | [CustomPropertyDrawer(typeof(ShowIfAttribute))] 7 | public class ShowIfAttributeDrawer : ConditionalAttributeDrawer 8 | { 9 | protected override PropertyDrawing GetPropertyDrawing() 10 | { 11 | return PropertyDrawing.Show; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Editor/Drawers/ShowIfAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e098c28e1a1bf343a60b3be3c4573de 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Drawers/ShowInPlayModeAttributeDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace PixelRouge.Parallaxer.InspectorAttributes 5 | { 6 | [CustomPropertyDrawer(typeof(ShowInPlayModeAttribute))] 7 | public class ShowInPlayModeAttributeDrawer : BasePropertyDrawer 8 | { 9 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 10 | { 11 | if (!Application.isPlaying) 12 | { 13 | return 0f; 14 | } 15 | 16 | return base.GetPropertyHeight(property, label); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Editor/Drawers/ShowInPlayModeAttributeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8753a18a1dadb674b905c68843be47b1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20cc5a9b470a25948a05efdc6dde1083 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Extensions/ObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace PixelRouge.Parallaxer.Extensions 2 | { 3 | public static class ObjectExtensions 4 | { 5 | public static bool ToBool(this System.Object self, out bool result) 6 | { 7 | result = false; 8 | 9 | if (self == null) 10 | return false; 11 | 12 | if (self is bool value) 13 | { 14 | result = value; 15 | return true; 16 | } 17 | 18 | return false; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Editor/Extensions/ObjectExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fd5ccbc9e9b9864d838e4353cc57220 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Extensions/ObjectReflectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using System.Linq; 6 | 7 | namespace PixelRouge.Parallaxer.Extensions 8 | { 9 | public static class ObjectReflectionExtensions 10 | { 11 | private static BindingFlags StandardFlags = BindingFlags.Instance | 12 | BindingFlags.Static | 13 | BindingFlags.NonPublic | 14 | BindingFlags.Public; 15 | 16 | public static IEnumerable GetAllFields(this object self, Func predicate) 17 | { 18 | if (self == null) 19 | { 20 | Debug.LogError("The target object is null. Check for missing scripts."); 21 | yield break; 22 | } 23 | 24 | List types = new List() 25 | { 26 | self.GetType() 27 | }; 28 | 29 | while (types.Last().BaseType != null) 30 | { 31 | types.Add(types.Last().BaseType); 32 | } 33 | 34 | for (int i = types.Count - 1; i >= 0; i--) 35 | { 36 | IEnumerable fieldInfos = types[i] 37 | .GetFields(StandardFlags) 38 | .Where(predicate); 39 | 40 | foreach (var fieldInfo in fieldInfos) 41 | { 42 | yield return fieldInfo; 43 | } 44 | } 45 | } 46 | 47 | public static IEnumerable GetAllProperties(this object self, Func predicate) 48 | { 49 | if (self == null) 50 | { 51 | Debug.LogError("The target object is null. Check for missing scripts."); 52 | yield break; 53 | } 54 | 55 | List types = new List() 56 | { 57 | self.GetType() 58 | }; 59 | 60 | while (types.Last().BaseType != null) 61 | { 62 | types.Add(types.Last().BaseType); 63 | } 64 | 65 | for (int i = types.Count - 1; i >= 0; i--) 66 | { 67 | IEnumerable propertyInfos = types[i] 68 | .GetProperties(StandardFlags) 69 | .Where(predicate); 70 | 71 | foreach (var propertyInfo in propertyInfos) 72 | { 73 | yield return propertyInfo; 74 | } 75 | } 76 | } 77 | 78 | public static IEnumerable GetAllMethods(this object self) 79 | { 80 | if (self == null) 81 | { 82 | Debug.LogError("The target object is null. Check for missing scripts."); 83 | return null; 84 | } 85 | 86 | IEnumerable methodInfos = self.GetType() 87 | .GetMethods(StandardFlags); 88 | 89 | return methodInfos; 90 | } 91 | 92 | public static IEnumerable GetAllMethods(this object self, Func predicate) 93 | { 94 | if (self == null) 95 | { 96 | Debug.LogError("The target object is null. Check for missing scripts."); 97 | return null; 98 | } 99 | 100 | IEnumerable methodInfos = self.GetType() 101 | .GetMethods(StandardFlags) 102 | .Where(predicate); 103 | 104 | return methodInfos; 105 | } 106 | 107 | public static FieldInfo GetField(this object self, string fieldName) 108 | { 109 | return GetAllFields(self, f => f.Name.Equals(fieldName, StringComparison.InvariantCulture)).FirstOrDefault(); 110 | } 111 | 112 | public static PropertyInfo GetProperty(this object self, string propertyName) 113 | { 114 | return GetAllProperties(self, p => p.Name.Equals(propertyName, StringComparison.InvariantCulture)).FirstOrDefault(); 115 | } 116 | 117 | public static MethodInfo GetMethod(this object self, string methodName) 118 | { 119 | return GetAllMethods(self, m => m.Name.Equals(methodName, StringComparison.InvariantCulture)).FirstOrDefault(); 120 | } 121 | 122 | public static bool GetConditionValue(this object self, string validationPropertyName) 123 | { 124 | var conditionField = self.GetField(validationPropertyName); 125 | 126 | if ((conditionField != null) && (conditionField.FieldType == typeof(bool))) 127 | { 128 | return (bool) conditionField.GetValue(self); 129 | } 130 | 131 | var conditionProperty = self.GetProperty(validationPropertyName); 132 | 133 | if ((conditionProperty != null) && (conditionProperty.PropertyType == typeof(bool))) 134 | { 135 | return (bool) conditionProperty.GetValue(self); 136 | } 137 | 138 | var conditionMethod = self.GetMethod(validationPropertyName); 139 | 140 | if ((conditionMethod != null) && (conditionMethod.ReturnType == typeof(bool)) && 141 | (conditionMethod.GetParameters().Length == 0)) 142 | { 143 | return (bool) conditionMethod.Invoke(self, null); 144 | } 145 | 146 | return false; 147 | } 148 | } 149 | } -------------------------------------------------------------------------------- /Editor/Extensions/ObjectReflectionExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9e727a2008167c4494e4776fc41fdb3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Extensions/SerializedPropertyExtensions.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using System; 3 | using System.Linq; 4 | using System.Reflection; 5 | using PixelRouge.Parallaxer.InspectorAttributes.Utilities; 6 | 7 | #if UNITY_EDITOR 8 | 9 | namespace PixelRouge.Parallaxer.Extensions 10 | { 11 | public static class SerializedPropertyExtensions 12 | { 13 | private delegate FieldInfo GetFieldInfoAndStaticTypeFromProperty(SerializedProperty aProperty, out Type aType); 14 | 15 | private static GetFieldInfoAndStaticTypeFromProperty m_GetFieldInfoAndStaticTypeFromProperty; 16 | 17 | #region Extensions 18 | 19 | // Author: github.com/arimger 20 | public static SerializedProperty GetSibiling(this SerializedProperty self, string propertyPath) 21 | { 22 | return self.depth == 0 || self.GetParent() == null 23 | ? self.serializedObject.FindProperty(propertyPath) 24 | : self.GetParent().FindPropertyRelative(propertyPath); 25 | } 26 | 27 | // Author: github.com/arimger 28 | public static SerializedProperty GetParent(this SerializedProperty self) 29 | { 30 | if (self.depth == 0) 31 | { 32 | return null; 33 | } 34 | 35 | var path = self.propertyPath.Replace(".Array.data[", "["); 36 | var elements = path.Split('.'); 37 | 38 | SerializedProperty parent = null; 39 | 40 | for (var i = 0; i < elements.Length - 1; i++) 41 | { 42 | var element = elements[i]; 43 | var index = -1; 44 | if (element.Contains("[")) 45 | { 46 | index = Convert.ToInt32(element 47 | .Substring(element.IndexOf("[", StringComparison.Ordinal)) 48 | .Replace("[", "").Replace("]", "")); 49 | element = element 50 | .Substring(0, element.IndexOf("[", StringComparison.Ordinal)); 51 | } 52 | 53 | parent = i == 0 ? self.serializedObject.FindProperty(element) : parent.FindPropertyRelative(element); 54 | 55 | if (index >= 0) parent = parent.GetArrayElementAtIndex(index); 56 | } 57 | 58 | return parent; 59 | } 60 | 61 | // Author: github.com/lordofduct 62 | /// 63 | /// Gets the object that the property is a member of 64 | /// 65 | /// 66 | /// 67 | public static object GetTargetObjectWithProperty(this SerializedProperty self) 68 | { 69 | string path = self.propertyPath.Replace(".Array.data[", "["); 70 | object obj = self.serializedObject.targetObject; 71 | string[] elements = path.Split('.'); 72 | 73 | for (int i = 0; i < elements.Length - 1; i++) 74 | { 75 | string element = elements[i]; 76 | if (element.Contains("[")) 77 | { 78 | string elementName = element.Substring(0, element.IndexOf("[")); 79 | int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); 80 | obj = HelperMethods.GetValue_Imp(obj, elementName, index); 81 | } 82 | else 83 | { 84 | obj = HelperMethods.GetValue_Imp(obj, element); 85 | } 86 | } 87 | 88 | return obj; 89 | } 90 | 91 | // Author: github.com/lordofduct 92 | /// 93 | /// Gets the object the property represents. 94 | /// 95 | /// 96 | /// 97 | public static object GetTargetObjectOfProperty(this SerializedProperty self) 98 | { 99 | if (self == null) 100 | { 101 | return null; 102 | } 103 | 104 | string path = self.propertyPath.Replace(".Array.data[", "["); 105 | object obj = self.serializedObject.targetObject; 106 | string[] elements = path.Split('.'); 107 | 108 | foreach (var element in elements) 109 | { 110 | if (element.Contains("[")) 111 | { 112 | string elementName = element.Substring(0, element.IndexOf("[")); 113 | int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); 114 | obj = HelperMethods.GetValue_Imp(obj, elementName, index); 115 | } 116 | else 117 | { 118 | obj = HelperMethods.GetValue_Imp(obj, element); 119 | } 120 | } 121 | 122 | return obj; 123 | } 124 | 125 | public static Type GetPropertyType(this SerializedProperty self) 126 | { 127 | Type parentType = self.GetTargetObjectWithProperty().GetType(); 128 | FieldInfo fieldInfo = parentType.GetField(self.name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); 129 | 130 | return fieldInfo.FieldType; 131 | } 132 | 133 | // Origin: https://forum.unity.com/threads/get-a-general-object-value-from-serializedproperty.327098/ 134 | public static FieldInfo GetFieldInfoAndStaticType(this SerializedProperty self, out Type type) 135 | { 136 | if (m_GetFieldInfoAndStaticTypeFromProperty == null) 137 | { 138 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) 139 | { 140 | foreach (var t in assembly.GetTypes()) 141 | { 142 | if (t.Name == "ScriptAttributeUtility") 143 | { 144 | MethodInfo mi = t.GetMethod("GetFieldInfoAndStaticTypeFromProperty", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); 145 | m_GetFieldInfoAndStaticTypeFromProperty = (GetFieldInfoAndStaticTypeFromProperty)Delegate.CreateDelegate(typeof(GetFieldInfoAndStaticTypeFromProperty), mi); 146 | break; 147 | } 148 | } 149 | if (m_GetFieldInfoAndStaticTypeFromProperty != null) break; 150 | } 151 | if (m_GetFieldInfoAndStaticTypeFromProperty == null) 152 | { 153 | UnityEngine.Debug.LogError("GetFieldInfoAndStaticType::Reflection failed!"); 154 | type = null; 155 | return null; 156 | } 157 | } 158 | return m_GetFieldInfoAndStaticTypeFromProperty(self, out type); 159 | } 160 | 161 | public static T GetAttribute(this SerializedProperty self) where T : class 162 | { 163 | return self.GetAttributes()?.FirstOrDefault(); 164 | } 165 | 166 | public static T[] GetAttributes(this SerializedProperty self) where T : class 167 | { 168 | var targetObj = self.GetTargetObjectWithProperty(); 169 | FieldInfo targetField = targetObj.GetField(self.name); 170 | 171 | if (targetField == null) 172 | return null; 173 | 174 | return (T[])targetField.GetCustomAttributes(typeof(T), true); 175 | } 176 | 177 | #endregion 178 | 179 | #region Helper methods 180 | 181 | #endregion 182 | } 183 | } 184 | #endif -------------------------------------------------------------------------------- /Editor/Extensions/SerializedPropertyExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cdf99a4865041c847826c76d300d7091 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | using System; 3 | 4 | namespace PixelRouge.Parallaxer.Extensions 5 | { 6 | public static class StringExtensions 7 | { 8 | // Author: Vermillion Vanguard Studio 9 | public static string ToTitleCase(this string self) 10 | { 11 | // Add spaces. 12 | string output = Regex.Replace(self, @"[A-Z]", " $0"); 13 | 14 | output = output.RemoveFirstUnderscore(); 15 | output = output.ReplaceUnderscoresWithSpaces(); 16 | return output.CapitalizeFirstLetter(); 17 | } 18 | 19 | // Author: Vermillion Vanguard Studio 20 | public static string ToSentenceCase(this string self) 21 | { 22 | // Add spaces and uncapitalize the following letter. 23 | string output = Regex.Replace(self, @"[A-Z]", " $0").ToLower(); 24 | 25 | output = output.RemoveFirstUnderscore(); 26 | output = output.ReplaceUnderscoresWithSpaces(); 27 | return output.CapitalizeFirstLetter(); 28 | } 29 | 30 | // Author: Vermillion Vanguard Studio 31 | private static string CapitalizeFirstLetter(this string self) 32 | { 33 | if (self.Length < 2) 34 | throw new IndexOutOfRangeException(); 35 | 36 | return char.ToUpperInvariant(self[0]) + self.Substring(1); 37 | } 38 | 39 | // Author: Vermillion Vanguard Studio 40 | private static string RemoveFirstUnderscore(this string self) 41 | { 42 | if (self.Length < 2) 43 | throw new IndexOutOfRangeException(); 44 | 45 | if (self[0] == '_') 46 | return self.Substring(1); 47 | 48 | return self; 49 | } 50 | 51 | // Author: Vermillion Vanguard Studio 52 | private static string ReplaceUnderscoresWithSpaces(this string self) 53 | { 54 | return self.Replace('_', ' '); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Editor/Extensions/StringExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc6a1ae5490938345b3ef6fc208796f9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Extensions/SystemTypeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PixelRouge.Parallaxer.Extensions 4 | { 5 | public static class SystemTypeExtensions 6 | { 7 | public static Type GetListElementType(this Type self) 8 | { 9 | if (self.IsGenericType) 10 | return self.GetGenericArguments()[0]; 11 | else 12 | return self.GetElementType(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Editor/Extensions/SystemTypeExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03a56e23dfc435642a02db0fbd822cd1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/HelperMethods.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f2b11f2b1c3b6a439a5b47613f94a0b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/HelperMethods/EditorUtil.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Reflection; 6 | using UnityEditor; 7 | using UnityEngine; 8 | using PixelRouge.Parallaxer.Extensions; 9 | 10 | namespace PixelRouge.Parallaxer.InspectorAttributes.Utilities 11 | { 12 | public static class EditorUtil 13 | { 14 | public static bool IsButtonVisible(UnityEngine.Object target, MethodInfo method) 15 | { 16 | var showIfAttribute = Attribute.GetCustomAttribute(method, typeof(ShowIfAttribute)) as ShowIfAttribute; 17 | 18 | if (showIfAttribute == null) 19 | { 20 | return true; 21 | } 22 | 23 | if (showIfAttribute != null) 24 | { 25 | bool showingCondition = true; 26 | 27 | if (showIfAttribute.TargetConditionValue != null) 28 | { 29 | var hasCondition = showIfAttribute.TargetConditionValue.ToBool(out bool conditionValue); 30 | showingCondition = !hasCondition || conditionValue; 31 | } 32 | 33 | var fieldValue = (bool) target.GetField(showIfAttribute.PropertyName).GetValue(target); 34 | 35 | if (showingCondition == fieldValue) 36 | return true; 37 | } 38 | 39 | return false; 40 | } 41 | 42 | public static List GetConditionValues(object target, string[] conditions) 43 | { 44 | List conditionValues = new List(); 45 | 46 | foreach (var condition in conditions) 47 | { 48 | FieldInfo conditionField = target.GetField(condition); 49 | if (conditionField != null && 50 | conditionField.FieldType == typeof(bool)) 51 | { 52 | conditionValues.Add((bool)conditionField.GetValue(target)); 53 | } 54 | 55 | PropertyInfo conditionProperty = target.GetProperty(condition); 56 | if (conditionProperty != null && 57 | conditionProperty.PropertyType == typeof(bool)) 58 | { 59 | conditionValues.Add((bool)conditionProperty.GetValue(target)); 60 | } 61 | 62 | MethodInfo conditionMethod = target.GetMethod(condition); 63 | if (conditionMethod != null && 64 | conditionMethod.ReturnType == typeof(bool) && 65 | conditionMethod.GetParameters().Length == 0) 66 | { 67 | conditionValues.Add((bool)conditionMethod.Invoke(target, null)); 68 | } 69 | } 70 | 71 | return conditionValues; 72 | } 73 | 74 | public static bool GetConditionsFlag(List conditionValues) 75 | { 76 | bool flag = false; 77 | 78 | foreach (var value in conditionValues) 79 | { 80 | flag = flag && value; 81 | } 82 | 83 | return flag; 84 | } 85 | } 86 | } 87 | #endif -------------------------------------------------------------------------------- /Editor/HelperMethods/EditorUtil.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7928e119c2fa5a240b4e94799d27df61 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/HelperMethods/HelperMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using UnityEditor; 6 | using UnityEngine; 7 | 8 | namespace PixelRouge.Parallaxer.InspectorAttributes.Utilities 9 | { 10 | public class HelperMethods 11 | { 12 | // Author: github.com/lordofduct 13 | public static object GetValue_Imp(object obj, string name) 14 | { 15 | if (obj == null) 16 | return null; 17 | var type = obj.GetType(); 18 | 19 | while (type != null) 20 | { 21 | var f = type.GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); 22 | if (f != null) 23 | return f.GetValue(obj); 24 | 25 | var p = type.GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); 26 | if (p != null) 27 | return p.GetValue(obj, null); 28 | 29 | type = type.BaseType; 30 | } 31 | return null; 32 | } 33 | 34 | // Author: github.com/lordofduct 35 | public static object GetValue_Imp(object obj, string name, int index) 36 | { 37 | var enumerable = GetValue_Imp(obj, name) as System.Collections.IEnumerable; 38 | if (enumerable == null) return null; 39 | var enm = enumerable.GetEnumerator(); 40 | //while (index-- >= 0) 41 | // enm.MoveNext(); 42 | //return enm.Current; 43 | 44 | for (int i = 0; i <= index; i++) 45 | { 46 | if (!enm.MoveNext()) return null; 47 | } 48 | return enm.Current; 49 | } 50 | 51 | public static Type GetListElementType(Type listType) 52 | { 53 | if (listType.IsGenericType) 54 | { 55 | return listType.GetGenericArguments()[0]; 56 | } 57 | else 58 | { 59 | return listType.GetElementType(); 60 | } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Editor/HelperMethods/HelperMethods.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7760a9e3efcb6f442b32736c5fdda445 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/com.pixelrouge.parallaxersystemforunity.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.pixelrouge.parallaxersystemforunity.Editor", 3 | "references": [], 4 | "includePlatforms": [ 5 | "Editor" 6 | ], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } -------------------------------------------------------------------------------- /Editor/com.pixelrouge.parallaxersystemforunity.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79a1fe10f4e06354dbd2dcf1bb901266 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Pixel Rouge Studio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6fe8ee56928a204a8b9248e2ddcc565 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Parallaxer 2 | 3 | A parallax system created to speed up parallax effects implementation in Unity projects. 4 | 5 | ## Installing 6 | 7 | ### Using git 8 | 9 | - Open the Package Manager window 10 | - Click on the "plus" sign 11 | - Select "Add package from git URL" 12 | - Paste this repo's SSH link (:PixelRubro/ParallaxerSystemForUnity.git) 13 | 14 | ### Editing manifest file 15 | 16 | Add the following line to your `manifest.json` found in the "Packages" folder 17 | 18 | `"com.pixelrouge.parallaxersystemforunity": "git@github.com:PixelRubro/ParallaxerSystemForUnity.git"` 19 | 20 | ## How does this work? 21 | 22 | The main tool in this asset is the ParallaxExpansibleElement, which will move copies of itself around 23 | while following the camera at a relative speed set by the player. 24 | 25 | In this case, the first step taken is to create copies of the element: 26 | 27 | [GIF](https://github.com/PixelSparkStudio/Parallaxer/blob/main/Documentation/copies_spawning.gif) 28 | 29 | Those copies will be then moved around if the camera attempts to exit the area covered with the copies: 30 | 31 | [GIF](https://github.com/PixelSparkStudio/Parallaxer/blob/main/Documentation/copies_moving.gif) 32 | 33 | There's also a moving element, the ParallaxMovingElement, which moves to direction with a speed, while also following the camera movement. 34 | 35 | This element is also able to respawn itself at the opposite side of the screen as soon as its movement takes it outside of the view: 36 | 37 | [GIF](https://github.com/PixelSparkStudio/Parallaxer/blob/main/Documentation/moving_element.gif) 38 | 39 | The last element of this list is the static element, the ParallaxStaticElement, which will keep following the target camera with no offset: 40 | 41 | [GIF](https://github.com/PixelSparkStudio/Parallaxer/blob/main/Documentation/static_element.gif) 42 | 43 | ## Cool! How do I use it? 44 | 45 | - First, create an object which will parent all the parallax elements and add a ParallaxManager component to it 46 | - Then, add your parallax elements as children of the ParallaxManager object, setting the sprites sorting orders accordingly 47 | - Set the speed of each parallax element as you wish 48 | - That's it! No additional coding needed! 49 | 50 | If you still have doubts, check the demo scene in the "Samples" folder. 51 | 52 | ## Why can't I open the demo scene? 53 | 54 | This is a limitation known by the Unity team. Until they look at it, you will have to drag the scene file into somewhere in your "Assets" folder. 55 | 56 | Graphic assets made by Kenney: 57 | 58 | - 59 | - 60 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 663305168539531489a1e912bcbae6cc 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 819f7275c09169f4c96aa4a44ff6280b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Helpers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 955fc609b758998448f3c1bba4c96247 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Helpers/Direction.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace PixelRouge.Parallaxer.Helpers 4 | { 5 | public enum EDirection 6 | { 7 | Up, Down, Right, Left, Forward, Backward, None 8 | } 9 | 10 | public class Direction 11 | { 12 | public static EDirection FlipDirection(EDirection direction) 13 | { 14 | switch (direction) 15 | { 16 | case EDirection.Right: 17 | return EDirection.Left; 18 | case EDirection.Left: 19 | return EDirection.Right; 20 | case EDirection.Up: 21 | return EDirection.Down; 22 | case EDirection.Down: 23 | return EDirection.Up; 24 | case EDirection.Forward: 25 | return EDirection.Backward; 26 | case EDirection.Backward: 27 | return EDirection.Forward; 28 | default: 29 | return EDirection.None; 30 | } 31 | } 32 | 33 | public static bool IsHorizontal(EDirection direction) 34 | { 35 | return (direction == EDirection.Right) || (direction == EDirection.Left); 36 | } 37 | 38 | public static bool IsVertical(EDirection direction) 39 | { 40 | return (direction == EDirection.Up) || (direction == EDirection.Down); 41 | } 42 | 43 | public static Vector2 ToVector2(EDirection direction) 44 | { 45 | switch (direction) 46 | { 47 | case EDirection.Right: 48 | return Vector2.right; 49 | case EDirection.Left: 50 | return Vector2.left; 51 | case EDirection.Up: 52 | return Vector2.up; 53 | case EDirection.Down: 54 | return Vector2.down; 55 | default: 56 | return Vector2.zero; 57 | } 58 | } 59 | 60 | public static Vector3 ToVector3(EDirection direction) 61 | { 62 | switch (direction) 63 | { 64 | case EDirection.Right: 65 | return Vector3.right; 66 | case EDirection.Left: 67 | return Vector3.left; 68 | case EDirection.Up: 69 | return Vector3.up; 70 | case EDirection.Down: 71 | return Vector3.down; 72 | case EDirection.Forward: 73 | return Vector3.forward; 74 | case EDirection.Backward: 75 | return Vector3.back; 76 | default: 77 | return Vector3.zero; 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Runtime/Helpers/Direction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e83e56f11e75d7d4c9ba5624eb89dd54 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Helpers/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace PixelRouge.Parallaxer.Helpers 6 | { 7 | public static class Extensions 8 | { 9 | // Author: Phillip Pierce (Adapted) 10 | /// 11 | /// Returns true if game object's layer is present in the given layer mask. 12 | /// 13 | public static bool IsInLayerMask(this GameObject self, LayerMask mask) 14 | { 15 | return ((mask.value & (1 << self.layer)) > 0); 16 | } 17 | 18 | /// 19 | /// Looks for a component of given type in objects directly 20 | /// higher up in the hierarchy. 21 | /// 22 | /// Unity engine component. 23 | /// Component of given type if found, null if otherwise. 24 | public static T GetComponentInAncestors(this GameObject self) where T : Component 25 | { 26 | Transform currentAncestor = self.transform.parent; 27 | 28 | while (currentAncestor != null) 29 | { 30 | var targetComponent = currentAncestor.gameObject.GetComponent(); 31 | 32 | if (targetComponent != null) 33 | { 34 | return targetComponent; 35 | } 36 | 37 | currentAncestor = currentAncestor.parent; 38 | } 39 | 40 | return null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Runtime/Helpers/Extensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62ece08f416932349bb656fa8344b134 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Helpers/MathLibrary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace PixelRouge.Parallaxer.Helpers 6 | { 7 | public class MathLibrary : MonoBehaviour 8 | { 9 | /// 10 | /// Return num > 0 if angle between vectors is greater than 90 degrees, 11 | /// return num < 0 if angle between vectors is lesser than 90 degrees 12 | /// return 0 if angle between vectors is equal to 90 degrees. 13 | /// 14 | /// 15 | /// 16 | /// 17 | public static float Dot(Vector3 v1, Vector3 v2) //ok 18 | { 19 | return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; 20 | } 21 | 22 | /// 23 | /// Returns the length of the vector. 24 | /// 25 | /// 26 | /// 27 | public static float Magnitude(Vector3 v) 28 | { 29 | return Mathf.Sqrt(Square(v.x) + Square(v.y) + Square(v.z)); 30 | } 31 | 32 | /// 33 | /// Returns the distance between the two vectors. 34 | /// 35 | /// 36 | /// 37 | /// 38 | public static float Distance(Vector3 currentPos, Vector3 destinationPos) //ok 39 | { 40 | return Mathf.Sqrt(Square(destinationPos.x - currentPos.x) + 41 | Square(destinationPos.y - currentPos.y) + Square(destinationPos.z - currentPos.z)); 42 | } 43 | 44 | /// 45 | /// Returns the direction from currentPos to focusPos. 46 | /// 47 | /// 48 | /// 49 | /// 50 | public static Vector3 Direction(Vector3 currentPos, Vector3 focusPos) 51 | { 52 | return new Vector3(focusPos.x - currentPos.x, focusPos.y - currentPos.y, focusPos.z - currentPos.z); 53 | } 54 | 55 | /// 56 | /// Returns the vector normal, which is the same vector with magnitude 1. 57 | /// 58 | /// 59 | /// 60 | public static Vector2 Normal(Vector2 v) 61 | { 62 | return new Vector2(v.x / (v).magnitude, v.y / (v).magnitude); 63 | } 64 | 65 | /// 66 | /// Returns the angle between two vectors in radians. 67 | /// 68 | /// 69 | /// 70 | /// 71 | public static float Angle(Vector2 v1, Vector2 v2) 72 | { 73 | // return Mathf.Acos(Dot(v1.normalized, v2.normalized) / (v1).magnitude * (v2).magnitude); 74 | return Mathf.Acos(Dot(v1, v2) / (Distance(Vector2.zero, v1) * Distance(Vector2.zero, v2))); 75 | } 76 | 77 | /// 78 | /// Returns n squared. 79 | /// 80 | /// 81 | /// 82 | public static float Square(float n) 83 | { 84 | return n * n; 85 | } 86 | 87 | /// 88 | /// Returns n squared. 89 | /// 90 | /// 91 | /// 92 | public static int Square(int n) 93 | { 94 | return n * n; 95 | } 96 | 97 | /// 98 | /// Returns something less than zero if the rotation needs to be clockwise and returns 99 | /// greater than zero if counter-clockwise 100 | /// 101 | /// 102 | /// 103 | /// 104 | public static Vector3 Cross(Vector3 v1, Vector3 v2) 105 | { 106 | return new Vector3(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x); 107 | } 108 | 109 | /// 110 | /// Make the object with the currentPos face the focusPos using Atan2. 111 | /// 112 | /// 113 | /// 114 | /// 115 | public static Quaternion LookAt2D(Vector3 currentPos, Vector3 focusPos) 116 | { 117 | Vector2 dirNormalized = Normal(Direction(currentPos, focusPos)); 118 | Quaternion rotation = new Quaternion(); 119 | rotation.eulerAngles = new Vector3(0, 0, Mathf.Atan2(dirNormalized.y, dirNormalized.x) * Mathf.Rad2Deg); 120 | return rotation; 121 | } 122 | 123 | /// 124 | /// Make the object with the currentPos face the focusPos (dont use on update). 125 | /// 126 | /// 127 | /// 128 | /// 129 | /// 130 | public static Vector3 LookAt2D(Vector3 facingDirection, Vector3 currentPos, Vector3 focusPos) 131 | { 132 | Vector3 direction = Direction(currentPos, focusPos); 133 | float angle = Angle(facingDirection, direction); 134 | bool clockwise = Cross(currentPos, direction).z < 0 ? true : false; 135 | return Rotate(facingDirection, angle, clockwise); 136 | } 137 | 138 | /// 139 | /// Rotates the object on itself. Store this in object's transform.up. 140 | /// 141 | /// 142 | /// 143 | /// 144 | /// 145 | public static Vector2 Rotate(Vector3 facingDirection, float angle, bool rotateClockwise) 146 | { 147 | // angle *= 180 / 2; 148 | if (rotateClockwise) 149 | angle = 2 * Mathf.PI - angle; 150 | 151 | return new Vector2(facingDirection.x * Mathf.Cos(angle) - facingDirection.y * Mathf.Sin(angle), 152 | facingDirection.x * Mathf.Sin(angle) + facingDirection.y * Mathf.Cos(angle)); 153 | } 154 | 155 | /// 156 | /// "Moves" the object to a destiny.!-- Please store the return in the localPosition atribute. 157 | /// 158 | /// 159 | /// 160 | /// 161 | public static Vector2 Translate(Vector3 currentPos, Vector3 destinationPos) 162 | { 163 | return currentPos + destinationPos * Time.deltaTime; 164 | } 165 | 166 | /** 167 | "Moves" the object while pixel perfect. Please store the return in the localPosition atribute 168 | */ 169 | // public static Vector2 TranslatePixelArt(Vector3 currentPos, Vector3 destinationPos, float pixelInUnits) 170 | // { 171 | // return Vector3.Lerp(currentPos, Translate(currentPos, destinationPos * pixelInUnits), Time.deltaTime * Random.Range(300f, 500f)); 172 | // // return Translate(currentPos, destinationPos * pixelInUnits); 173 | // } 174 | 175 | /// 176 | /// Returns a number which must then be multiplied with a angle in radians what will 177 | /// result in a number representing the same angle in degrees. 178 | /// 179 | /// 180 | public static float RadiansToDegrees() 181 | { 182 | return 180 / Mathf.PI; 183 | } 184 | 185 | /** 186 | Round the unit measured in unit values to the nearest value that can 187 | perfect pixel 188 | */ 189 | // public static float RoundUnitToPixel(float unityUnits, float pixelPerUnit) 190 | // {//please set the V-Sync to Every V Blank 191 | // float valueInPixels = unityUnits * pixelPerUnit; 192 | // valueInPixels = Mathf.Round(valueInPixels); 193 | // float roundedUnityUnits = valueInPixels * (1 / pixelPerUnit); 194 | // return roundedUnityUnits; 195 | // } 196 | 197 | /** 198 | Round vector axes to the nearest value that can be perfect pixel 199 | */ 200 | // public static Vector2 RoundVectorToPixel(Vector2 vector, float pixelPerUnit) 201 | // {//please set the V-Sync to Every V Blank 202 | // return new Vector2(RoundUnitToPixel(vector.x, pixelPerUnit), RoundUnitToPixel(vector.y, pixelPerUnit)); 203 | // } 204 | 205 | // public static float GetPixelPerfectCameraSize() 206 | // { 207 | 208 | // } 209 | 210 | /// 211 | /// Move towards horizontally. 212 | /// 213 | /// 214 | /// 215 | /// 216 | /// 217 | public static Vector2 MoveTowardsHorizontally(Vector2 start, Vector2 end, float maxDistanceDelta) 218 | { 219 | Vector2 a = start - end; 220 | float magnitude = a.magnitude; 221 | if (magnitude <= maxDistanceDelta || magnitude == 0f) {return end;} 222 | return new Vector2(start.x + a.x, start.y) / magnitude * maxDistanceDelta; 223 | } 224 | 225 | /// 226 | /// Return a diagonal vector with 1 for x and -1 for y. 227 | /// 228 | /// 229 | /// 230 | public static Vector2 GetDownRightVector2() {return new Vector2(1, -1);} 231 | 232 | /// 233 | /// Returns a diagonal vector with -1 for x and 1 for y. 234 | /// 235 | /// 236 | /// 237 | public static Vector2 GetUpLeftVector2() {return new Vector2(-1, 1);} 238 | 239 | /// 240 | /// Calculate the velocity. 241 | /// 242 | /// 243 | /// 244 | /// 245 | /// 246 | public static Vector2 GetVelocity(Vector2 initialPos, Vector2 finalPos, float deltaTime) 247 | { 248 | return (finalPos - initialPos) / deltaTime; 249 | } 250 | 251 | /// 252 | /// Calculate the velocity. 253 | /// 254 | /// 255 | /// 256 | /// 257 | /// 258 | public static Vector3 GetVelocity(Vector3 initialPos, Vector3 finalPos, float deltaTime) 259 | { 260 | return (finalPos - initialPos) / deltaTime; 261 | } 262 | 263 | /// 264 | /// Calculate velocity on a single axis. 265 | /// 266 | /// 267 | /// 268 | /// 269 | /// 270 | public static float GetVelocity(float initialPos, float finalPos, float deltaTime) 271 | { 272 | return (finalPos - initialPos) / deltaTime; 273 | } 274 | 275 | /// 276 | /// Return the absolute value of n. 277 | /// 278 | /// 279 | /// 280 | public static float Abs(float n) 281 | { 282 | if (n >= 0) return n; 283 | return -n; 284 | } 285 | 286 | /// 287 | /// Return the absolute value of n. 288 | /// 289 | /// 290 | /// 291 | public static int Abs(int n) 292 | { 293 | if (n >= 0) return n; 294 | return -n; 295 | } 296 | 297 | /// 298 | /// Returns a Vector2 representing the initial velocity of the rigidbody so it hits the target 299 | /// while going through a parabola. The should be from where the 300 | /// rigidbody is launched and not the rigidbody's own position. 301 | /// 302 | /// 303 | /// 304 | /// 305 | public static Vector2 GetParabolaInitialVelocity(Vector2 initialPos, Vector2 finalPos, float time) 306 | { 307 | Vector2 velocity = GetVelocity(initialPos, finalPos, time); 308 | velocity.y += 0.5f * Abs(Physics2D.gravity.y) * Square(time) / time; 309 | return velocity; 310 | } 311 | 312 | /// 313 | /// Simulate a heads or tails toss. 314 | /// 315 | /// 316 | /// 317 | public static bool HeadsOrTails() {return Random.Range(0, 2) > 0;} 318 | 319 | /// 320 | /// Simulate a dice roll with the given number of sides. The minimum value is 1. 321 | /// 322 | /// 323 | /// 324 | /// 325 | /// 326 | public static int RollDice(int sides) { return Random.Range(1, sides + 1); } 327 | 328 | /// 329 | /// Get a random Vector2 with a length of 1. 330 | /// 331 | /// 332 | public static Vector2 GetRandomNormalizedVector2() 333 | { 334 | return new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)).normalized; 335 | } 336 | 337 | /// 338 | /// Get a random Vector3 with a length of 1. 339 | /// 340 | /// 341 | public static Vector3 GetRandomNormalizedVector3() 342 | { 343 | return new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f)).normalized; 344 | } 345 | 346 | public static Vector2 Acceleration(Vector2 netForce, float mass) 347 | { 348 | if (netForce.Equals(Vector2.zero)) 349 | { 350 | return Vector2.zero; 351 | } 352 | 353 | return netForce / mass; 354 | } 355 | 356 | public static Vector3 Acceleration(Vector3 netForce, float mass) 357 | { 358 | if (netForce.Equals(Vector3.zero)) 359 | { 360 | return Vector3.zero; 361 | } 362 | 363 | return netForce / mass; 364 | } 365 | 366 | public static Vector2 Velocity(Vector2 acceleration) 367 | { 368 | return acceleration * Time.deltaTime; 369 | } 370 | 371 | public static Vector3 Velocity(Vector3 acceleration) 372 | { 373 | return acceleration * Time.deltaTime; 374 | } 375 | 376 | public static Vector2 ClampVector2(Vector2 value, float maxLength) 377 | { 378 | var magnitude = value.magnitude; 379 | 380 | if (magnitude <= maxLength) 381 | { 382 | return value; 383 | } 384 | 385 | return value.normalized * maxLength; 386 | } 387 | 388 | public static Vector3 ClampVector3(Vector3 value, float maxLength) 389 | { 390 | var magnitude = value.magnitude; 391 | 392 | if (magnitude <= maxLength) 393 | { 394 | return value; 395 | } 396 | 397 | return value.normalized * maxLength; 398 | } 399 | 400 | /// 401 | /// Translates a world position to relative position in relation 402 | /// to a point ; 403 | /// 404 | /// Position to be translated. 405 | /// Point which will be the origin relative to point in 406 | /// 407 | public static Vector3 WorldToLocalPosition(Vector3 worldPosition, Vector3 pointToRelateTo) 408 | { 409 | return worldPosition - pointToRelateTo; 410 | } 411 | 412 | /// 413 | /// Round the to a number divisible by 0.5. 414 | /// 415 | public static float RoundToHalf(float value) 416 | { 417 | return (float) System.Math.Round(value * 2, System.MidpointRounding.AwayFromZero) * 0.5f; 418 | } 419 | } 420 | } 421 | -------------------------------------------------------------------------------- /Runtime/Helpers/MathLibrary.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5cf3c13d2700aa4fa3a774cb1cc7d95 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ParallaxElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | #if UNITY_EDITOR 4 | using PixelRouge.Parallaxer.InspectorAttributes; 5 | #endif 6 | using PixelRouge.Parallaxer.Helpers; 7 | 8 | namespace PixelRouge.Parallaxer 9 | { 10 | [RequireComponent(typeof(SpriteRenderer))] 11 | public abstract class ParallaxElement : MonoBehaviour 12 | { 13 | #region Serialized Fields 14 | 15 | [SerializeField] 16 | [Tooltip("Prevents the object from moving below its initial position.")] 17 | #if UNITY_EDITOR 18 | [LeftToggle] 19 | #endif 20 | private bool _preventMovingBelowInitialPosition = true; 21 | 22 | [SerializeField] 23 | [Tooltip("The parallax moving speed depends on the plane that it is placed in.")] 24 | private ParallaxPlane _plane; 25 | 26 | #endregion 27 | 28 | #region Non-Serialized Fields 29 | 30 | private SpriteRenderer _spriteRenderer; 31 | private Transform _transform; 32 | private Vector3 _initialPosition; 33 | private float _previousZValue; 34 | private ParallaxManager _manager; 35 | 36 | #endregion 37 | 38 | #region Properties 39 | 40 | protected SpriteRenderer SpriteRenderer => _spriteRenderer; 41 | protected Transform Transform => _transform; 42 | protected Vector3 InitialPosition => _initialPosition; 43 | protected ParallaxPlane Plane => _plane; 44 | protected ParallaxManager Manager => _manager; 45 | protected bool PreventMovingBelowInitialPos => _preventMovingBelowInitialPosition; 46 | 47 | #endregion 48 | 49 | #region Unity Methods 50 | 51 | private void Awake() 52 | { 53 | ReferenceComponents(); 54 | } 55 | 56 | private void Start() 57 | { 58 | Initialize(); 59 | } 60 | 61 | #endregion 62 | 63 | #region Public Methods 64 | 65 | public void ChangeInitialPosition(Vector3 newPosition) 66 | { 67 | _initialPosition = newPosition; 68 | } 69 | 70 | #endregion 71 | 72 | #region Internal methods 73 | 74 | internal abstract void Move(Vector2 displacement, EDirection direction); 75 | 76 | #endregion 77 | 78 | #region Protected methods 79 | 80 | #region Virtual methods 81 | 82 | protected virtual void Initialize() 83 | { 84 | Setup(); 85 | } 86 | 87 | protected virtual void ReferenceComponents() 88 | { 89 | _manager = gameObject.GetComponentInAncestors(); 90 | _spriteRenderer = GetComponent(); 91 | _transform = transform; 92 | } 93 | 94 | protected virtual void Setup() 95 | { 96 | if (!_transform.parent.GetComponent()) 97 | { 98 | string errorMsg = "Place the object containing this elements as a child of a Parallax Manager."; 99 | Debug.LogError($"Error! Element {gameObject} is not assigned to a parallax manager! {errorMsg}"); 100 | throw new Exception(); 101 | } 102 | 103 | if (!_spriteRenderer.sprite) 104 | { 105 | string errorMsg = "A parallax element needs a sprite to function properly."; 106 | Debug.LogError($"Error! The Sprite Renderer of {gameObject} is missing the Sprite! {errorMsg}"); 107 | throw new Exception(); 108 | } 109 | 110 | _initialPosition = _transform.position; 111 | } 112 | 113 | #endregion 114 | 115 | #endregion 116 | 117 | #region Private methods 118 | #endregion 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /Runtime/ParallaxElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8c06a29735b1334b8f767d149392a63 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ParallaxExpansibleElement.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using PixelRouge.Parallaxer.Helpers; 3 | 4 | namespace PixelRouge.Parallaxer 5 | { 6 | public class ParallaxExpansibleElement : ParallaxElement 7 | { 8 | #region Serialized fields 9 | 10 | [SerializeField] 11 | [Tooltip("Object moving speed relative to the camera displacement.")] 12 | [Range(0f, 1f)] 13 | private float _relativeSpeed = 0.2f; 14 | 15 | [SerializeField] 16 | [Tooltip("Cache the speed calculation result to improve performance. Check this when you are done adjusting the speed.")] 17 | #if UNITY_EDITOR 18 | [InspectorAttributes.LeftToggle] 19 | #endif 20 | private bool _cacheSpeed = false; 21 | 22 | [SerializeField] 23 | #if UNITY_EDITOR 24 | [InspectorAttributes.LeftToggle] 25 | #endif 26 | private bool _preventHorizontalMovement = false; 27 | 28 | [SerializeField] 29 | #if UNITY_EDITOR 30 | [InspectorAttributes.LeftToggle] 31 | #endif 32 | private bool _preventVerticalMovement = false; 33 | 34 | private float _parallaxExitDistance = 1f; 35 | 36 | #endregion 37 | 38 | #region Non-serialized fields 39 | 40 | private SpriteRenderer[] _copies; 41 | 42 | private float _cachedRendererWidth; 43 | 44 | private float _cachedBackgroundSpeed; 45 | 46 | private float _cachedForegroundSpeed; 47 | 48 | #endregion 49 | 50 | #region Properties 51 | 52 | protected float RelativeSpeed => _relativeSpeed; 53 | 54 | #endregion 55 | 56 | #region Constant fields 57 | 58 | private const int CopiesQuantity = 3; 59 | 60 | #endregion 61 | 62 | #region Custom structures 63 | 64 | private enum Position 65 | { 66 | Left = 0, Central = 1, Right = 2 67 | } 68 | #endregion 69 | 70 | #region Unity events 71 | 72 | #endregion 73 | 74 | #region Public methods 75 | 76 | public void SetMovementConstraints(bool horizontal, bool vertical) 77 | { 78 | _preventHorizontalMovement = horizontal; 79 | _preventVerticalMovement = vertical; 80 | } 81 | 82 | #endregion 83 | 84 | #region Internal methods 85 | 86 | internal override void Move(Vector2 displacement, EDirection direction) 87 | { 88 | CheckCameraPosition(displacement, direction); 89 | var targetPosition = Transform.position; 90 | 91 | if (Plane == ParallaxPlane.Background) 92 | { 93 | var speed = _cachedBackgroundSpeed; 94 | 95 | if (_cacheSpeed == false) 96 | { 97 | speed = 1f - _relativeSpeed; 98 | } 99 | 100 | targetPosition = base.Transform.position + (Vector3) displacement * speed; 101 | } 102 | else if (Plane == ParallaxPlane.Foreground) 103 | { 104 | var speed = _cachedForegroundSpeed; 105 | 106 | if (_cacheSpeed == false) 107 | { 108 | speed = (1f + _relativeSpeed) * -1f; 109 | } 110 | 111 | targetPosition = Transform.position + (Vector3) displacement * (speed + 1f); 112 | } 113 | else if (Plane == ParallaxPlane.Midground) 114 | { 115 | Transform.position += (Vector3) displacement; 116 | } 117 | 118 | if ((PreventMovingBelowInitialPos) && (targetPosition.y < InitialPosition.y)) 119 | { 120 | targetPosition.y = InitialPosition.y; 121 | } 122 | 123 | if (_preventHorizontalMovement == true) 124 | { 125 | targetPosition.x = InitialPosition.x; 126 | } 127 | 128 | if (_preventVerticalMovement == true) 129 | { 130 | targetPosition.y = InitialPosition.y; 131 | } 132 | 133 | Transform.position = targetPosition; 134 | } 135 | 136 | #endregion 137 | 138 | #region Protected methods 139 | 140 | #region Overridden methods 141 | 142 | protected override void Initialize() 143 | { 144 | base.Initialize(); 145 | CreateCopies(); 146 | PlaceChildrenCopies(); 147 | CalculateSpeed(); 148 | } 149 | 150 | #endregion 151 | 152 | #endregion 153 | 154 | #region Private methods 155 | 156 | private void CheckCameraPosition(Vector2 displacement, EDirection direction) 157 | { 158 | if (Manager == null) 159 | { 160 | return; 161 | } 162 | 163 | if (Direction.IsHorizontal(direction) == false) 164 | { 165 | return; 166 | } 167 | 168 | var currentDistance = GetDistanceToExitParallax(direction); 169 | 170 | if (MathLibrary.Abs(currentDistance) <= _parallaxExitDistance) 171 | { 172 | MoveCopies(direction); 173 | } 174 | } 175 | 176 | private void CalculateSpeed() 177 | { 178 | _cachedBackgroundSpeed = 1f - _relativeSpeed; 179 | _cachedForegroundSpeed = (_relativeSpeed + 1f) * 1f; 180 | } 181 | 182 | private float GetDistanceToExitParallax(EDirection direction) 183 | { 184 | var cameraBounds = Manager.CameraBounds; 185 | 186 | if (direction == EDirection.Right) 187 | { 188 | var parallaxRightMostPoint = _copies[(int) Position.Right].bounds.max.x; 189 | return parallaxRightMostPoint - cameraBounds.max.x; 190 | } 191 | 192 | if (direction == EDirection.Left) 193 | { 194 | var parallaxLeftMostPoint = _copies[(int) Position.Left].bounds.min.x; 195 | return parallaxLeftMostPoint - cameraBounds.min.x; 196 | } 197 | 198 | return 0f; 199 | } 200 | 201 | private void CreateCopies() 202 | { 203 | _cachedRendererWidth = SpriteRenderer.bounds.size.x; 204 | SpriteRenderer.enabled = false; 205 | _copies = new SpriteRenderer[CopiesQuantity]; 206 | var dummyObject = new GameObject(); 207 | var spriteRenderer = dummyObject.AddComponent(); 208 | spriteRenderer.sortingOrder = SpriteRenderer.sortingOrder; 209 | spriteRenderer.sprite = SpriteRenderer.sprite; 210 | spriteRenderer.sortingLayerID = SpriteRenderer.sortingLayerID; 211 | 212 | for (var i = 0; i < _copies.Length; i++) 213 | { 214 | _copies[i] = Instantiate(spriteRenderer, transform, false); 215 | _copies[i].gameObject.name = $"Element{i}"; 216 | } 217 | 218 | Destroy(dummyObject); 219 | } 220 | 221 | private void PlaceChildrenCopies() 222 | { 223 | if (_copies.Length <= 0) 224 | { 225 | return; 226 | } 227 | 228 | var bounds = base.SpriteRenderer.bounds; 229 | 230 | _copies[(int) Position.Left].transform.localPosition = new Vector3( 231 | -bounds.size.x, 232 | _copies[(int) Position.Left].transform.localPosition.y, 233 | _copies[(int) Position.Left].transform.localPosition.z); 234 | 235 | _copies[(int) Position.Right].transform.localPosition = new Vector3( 236 | bounds.size.x, 237 | _copies[(int) Position.Right].transform.localPosition.y, 238 | _copies[(int) Position.Right].transform.localPosition.z); 239 | } 240 | 241 | private void MoveCopies(EDirection direction) 242 | { 243 | if (direction == EDirection.Right) 244 | { 245 | var extendedSprite = _copies[(int) Position.Left]; 246 | extendedSprite.transform.localPosition = new Vector3( 247 | _copies[(int) Position.Right].transform.localPosition.x + _cachedRendererWidth, 248 | extendedSprite.transform.localPosition.y, 249 | extendedSprite.transform.localPosition.z 250 | ); 251 | 252 | _copies[(int) Position.Left] = _copies[(int) Position.Central]; 253 | _copies[(int) Position.Central] = _copies[(int) Position.Right]; 254 | _copies[(int) Position.Right] = extendedSprite; 255 | } 256 | else if (direction == EDirection.Left) 257 | { 258 | var extendedSprite = _copies[(int) Position.Right]; 259 | extendedSprite.transform.localPosition = new Vector3( 260 | _copies[(int) Position.Left].transform.localPosition.x - _cachedRendererWidth, 261 | extendedSprite.transform.localPosition.y, 262 | extendedSprite.transform.localPosition.z 263 | ); 264 | 265 | _copies[(int) Position.Right] = _copies[(int) Position.Central]; 266 | _copies[(int) Position.Central] = _copies[(int) Position.Left]; 267 | _copies[(int) Position.Left] = extendedSprite; 268 | } 269 | } 270 | 271 | #endregion 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /Runtime/ParallaxExpansibleElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4cb613fa7f8eff4b8b22a8126121240 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ParallaxManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | #if UNITY_EDITOR 4 | using PixelRouge.Parallaxer.InspectorAttributes; 5 | #endif 6 | using PixelRouge.Parallaxer.Helpers; 7 | 8 | namespace PixelRouge.Parallaxer 9 | { 10 | public class ParallaxManager : MonoBehaviour 11 | { 12 | #region Serialized Fields 13 | 14 | [SerializeField] 15 | [Tooltip("Controls whether the camera will be automatically set to the camera set as the Main Camera.")] 16 | private bool _useMainCamera = true; 17 | 18 | [SerializeField] 19 | #if UNITY_EDITOR 20 | [InspectorAttributes.HideIf(nameof(_useMainCamera))] 21 | #endif 22 | [Tooltip("Camera used to calculate the parallax speed.")] 23 | private Camera _targetCamera; 24 | 25 | [SerializeField] 26 | [Tooltip("Show debug fields.")] 27 | private bool _debugMode; 28 | 29 | [SerializeField] 30 | #if UNITY_EDITOR 31 | [InspectorAttributes.ShowIf(nameof(_debugMode))] 32 | #endif 33 | private Transform _mainCameraTransform; 34 | 35 | [SerializeField] 36 | #if UNITY_EDITOR 37 | [InspectorAttributes.ShowIf(nameof(_debugMode))] 38 | #endif 39 | private Vector3 _previousCameraPosition; 40 | 41 | [SerializeField] 42 | #if UNITY_EDITOR 43 | [InspectorAttributes.ShowIf(nameof(_debugMode))] 44 | #endif 45 | private Vector3 _currentCameraPosition; 46 | 47 | [SerializeField] 48 | #if UNITY_EDITOR 49 | [InspectorAttributes.ShowIf(nameof(_debugMode))] 50 | #endif 51 | private float _currentCameraHorizontalDisplacement; 52 | 53 | #endregion 54 | 55 | #region Non-Serialized Fields 56 | 57 | private Vector3 _currentCameraDisplacement; 58 | 59 | private EDirection _cameraMovementDirection; 60 | 61 | private float _lowestZvalueAvailable; 62 | 63 | private float _screenAspect; 64 | 65 | private List _parallaxElements = new List(); 66 | 67 | #endregion 68 | 69 | #region Properties 70 | 71 | internal EDirection MovementDirection => _cameraMovementDirection; 72 | 73 | internal float CameraLeftmostHorizontalPoint => TargetCameraBounds().min.x; 74 | 75 | internal float CameraRightmostHorizontalPoint => TargetCameraBounds().max.x; 76 | 77 | internal Bounds CameraBounds => TargetCameraBounds(); 78 | 79 | #endregion 80 | 81 | #region Custom structures 82 | #endregion 83 | 84 | #region Unity Methods 85 | 86 | private void Awake() 87 | { 88 | ReferenceComponents(); 89 | } 90 | 91 | private void Start() 92 | { 93 | TrackChildrenParallaxElements(); 94 | SetupInitialValues(); 95 | FindFurthestObject(); 96 | } 97 | 98 | private void Update() 99 | { 100 | CalculateCameraDisplacement(); 101 | MoveChildrenParallaxObjects(); 102 | } 103 | 104 | #endregion 105 | 106 | #region Public Methods 107 | #endregion 108 | 109 | #region Internal methods 110 | 111 | internal float GetLowestZAxisValueAvailable() 112 | { 113 | return _lowestZvalueAvailable; 114 | } 115 | 116 | #endregion 117 | 118 | #region Private Methods 119 | 120 | private void TrackChildrenParallaxElements() 121 | { 122 | for (int i = 0; i < transform.childCount; i++) 123 | { 124 | var element = transform.GetChild(i).GetComponent(); 125 | 126 | if (element != null) 127 | { 128 | _parallaxElements.Add(element); 129 | } 130 | else 131 | { 132 | transform.GetChild(i).SetParent(null, false); 133 | } 134 | } 135 | } 136 | 137 | private void CalculateCameraDisplacement() 138 | { 139 | var currentCameraPosition = _mainCameraTransform.position; 140 | _currentCameraPosition = currentCameraPosition; 141 | 142 | if (_currentCameraPosition.x > _previousCameraPosition.x) 143 | { 144 | _cameraMovementDirection = EDirection.Right; 145 | } 146 | else if (_currentCameraPosition.x < _previousCameraPosition.x) 147 | { 148 | _cameraMovementDirection = EDirection.Left; 149 | } 150 | else 151 | { 152 | _cameraMovementDirection = EDirection.None; 153 | } 154 | 155 | _currentCameraDisplacement = currentCameraPosition - _previousCameraPosition; 156 | _currentCameraHorizontalDisplacement = currentCameraPosition.x - _previousCameraPosition.x; 157 | _previousCameraPosition = currentCameraPosition; 158 | } 159 | 160 | private void MoveChildrenParallaxObjects() 161 | { 162 | foreach (var p in _parallaxElements) 163 | { 164 | p.Move(_currentCameraDisplacement, _cameraMovementDirection); 165 | } 166 | } 167 | 168 | private void FindFurthestObject() 169 | { 170 | _lowestZvalueAvailable = MathLibrary.Abs(Mathf.Floor(_mainCameraTransform.position.z + 1f)); 171 | } 172 | 173 | private void ReferenceComponents() 174 | { 175 | if (_useMainCamera) 176 | { 177 | _targetCamera = Camera.main; 178 | } 179 | 180 | _mainCameraTransform = Camera.main.transform; 181 | } 182 | 183 | private Bounds TargetCameraBounds() 184 | { 185 | if (_targetCamera == null) 186 | { 187 | return new Bounds(Vector2.zero, Vector2.zero); 188 | } 189 | 190 | float cameraHeight = _targetCamera.orthographicSize * 2; 191 | Vector3 boundsCenter = _targetCamera.transform.position; 192 | Vector3 boundsSize = new Vector3(cameraHeight * _screenAspect, cameraHeight, 0f); 193 | return new Bounds(boundsCenter, boundsSize); 194 | } 195 | 196 | private void SetupInitialValues() 197 | { 198 | _previousCameraPosition = _mainCameraTransform.position; 199 | _currentCameraPosition = _mainCameraTransform.position; 200 | _screenAspect = (float) Screen.width / (float) Screen.height; 201 | } 202 | 203 | #endregion 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /Runtime/ParallaxManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 737609155523afc45ad465238cde60c0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ParallaxMovingElement.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using PixelRouge.Parallaxer.Helpers; 3 | 4 | namespace PixelRouge.Parallaxer 5 | { 6 | [RequireComponent(typeof(SpriteRenderer))] 7 | public class ParallaxMovingElement : ParallaxElement 8 | { 9 | #region Serialized fields 10 | 11 | [SerializeField] 12 | private float _movementSpeed = 0.5f; 13 | 14 | [SerializeField] 15 | private Vector2 _movementDirection; 16 | 17 | [SerializeField] 18 | #if UNITY_EDITOR 19 | [InspectorAttributes.LeftToggle] 20 | #endif 21 | private bool _respawnsWhenOutOfScreen = true; 22 | 23 | #endregion 24 | 25 | #region Non-serialized fields 26 | #endregion 27 | 28 | #region Unity events 29 | 30 | private void OnBecameInvisible() 31 | { 32 | Respawn(); 33 | } 34 | 35 | #endregion 36 | 37 | #region Internal methods 38 | 39 | internal override void Move(Vector2 displacement, EDirection direction) 40 | { 41 | var movement = _movementSpeed * Time.deltaTime * _movementDirection; 42 | var aggregatedDisplacement = movement + displacement; 43 | Transform.position += (Vector3) aggregatedDisplacement; 44 | } 45 | 46 | #endregion 47 | 48 | #region Protected methods 49 | 50 | #region Overridden methods 51 | 52 | protected override void Initialize() 53 | { 54 | base.Initialize(); 55 | } 56 | 57 | #endregion 58 | 59 | #endregion 60 | 61 | #region Private methods 62 | 63 | private void Respawn() 64 | { 65 | if (_respawnsWhenOutOfScreen == false) 66 | { 67 | return; 68 | } 69 | 70 | if (Manager == null) 71 | { 72 | return; 73 | } 74 | 75 | var spriteWidth = SpriteRenderer.bounds.size.x; 76 | 77 | if (_movementDirection.x > 0f) 78 | { 79 | var leftmostPoint = Manager.CameraLeftmostHorizontalPoint; 80 | var newPosition = new Vector2(leftmostPoint + -spriteWidth, Transform.position.y); 81 | base.Transform.position = newPosition; 82 | } 83 | else if (_movementDirection.x < 0f) 84 | { 85 | var rightmostPoint = Manager.CameraRightmostHorizontalPoint; 86 | var newPosition = new Vector2(rightmostPoint + spriteWidth, Transform.position.y); 87 | base.Transform.position = newPosition; 88 | } 89 | } 90 | 91 | #endregion 92 | } 93 | } -------------------------------------------------------------------------------- /Runtime/ParallaxMovingElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c74f4d9d9216fcd4280c6bdee7f9d6b6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ParallaxPlane.cs: -------------------------------------------------------------------------------- 1 | namespace PixelRouge.Parallaxer 2 | { 3 | public enum ParallaxPlane 4 | { 5 | Background, Foreground, Midground 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Runtime/ParallaxPlane.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6e5be9fa4134ae4f8f2a5016397c023 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/ParallaxStaticElement.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using PixelRouge.Parallaxer.Helpers; 3 | 4 | namespace PixelRouge.Parallaxer 5 | { 6 | public class ParallaxStaticElement : ParallaxElement 7 | { 8 | #region Internal methods 9 | 10 | internal override void Move(Vector2 displacement, EDirection direction) 11 | { 12 | Transform.position += (Vector3) displacement; 13 | } 14 | 15 | #endregion 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /Runtime/ParallaxStaticElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a523ebea77e15284d894ec561482f425 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/com.pixelrouge.parallaxersystemforunity.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.pixelrouge.parallaxersystemforunity.Runtime", 3 | "references": [ 4 | "GUID:79a1fe10f4e06354dbd2dcf1bb901266" 5 | ], 6 | "includePlatforms": [], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } -------------------------------------------------------------------------------- /Runtime/com.pixelrouge.parallaxersystemforunity.Runtime.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e9c4c75879ef0942accf1f59cfababf 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86057bc20709a584296440bfe7db9fe2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Animations.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e42ba969b35a9ee448fa6307ab0d9952 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Animations/Player.controller: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1102 &-7106217503528508746 4 | AnimatorState: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 1 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: idle 11 | m_Speed: 1 12 | m_CycleOffset: 0 13 | m_Transitions: [] 14 | m_StateMachineBehaviours: [] 15 | m_Position: {x: 50, y: 50, z: 0} 16 | m_IKOnFeet: 0 17 | m_WriteDefaultValues: 1 18 | m_Mirror: 0 19 | m_SpeedParameterActive: 0 20 | m_MirrorParameterActive: 0 21 | m_CycleOffsetParameterActive: 0 22 | m_TimeParameterActive: 0 23 | m_Motion: {fileID: 7400000, guid: 16291578d27ece74280ef251b473ca78, type: 2} 24 | m_Tag: 25 | m_SpeedParameter: 26 | m_MirrorParameter: 27 | m_CycleOffsetParameter: 28 | m_TimeParameter: 29 | --- !u!1102 &-2981491578685485399 30 | AnimatorState: 31 | serializedVersion: 6 32 | m_ObjectHideFlags: 1 33 | m_CorrespondingSourceObject: {fileID: 0} 34 | m_PrefabInstance: {fileID: 0} 35 | m_PrefabAsset: {fileID: 0} 36 | m_Name: walk 37 | m_Speed: 1 38 | m_CycleOffset: 0 39 | m_Transitions: [] 40 | m_StateMachineBehaviours: [] 41 | m_Position: {x: 50, y: 50, z: 0} 42 | m_IKOnFeet: 0 43 | m_WriteDefaultValues: 1 44 | m_Mirror: 0 45 | m_SpeedParameterActive: 0 46 | m_MirrorParameterActive: 0 47 | m_CycleOffsetParameterActive: 0 48 | m_TimeParameterActive: 0 49 | m_Motion: {fileID: 7400000, guid: 727f1d079ca1eae41b51f4b1d499c477, type: 2} 50 | m_Tag: 51 | m_SpeedParameter: 52 | m_MirrorParameter: 53 | m_CycleOffsetParameter: 54 | m_TimeParameter: 55 | --- !u!91 &9100000 56 | AnimatorController: 57 | m_ObjectHideFlags: 0 58 | m_CorrespondingSourceObject: {fileID: 0} 59 | m_PrefabInstance: {fileID: 0} 60 | m_PrefabAsset: {fileID: 0} 61 | m_Name: Player 62 | serializedVersion: 5 63 | m_AnimatorParameters: [] 64 | m_AnimatorLayers: 65 | - serializedVersion: 5 66 | m_Name: Base Layer 67 | m_StateMachine: {fileID: 8366164112050057852} 68 | m_Mask: {fileID: 0} 69 | m_Motions: [] 70 | m_Behaviours: [] 71 | m_BlendingMode: 0 72 | m_SyncedLayerIndex: -1 73 | m_DefaultWeight: 0 74 | m_IKPass: 0 75 | m_SyncedLayerAffectsTiming: 0 76 | m_Controller: {fileID: 9100000} 77 | --- !u!1107 &8366164112050057852 78 | AnimatorStateMachine: 79 | serializedVersion: 6 80 | m_ObjectHideFlags: 1 81 | m_CorrespondingSourceObject: {fileID: 0} 82 | m_PrefabInstance: {fileID: 0} 83 | m_PrefabAsset: {fileID: 0} 84 | m_Name: Base Layer 85 | m_ChildStates: 86 | - serializedVersion: 1 87 | m_State: {fileID: -7106217503528508746} 88 | m_Position: {x: 200, y: 0, z: 0} 89 | - serializedVersion: 1 90 | m_State: {fileID: -2981491578685485399} 91 | m_Position: {x: 235, y: 65, z: 0} 92 | m_ChildStateMachines: [] 93 | m_AnyStateTransitions: [] 94 | m_EntryTransitions: [] 95 | m_StateMachineTransitions: {} 96 | m_StateMachineBehaviours: [] 97 | m_AnyStatePosition: {x: 50, y: 20, z: 0} 98 | m_EntryPosition: {x: 50, y: 120, z: 0} 99 | m_ExitPosition: {x: 800, y: 120, z: 0} 100 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} 101 | m_DefaultState: {fileID: -7106217503528508746} 102 | -------------------------------------------------------------------------------- /Samples/Animations/Player.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26921752d86479341aa46bc8004c4f39 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 9100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Animations/idle.anim: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!74 &7400000 4 | AnimationClip: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: idle 10 | serializedVersion: 6 11 | m_Legacy: 0 12 | m_Compressed: 0 13 | m_UseHighQualityCurve: 1 14 | m_RotationCurves: [] 15 | m_CompressedRotationCurves: [] 16 | m_EulerCurves: [] 17 | m_PositionCurves: [] 18 | m_ScaleCurves: [] 19 | m_FloatCurves: [] 20 | m_PPtrCurves: 21 | - curve: 22 | - time: 0 23 | value: {fileID: 21300000, guid: 0ddc3b6d961feb345884ffefbf2976c2, type: 3} 24 | attribute: m_Sprite 25 | path: 26 | classID: 212 27 | script: {fileID: 0} 28 | m_SampleRate: 60 29 | m_WrapMode: 0 30 | m_Bounds: 31 | m_Center: {x: 0, y: 0, z: 0} 32 | m_Extent: {x: 0, y: 0, z: 0} 33 | m_ClipBindingConstant: 34 | genericBindings: 35 | - serializedVersion: 2 36 | path: 0 37 | attribute: 0 38 | script: {fileID: 0} 39 | typeID: 212 40 | customType: 23 41 | isPPtrCurve: 1 42 | pptrCurveMapping: 43 | - {fileID: 21300000, guid: 0ddc3b6d961feb345884ffefbf2976c2, type: 3} 44 | m_AnimationClipSettings: 45 | serializedVersion: 2 46 | m_AdditiveReferencePoseClip: {fileID: 0} 47 | m_AdditiveReferencePoseTime: 0 48 | m_StartTime: 0 49 | m_StopTime: 0.016666668 50 | m_OrientationOffsetY: 0 51 | m_Level: 0 52 | m_CycleOffset: 0 53 | m_HasAdditiveReferencePose: 0 54 | m_LoopTime: 1 55 | m_LoopBlend: 0 56 | m_LoopBlendOrientation: 0 57 | m_LoopBlendPositionY: 0 58 | m_LoopBlendPositionXZ: 0 59 | m_KeepOriginalOrientation: 0 60 | m_KeepOriginalPositionY: 1 61 | m_KeepOriginalPositionXZ: 0 62 | m_HeightFromFeet: 0 63 | m_Mirror: 0 64 | m_EditorCurves: [] 65 | m_EulerEditorCurves: [] 66 | m_HasGenericRootTransform: 0 67 | m_HasMotionFloatCurves: 0 68 | m_Events: [] 69 | -------------------------------------------------------------------------------- /Samples/Animations/idle.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16291578d27ece74280ef251b473ca78 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 7400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Animations/walk.anim: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!74 &7400000 4 | AnimationClip: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: walk 10 | serializedVersion: 6 11 | m_Legacy: 0 12 | m_Compressed: 0 13 | m_UseHighQualityCurve: 1 14 | m_RotationCurves: [] 15 | m_CompressedRotationCurves: [] 16 | m_EulerCurves: [] 17 | m_PositionCurves: [] 18 | m_ScaleCurves: [] 19 | m_FloatCurves: [] 20 | m_PPtrCurves: 21 | - curve: 22 | - time: 0 23 | value: {fileID: 21300000, guid: 4698c45f1edcba348b5d223d64048c1c, type: 3} 24 | - time: 0.25 25 | value: {fileID: 21300000, guid: e57ca97bd61d676498892b3d2f7fb18c, type: 3} 26 | - time: 0.5 27 | value: {fileID: 21300000, guid: 4698c45f1edcba348b5d223d64048c1c, type: 3} 28 | attribute: m_Sprite 29 | path: 30 | classID: 212 31 | script: {fileID: 0} 32 | m_SampleRate: 60 33 | m_WrapMode: 0 34 | m_Bounds: 35 | m_Center: {x: 0, y: 0, z: 0} 36 | m_Extent: {x: 0, y: 0, z: 0} 37 | m_ClipBindingConstant: 38 | genericBindings: 39 | - serializedVersion: 2 40 | path: 0 41 | attribute: 0 42 | script: {fileID: 0} 43 | typeID: 212 44 | customType: 23 45 | isPPtrCurve: 1 46 | pptrCurveMapping: 47 | - {fileID: 21300000, guid: 4698c45f1edcba348b5d223d64048c1c, type: 3} 48 | - {fileID: 21300000, guid: e57ca97bd61d676498892b3d2f7fb18c, type: 3} 49 | - {fileID: 21300000, guid: 4698c45f1edcba348b5d223d64048c1c, type: 3} 50 | m_AnimationClipSettings: 51 | serializedVersion: 2 52 | m_AdditiveReferencePoseClip: {fileID: 0} 53 | m_AdditiveReferencePoseTime: 0 54 | m_StartTime: 0 55 | m_StopTime: 0.51666665 56 | m_OrientationOffsetY: 0 57 | m_Level: 0 58 | m_CycleOffset: 0 59 | m_HasAdditiveReferencePose: 0 60 | m_LoopTime: 1 61 | m_LoopBlend: 0 62 | m_LoopBlendOrientation: 0 63 | m_LoopBlendPositionY: 0 64 | m_LoopBlendPositionXZ: 0 65 | m_KeepOriginalOrientation: 0 66 | m_KeepOriginalPositionY: 1 67 | m_KeepOriginalPositionXZ: 0 68 | m_HeightFromFeet: 0 69 | m_Mirror: 0 70 | m_EditorCurves: [] 71 | m_EulerEditorCurves: [] 72 | m_HasGenericRootTransform: 0 73 | m_HasMotionFloatCurves: 0 74 | m_Events: [] 75 | -------------------------------------------------------------------------------- /Samples/Animations/walk.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 727f1d079ca1eae41b51f4b1d499c477 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 7400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/DemoScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99987e4a9fdae3b43aa44fd56db0804d 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples/Graphics.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a858e7838a75394e8fd6dea658b777f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Graphics/Character.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f18abcf9edd66a54f883c2d79ac76362 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Graphics/Character/platformChar_idle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Character/platformChar_idle.png -------------------------------------------------------------------------------- /Samples/Graphics/Character/platformChar_idle.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ddc3b6d961feb345884ffefbf2976c2 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 48 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | bones: [] 92 | spriteID: 5e97eb03825dee720800000000000000 93 | internalID: 0 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | secondaryTextures: [] 99 | spritePackingTag: 100 | pSDRemoveMatte: 0 101 | pSDShowRemoveMatteOption: 0 102 | userData: 103 | assetBundleName: 104 | assetBundleVariant: 105 | -------------------------------------------------------------------------------- /Samples/Graphics/Character/platformChar_walk1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Character/platformChar_walk1.png -------------------------------------------------------------------------------- /Samples/Graphics/Character/platformChar_walk1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4698c45f1edcba348b5d223d64048c1c 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 48 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | bones: [] 92 | spriteID: 5e97eb03825dee720800000000000000 93 | internalID: 0 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | secondaryTextures: [] 99 | spritePackingTag: 100 | pSDRemoveMatte: 0 101 | pSDShowRemoveMatteOption: 0 102 | userData: 103 | assetBundleName: 104 | assetBundleVariant: 105 | -------------------------------------------------------------------------------- /Samples/Graphics/Character/platformChar_walk2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Character/platformChar_walk2.png -------------------------------------------------------------------------------- /Samples/Graphics/Character/platformChar_walk2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e57ca97bd61d676498892b3d2f7fb18c 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 48 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | bones: [] 92 | spriteID: 5e97eb03825dee720800000000000000 93 | internalID: 0 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | secondaryTextures: [] 99 | spritePackingTag: 100 | pSDRemoveMatte: 0 101 | pSDShowRemoveMatteOption: 0 102 | userData: 103 | assetBundleName: 104 | assetBundleVariant: 105 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8fb1e8fa1de5e6842b90275559a3ae57 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/backgroundForest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Scenery/backgroundForest.png -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/backgroundForest.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c537e5919b61ff48a8642efdd673303 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 50 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | bones: [] 92 | spriteID: 5e97eb03825dee720800000000000000 93 | internalID: 0 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | secondaryTextures: [] 99 | spritePackingTag: 100 | pSDRemoveMatte: 0 101 | pSDShowRemoveMatteOption: 0 102 | userData: 103 | assetBundleName: 104 | assetBundleVariant: 105 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/cloud1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Scenery/cloud1.png -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/cloud1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e2876558a501524794787f0486e4631 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/cloud4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Scenery/cloud4.png -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/cloud4.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b590112e0e140534c9506be251dbfab4 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Scenery/foreground.png -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/foreground.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43c6d62e98bc0d148bfdd72c821d568a 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 50 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | bones: [] 92 | spriteID: 5e97eb03825dee720800000000000000 93 | internalID: 0 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | secondaryTextures: [] 99 | spritePackingTag: 100 | pSDRemoveMatte: 0 101 | pSDShowRemoveMatteOption: 0 102 | userData: 103 | assetBundleName: 104 | assetBundleVariant: 105 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/hillsLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Scenery/hillsLarge.png -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/hillsLarge.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc31c469b8850b5448a52ebad16b4d88 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 50 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | bones: [] 92 | spriteID: 5e97eb03825dee720800000000000000 93 | internalID: 0 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | secondaryTextures: [] 99 | spritePackingTag: 100 | pSDRemoveMatte: 0 101 | pSDShowRemoveMatteOption: 0 102 | userData: 103 | assetBundleName: 104 | assetBundleVariant: 105 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Scenery/sun.png -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/sun.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff272123c45893747b20ddbe0ec4cc2d 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/trees_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Scenery/trees_background.png -------------------------------------------------------------------------------- /Samples/Graphics/Scenery/trees_background.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5cbf5cf891ae10042964a8be715d6410 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 1 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 5e97eb03825dee720800000000000000 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Samples/Graphics/Tileset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8e116da53b90e247acf510d689f1e84 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Graphics/Tileset/TilesetAssets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f84c281dfdca05408cf3a420a7f4eda 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Graphics/Tileset/TilesetAssets/ParallaxDemo.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2429702539878124243 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 7177589477680718903} 12 | - component: {fileID: 1848998192409722299} 13 | - component: {fileID: 8939734442803060405} 14 | m_Layer: 31 15 | m_Name: Layer1 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &7177589477680718903 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 2429702539878124243} 28 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 6036460729731700063} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | --- !u!1839735485 &1848998192409722299 36 | Tilemap: 37 | m_ObjectHideFlags: 0 38 | m_CorrespondingSourceObject: {fileID: 0} 39 | m_PrefabInstance: {fileID: 0} 40 | m_PrefabAsset: {fileID: 0} 41 | m_GameObject: {fileID: 2429702539878124243} 42 | m_Enabled: 1 43 | m_Tiles: 44 | - first: {x: -1, y: 1, z: 0} 45 | second: 46 | serializedVersion: 2 47 | m_TileIndex: 0 48 | m_TileSpriteIndex: 0 49 | m_TileMatrixIndex: 0 50 | m_TileColorIndex: 0 51 | m_TileObjectToInstantiateIndex: 65535 52 | dummyAlignment: 0 53 | m_AllTileFlags: 1073741825 54 | m_AnimatedTiles: {} 55 | m_TileAssetArray: 56 | - m_RefCount: 1 57 | m_Data: {fileID: 11400000, guid: 96793ae36a64e18498c664b3282ad0b6, type: 2} 58 | m_TileSpriteArray: 59 | - m_RefCount: 1 60 | m_Data: {fileID: 21300000, guid: 54023bb2a7beb70428396a40dc6be120, type: 3} 61 | m_TileMatrixArray: 62 | - m_RefCount: 1 63 | m_Data: 64 | e00: 1 65 | e01: 0 66 | e02: 0 67 | e03: 0 68 | e10: 0 69 | e11: 1 70 | e12: 0 71 | e13: 0 72 | e20: 0 73 | e21: 0 74 | e22: 1 75 | e23: 0 76 | e30: 0 77 | e31: 0 78 | e32: 0 79 | e33: 1 80 | m_TileColorArray: 81 | - m_RefCount: 1 82 | m_Data: {r: 1, g: 1, b: 1, a: 1} 83 | m_TileObjectToInstantiateArray: [] 84 | m_AnimationFrameRate: 1 85 | m_Color: {r: 1, g: 1, b: 1, a: 1} 86 | m_Origin: {x: -1, y: 0, z: 0} 87 | m_Size: {x: 1, y: 2, z: 1} 88 | m_TileAnchor: {x: 0.5, y: 0.5, z: 0} 89 | m_TileOrientation: 0 90 | m_TileOrientationMatrix: 91 | e00: 1 92 | e01: 0 93 | e02: 0 94 | e03: 0 95 | e10: 0 96 | e11: 1 97 | e12: 0 98 | e13: 0 99 | e20: 0 100 | e21: 0 101 | e22: 1 102 | e23: 0 103 | e30: 0 104 | e31: 0 105 | e32: 0 106 | e33: 1 107 | --- !u!483693784 &8939734442803060405 108 | TilemapRenderer: 109 | m_ObjectHideFlags: 0 110 | m_CorrespondingSourceObject: {fileID: 0} 111 | m_PrefabInstance: {fileID: 0} 112 | m_PrefabAsset: {fileID: 0} 113 | m_GameObject: {fileID: 2429702539878124243} 114 | m_Enabled: 0 115 | m_CastShadows: 0 116 | m_ReceiveShadows: 0 117 | m_DynamicOccludee: 0 118 | m_MotionVectors: 1 119 | m_LightProbeUsage: 0 120 | m_ReflectionProbeUsage: 0 121 | m_RayTracingMode: 0 122 | m_RenderingLayerMask: 1 123 | m_RendererPriority: 0 124 | m_Materials: 125 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 126 | m_StaticBatchInfo: 127 | firstSubMesh: 0 128 | subMeshCount: 0 129 | m_StaticBatchRoot: {fileID: 0} 130 | m_ProbeAnchor: {fileID: 0} 131 | m_LightProbeVolumeOverride: {fileID: 0} 132 | m_ScaleInLightmap: 1 133 | m_ReceiveGI: 1 134 | m_PreserveUVs: 0 135 | m_IgnoreNormalsForChartDetection: 0 136 | m_ImportantGI: 0 137 | m_StitchLightmapSeams: 1 138 | m_SelectedEditorRenderState: 0 139 | m_MinimumChartSize: 4 140 | m_AutoUVMaxDistance: 0.5 141 | m_AutoUVMaxAngle: 89 142 | m_LightmapParameters: {fileID: 0} 143 | m_SortingLayerID: 0 144 | m_SortingLayer: 0 145 | m_SortingOrder: 0 146 | m_ChunkSize: {x: 32, y: 32, z: 32} 147 | m_ChunkCullingBounds: {x: 0, y: 0, z: 0} 148 | m_MaxChunkCount: 16 149 | m_MaxFrameAge: 16 150 | m_SortOrder: 0 151 | m_Mode: 0 152 | m_DetectChunkCullingBounds: 0 153 | m_MaskInteraction: 0 154 | --- !u!1 &3605564759505730179 155 | GameObject: 156 | m_ObjectHideFlags: 0 157 | m_CorrespondingSourceObject: {fileID: 0} 158 | m_PrefabInstance: {fileID: 0} 159 | m_PrefabAsset: {fileID: 0} 160 | serializedVersion: 6 161 | m_Component: 162 | - component: {fileID: 6036460729731700063} 163 | - component: {fileID: 7414998177508030131} 164 | m_Layer: 31 165 | m_Name: ParallaxDemo 166 | m_TagString: Untagged 167 | m_Icon: {fileID: 0} 168 | m_NavMeshLayer: 0 169 | m_StaticEditorFlags: 0 170 | m_IsActive: 1 171 | --- !u!4 &6036460729731700063 172 | Transform: 173 | m_ObjectHideFlags: 0 174 | m_CorrespondingSourceObject: {fileID: 0} 175 | m_PrefabInstance: {fileID: 0} 176 | m_PrefabAsset: {fileID: 0} 177 | m_GameObject: {fileID: 3605564759505730179} 178 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 179 | m_LocalPosition: {x: 0, y: 0, z: 0} 180 | m_LocalScale: {x: 1, y: 1, z: 1} 181 | m_Children: 182 | - {fileID: 7177589477680718903} 183 | m_Father: {fileID: 0} 184 | m_RootOrder: 0 185 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 186 | --- !u!156049354 &7414998177508030131 187 | Grid: 188 | m_ObjectHideFlags: 0 189 | m_CorrespondingSourceObject: {fileID: 0} 190 | m_PrefabInstance: {fileID: 0} 191 | m_PrefabAsset: {fileID: 0} 192 | m_GameObject: {fileID: 3605564759505730179} 193 | m_Enabled: 1 194 | m_CellSize: {x: 1, y: 1, z: 0} 195 | m_CellGap: {x: 0, y: 0, z: 0} 196 | m_CellLayout: 0 197 | m_CellSwizzle: 0 198 | --- !u!114 &-1270296855746313272 199 | MonoBehaviour: 200 | m_ObjectHideFlags: 0 201 | m_CorrespondingSourceObject: {fileID: 0} 202 | m_PrefabInstance: {fileID: 0} 203 | m_PrefabAsset: {fileID: 0} 204 | m_GameObject: {fileID: 0} 205 | m_Enabled: 1 206 | m_EditorHideFlags: 0 207 | m_Script: {fileID: 12395, guid: 0000000000000000e000000000000000, type: 0} 208 | m_Name: Palette Settings 209 | m_EditorClassIdentifier: 210 | cellSizing: 0 211 | -------------------------------------------------------------------------------- /Samples/Graphics/Tileset/TilesetAssets/ParallaxDemo.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f540bbfe61373a2488c5e65d744a0c7f 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples/Graphics/Tileset/TilesetAssets/platformPack_tile001.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: 13312, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: platformPack_tile001 14 | m_EditorClassIdentifier: 15 | m_Sprite: {fileID: 21300000, guid: 54023bb2a7beb70428396a40dc6be120, type: 3} 16 | m_Color: {r: 1, g: 1, b: 1, a: 1} 17 | m_Transform: 18 | e00: 1 19 | e01: 0 20 | e02: 0 21 | e03: 0 22 | e10: 0 23 | e11: 1 24 | e12: 0 25 | e13: 0 26 | e20: 0 27 | e21: 0 28 | e22: 1 29 | e23: 0 30 | e30: 0 31 | e31: 0 32 | e32: 0 33 | e33: 1 34 | m_InstancedGameObject: {fileID: 0} 35 | m_Flags: 1 36 | m_ColliderType: 1 37 | -------------------------------------------------------------------------------- /Samples/Graphics/Tileset/TilesetAssets/platformPack_tile001.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96793ae36a64e18498c664b3282ad0b6 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Graphics/Tileset/platformPack_tile001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PixelRubro/ParallaxerSystemForUnity/6bdddb5cedbe46381412449b65ad63a77b9fb97f/Samples/Graphics/Tileset/platformPack_tile001.png -------------------------------------------------------------------------------- /Samples/Graphics/Tileset/platformPack_tile001.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54023bb2a7beb70428396a40dc6be120 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 64 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 0 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 0 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | spriteSheet: 87 | serializedVersion: 2 88 | sprites: [] 89 | outline: [] 90 | physicsShape: [] 91 | bones: [] 92 | spriteID: 5e97eb03825dee720800000000000000 93 | internalID: 0 94 | vertices: [] 95 | indices: 96 | edges: [] 97 | weights: [] 98 | secondaryTextures: [] 99 | spritePackingTag: 100 | pSDRemoveMatte: 0 101 | pSDShowRemoveMatteOption: 0 102 | userData: 103 | assetBundleName: 104 | assetBundleVariant: 105 | -------------------------------------------------------------------------------- /Samples/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57c20e8197a3f0647bfb65329bf0e71a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples/Scripts/CameraFollow.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace PixelRouge.Parallaxer.Demo 6 | { 7 | public class CameraFollow : MonoBehaviour 8 | { 9 | [SerializeField] 10 | private float interpVelocity; 11 | 12 | [SerializeField] 13 | private float minDistance; 14 | 15 | [SerializeField] 16 | private float followDistance; 17 | 18 | [SerializeField] 19 | private GameObject target; 20 | 21 | [SerializeField] 22 | private Vector3 offset; 23 | 24 | private Transform _transform; 25 | 26 | void Start () 27 | { 28 | _transform = transform; 29 | } 30 | 31 | void FixedUpdate () 32 | { 33 | if (target) 34 | { 35 | Vector3 posNoZ = _transform.position; 36 | posNoZ.z = target.transform.position.z; 37 | 38 | Vector3 targetDirection = (target.transform.position - posNoZ); 39 | 40 | interpVelocity = targetDirection.magnitude * 5f; 41 | 42 | var targetPos = _transform.position + (targetDirection.normalized * interpVelocity * Time.deltaTime); 43 | 44 | _transform.position = Vector3.Lerp( transform.position, targetPos + offset, 0.25f); 45 | 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Samples/Scripts/CameraFollow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6af18c01c10bb324db62a7bf9ae12b64 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples/Scripts/PlayerController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace PixelRouge.Parallaxer.Demo 6 | { 7 | public class PlayerController : MonoBehaviour 8 | { 9 | [SerializeField] 10 | private float _movingSpeed = 6f; 11 | 12 | [SerializeField] 13 | private float _jumpStrength = 8f; 14 | 15 | private Transform _transform; 16 | 17 | private Rigidbody2D _rb2d; 18 | 19 | private SpriteRenderer _spriteRenderer; 20 | 21 | private Animator _animator; 22 | 23 | private float _previousHorizontalVelocity; 24 | 25 | private bool _isFacingRight = true; 26 | 27 | private void Awake() 28 | { 29 | _rb2d = GetComponent(); 30 | _spriteRenderer = GetComponent(); 31 | _animator = GetComponent(); 32 | _transform = transform; 33 | } 34 | 35 | private void Update() 36 | { 37 | Move(); 38 | Jump(); 39 | } 40 | 41 | private void Move() 42 | { 43 | var horizontalInput = Input.GetAxisRaw("Horizontal"); 44 | var verticalInput = Input.GetAxisRaw("Vertical"); 45 | 46 | _rb2d.velocity = new Vector2(horizontalInput * _movingSpeed, _rb2d.velocity.y); 47 | CheckDirection(horizontalInput); 48 | PlayAnimation(horizontalInput); 49 | } 50 | 51 | private void CheckDirection(float horizontalInput) 52 | { 53 | if (horizontalInput == 0f) 54 | { 55 | return; 56 | } 57 | 58 | if (horizontalInput > 0f) 59 | { 60 | if (!_isFacingRight) 61 | { 62 | FlipDirection(); 63 | } 64 | } 65 | else 66 | { 67 | if (_isFacingRight) 68 | { 69 | FlipDirection(); 70 | } 71 | } 72 | } 73 | 74 | private void FlipDirection() 75 | { 76 | _isFacingRight = !_isFacingRight; 77 | _transform.localScale = new Vector3(_transform.localScale.x * -1f, _transform.localScale.y, _transform.localScale.z); 78 | } 79 | 80 | private void Jump() 81 | { 82 | if (Input.GetKeyDown(KeyCode.Space) && Mathf.Approximately(_rb2d.velocity.y, 0f)) 83 | { 84 | _rb2d.AddForce(Vector2.up * _jumpStrength, ForceMode2D.Impulse); 85 | } 86 | } 87 | 88 | private void PlayAnimation(float horizontalInput) 89 | { 90 | if (horizontalInput == 0) 91 | { 92 | _animator.Play("idle"); 93 | } 94 | else 95 | { 96 | if (Mathf.Approximately(_rb2d.velocity.y, 0f)) 97 | { 98 | _animator.Play("walk"); 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Samples/Scripts/PlayerController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9be823c701065b04ba0d500dfa081955 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples/Scripts/com.pixelrouge.parallaxersystemforunity.Samples.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.pixelrouge.parallaxersystemforunity.Samples" 3 | } 4 | -------------------------------------------------------------------------------- /Samples/Scripts/com.pixelrouge.parallaxersystemforunity.Samples.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27425a09f07a76b44a05dbad9d0a6d70 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Third Party Notices.md: -------------------------------------------------------------------------------- 1 | # Demo license 2 | 3 | Graphic assets made by Kenney: 4 | 5 | - 6 | - 7 | 8 | C# scripts under MIT license 9 | -------------------------------------------------------------------------------- /Third Party Notices.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f98a0e65a2db91c49a937a69f84ad7e5 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.pixelrouge.parallaxersystemforunity", 3 | "displayName": "Parallaxer System for Unity", 4 | "description": "A package created to speed up parallax effect implementation in Unity projects.", 5 | "version": "1.0.0", 6 | "unity": "2019.4", 7 | "license": "MIT", 8 | "author": { 9 | "name": "Pixel Rouge Studio" 10 | } 11 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee00fdbe1fb5e0249ac6885acea543c7 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------