diff options
| author | chai <215380520@qq.com> | 2024-05-19 16:05:58 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2024-05-19 16:05:58 +0800 |
| commit | 8e13e7e2874adc8982e16d1d2ed2e28d7480b45f (patch) | |
| tree | 63ef85c460288891f5a593d69afeca16cba050b3 /Thronefall_1_57/Decompile/FlatKit | |
| parent | c5f145786f4c6d2fe4bea831dfc16e52228920a5 (diff) | |
+1.57
Diffstat (limited to 'Thronefall_1_57/Decompile/FlatKit')
| -rw-r--r-- | Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs | 80 | ||||
| -rw-r--r-- | Thronefall_1_57/Decompile/FlatKit/Buoyancy.cs | 105 | ||||
| -rw-r--r-- | Thronefall_1_57/Decompile/FlatKit/FlatKitFog.cs | 175 | ||||
| -rw-r--r-- | Thronefall_1_57/Decompile/FlatKit/FlatKitOutline.cs | 139 | ||||
| -rw-r--r-- | Thronefall_1_57/Decompile/FlatKit/FogSettings.cs | 59 | ||||
| -rw-r--r-- | Thronefall_1_57/Decompile/FlatKit/OutlineSettings.cs | 61 | ||||
| -rw-r--r-- | Thronefall_1_57/Decompile/FlatKit/UvScroller.cs | 34 |
7 files changed, 653 insertions, 0 deletions
diff --git a/Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs b/Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs new file mode 100644 index 0000000..5b9e754 --- /dev/null +++ b/Thronefall_1_57/Decompile/FlatKit/BlitTexturePass.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +namespace FlatKit; + +internal class BlitTexturePass : ScriptableRenderPass +{ + public static readonly string CopyEffectShaderName = "Hidden/FlatKit/CopyTexture"; + + private ProfilingSampler _profilingSampler; + + private Material _effectMaterial; + + private Material _copyMaterial; + + private RenderTargetHandle _temporaryColorTexture; + + public void Setup(Material effectMaterial, bool useDepth, bool useNormals, bool useColor) + { + _effectMaterial = effectMaterial; + string text = effectMaterial.name.Substring(effectMaterial.name.LastIndexOf('/') + 1); + _profilingSampler = new ProfilingSampler("Blit " + text); + _copyMaterial = CoreUtils.CreateEngineMaterial(CopyEffectShaderName); + ConfigureInput((useColor ? ScriptableRenderPassInput.Color : ScriptableRenderPassInput.None) | (useDepth ? ScriptableRenderPassInput.Depth : ScriptableRenderPassInput.None) | (useNormals ? ScriptableRenderPassInput.Normal : ScriptableRenderPassInput.None)); + } + + public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) + { + ConfigureTarget(new RenderTargetIdentifier(renderingData.cameraData.renderer.cameraColorTarget, 0, CubemapFace.Unknown, -1)); + } + + public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) + { + if (_effectMaterial == null || renderingData.cameraData.camera.cameraType != CameraType.Game) + { + return; + } + _temporaryColorTexture = default(RenderTargetHandle); + CommandBuffer commandBuffer = CommandBufferPool.Get(); + using (new ProfilingScope(commandBuffer, _profilingSampler)) + { + RenderTextureDescriptor cameraTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor; + cameraTargetDescriptor.depthBufferBits = 0; + SetSourceSize(commandBuffer, cameraTargetDescriptor); + RTHandle cameraColorTargetHandle = renderingData.cameraData.renderer.cameraColorTargetHandle; + commandBuffer.GetTemporaryRT(_temporaryColorTexture.id, cameraTargetDescriptor); + if (renderingData.cameraData.xrRendering) + { + _effectMaterial.EnableKeyword("_USE_DRAW_PROCEDURAL"); + commandBuffer.SetRenderTarget(_temporaryColorTexture.Identifier()); + commandBuffer.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, _effectMaterial, 0, 0); + commandBuffer.SetGlobalTexture("_EffectTexture", _temporaryColorTexture.Identifier()); + commandBuffer.SetRenderTarget(new RenderTargetIdentifier(cameraColorTargetHandle, 0, CubemapFace.Unknown, -1)); + commandBuffer.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, _copyMaterial, 0, 0); + } + else + { + _effectMaterial.DisableKeyword("_USE_DRAW_PROCEDURAL"); + commandBuffer.Blit(cameraColorTargetHandle, _temporaryColorTexture.Identifier(), _effectMaterial, 0); + commandBuffer.Blit(_temporaryColorTexture.Identifier(), cameraColorTargetHandle); + } + } + context.ExecuteCommandBuffer(commandBuffer); + commandBuffer.Clear(); + CommandBufferPool.Release(commandBuffer); + } + + private static void SetSourceSize(CommandBuffer cmd, RenderTextureDescriptor desc) + { + float num = desc.width; + float num2 = desc.height; + if (desc.useDynamicScale) + { + num *= ScalableBufferManager.widthScaleFactor; + num2 *= ScalableBufferManager.heightScaleFactor; + } + cmd.SetGlobalVector("_SourceSize", new Vector4(num, num2, 1f / num, 1f / num2)); + } +} diff --git a/Thronefall_1_57/Decompile/FlatKit/Buoyancy.cs b/Thronefall_1_57/Decompile/FlatKit/Buoyancy.cs new file mode 100644 index 0000000..9e876ab --- /dev/null +++ b/Thronefall_1_57/Decompile/FlatKit/Buoyancy.cs @@ -0,0 +1,105 @@ +using UnityEngine; + +namespace FlatKit; + +public class Buoyancy : MonoBehaviour +{ + [Tooltip("The object that contains a Water material.")] + public Transform water; + + [Space] + [Tooltip("Range of probing wave height for buoyancy rotation.")] + public float size = 1f; + + [Tooltip("Max height of buoyancy going up and down.")] + public float amplitude = 1f; + + [Space] + [Tooltip("Optionally provide a separate material to get the wave parameters.")] + public Material overrideWaterMaterial; + + private Material _material; + + private float _speed; + + private float _amplitude; + + private float _frequency; + + private float _direction; + + private Vector3 _originalPosition; + + private void Start() + { + Renderer component = water.GetComponent<Renderer>(); + _material = ((overrideWaterMaterial != null) ? overrideWaterMaterial : component.sharedMaterial); + _speed = _material.GetFloat("_WaveSpeed"); + _amplitude = _material.GetFloat("_WaveAmplitude"); + _frequency = _material.GetFloat("_WaveFrequency"); + _direction = _material.GetFloat("_WaveDirection"); + Transform transform = base.transform; + _originalPosition = transform.position; + } + + private void Update() + { + Vector3 position = base.transform.position; + Vector3 positionOS = water.InverseTransformPoint(position); + position.y = GetHeightOS(positionOS) + _originalPosition.y; + base.transform.position = position; + base.transform.up = GetNormalWS(positionOS); + } + + private Vector2 GradientNoiseDir(Vector2 p) + { + p = new Vector2(p.x % 289f, p.y % 289f); + float num = (34f * p.x + 1f) * p.x % 289f + p.y; + num = (34f * num + 1f) * num % 289f; + num = num / 41f % 1f * 2f - 1f; + return new Vector2(num - Mathf.Floor(num + 0.5f), Mathf.Abs(num) - 0.5f).normalized; + } + + private float GradientNoise(Vector2 p) + { + Vector2 vector = new Vector2(Mathf.Floor(p.x), Mathf.Floor(p.y)); + Vector2 vector2 = new Vector2(p.x % 1f, p.y % 1f); + float a = Vector3.Dot(GradientNoiseDir(vector), vector2); + float b = Vector3.Dot(GradientNoiseDir(vector + Vector2.up), vector2 - Vector2.up); + float a2 = Vector3.Dot(GradientNoiseDir(vector + Vector2.right), vector2 - Vector2.right); + float b2 = Vector3.Dot(GradientNoiseDir(vector + Vector2.one), vector2 - Vector2.one); + vector2 = vector2 * vector2 * vector2 * (vector2 * (vector2 * 6f - Vector2.one * 15f) + Vector2.one * 10f); + return Mathf.Lerp(Mathf.Lerp(a, b, vector2.y), Mathf.Lerp(a2, b2, vector2.y), vector2.x); + } + + private Vector3 GetNormalWS(Vector3 positionOS) + { + Vector3 vector = positionOS + Vector3.forward * size; + vector.y = GetHeightOS(vector); + Vector3 vector2 = positionOS + Vector3.right * size; + vector2.y = GetHeightOS(vector); + Vector3 normalized = Vector3.Cross(vector - positionOS, vector2 - positionOS).normalized; + return water.TransformDirection(normalized); + } + + private float SineWave(Vector3 positionOS, float offset) + { + float num = Time.timeSinceLevelLoad * 2f; + float num2 = Mathf.Sin(offset + num * _speed + (positionOS.x * Mathf.Sin(offset + _direction) + positionOS.z * Mathf.Cos(offset + _direction)) * _frequency); + if (_material.IsKeywordEnabled("_WAVEMODE_POINTY")) + { + num2 = 1f - Mathf.Abs(num2); + } + return num2 * _amplitude; + } + + private float GetHeightOS(Vector3 positionOS) + { + float num = SineWave(positionOS, 0f); + if (_material.IsKeywordEnabled("_WAVEMODE_GRID")) + { + num *= SineWave(positionOS, 1.57f); + } + return num * amplitude; + } +} diff --git a/Thronefall_1_57/Decompile/FlatKit/FlatKitFog.cs b/Thronefall_1_57/Decompile/FlatKit/FlatKitFog.cs new file mode 100644 index 0000000..6991bf9 --- /dev/null +++ b/Thronefall_1_57/Decompile/FlatKit/FlatKitFog.cs @@ -0,0 +1,175 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +namespace FlatKit; + +public class FlatKitFog : ScriptableRendererFeature +{ + [Tooltip("To create new settings use 'Create > FlatKit > Fog Settings'.")] + public FogSettings settings; + + [SerializeField] + [HideInInspector] + private Material _effectMaterial; + + private BlitTexturePass _blitTexturePass; + + private RenderTargetHandle _fogTexture; + + private Texture2D _lutDepth; + + private Texture2D _lutHeight; + + private static readonly string FogShaderName = "Hidden/FlatKit/FogFilter"; + + private static readonly int DistanceLut = Shader.PropertyToID("_DistanceLUT"); + + private static readonly int Near = Shader.PropertyToID("_Near"); + + private static readonly int Far = Shader.PropertyToID("_Far"); + + private static readonly int UseDistanceFog = Shader.PropertyToID("_UseDistanceFog"); + + private static readonly int UseDistanceFogOnSky = Shader.PropertyToID("_UseDistanceFogOnSky"); + + private static readonly int DistanceFogIntensity = Shader.PropertyToID("_DistanceFogIntensity"); + + private static readonly int HeightLut = Shader.PropertyToID("_HeightLUT"); + + private static readonly int LowWorldY = Shader.PropertyToID("_LowWorldY"); + + private static readonly int HighWorldY = Shader.PropertyToID("_HighWorldY"); + + private static readonly int UseHeightFog = Shader.PropertyToID("_UseHeightFog"); + + private static readonly int UseHeightFogOnSky = Shader.PropertyToID("_UseHeightFogOnSky"); + + private static readonly int HeightFogIntensity = Shader.PropertyToID("_HeightFogIntensity"); + + private static readonly int DistanceHeightBlend = Shader.PropertyToID("_DistanceHeightBlend"); + + public override void Create() + { + if (settings == null) + { + Debug.LogWarning("[FlatKit] Missing Fog Settings"); + return; + } + _blitTexturePass = new BlitTexturePass + { + renderPassEvent = settings.renderEvent + }; + _fogTexture.Init("_EffectTexture"); + } + + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) + { + if (settings == null) + { + Debug.LogWarning("[FlatKit] Missing Fog Settings"); + } + else if (CreateMaterials()) + { + SetMaterialProperties(); + _blitTexturePass.Setup(_effectMaterial, useDepth: true, useNormals: false, useColor: false); + renderer.EnqueuePass(_blitTexturePass); + } + } + + protected override void Dispose(bool disposing) + { + CoreUtils.Destroy(_effectMaterial); + } + + private bool CreateMaterials() + { + if (_effectMaterial == null) + { + Shader shader = Shader.Find(FogShaderName); + Shader shader2 = Shader.Find(BlitTexturePass.CopyEffectShaderName); + if (shader == null || shader2 == null) + { + return false; + } + _effectMaterial = CoreUtils.CreateEngineMaterial(shader); + } + return true; + } + + private void SetMaterialProperties() + { + if (!(_effectMaterial == null)) + { + UpdateDistanceLut(); + _effectMaterial.SetTexture(DistanceLut, _lutDepth); + _effectMaterial.SetFloat(Near, settings.near); + _effectMaterial.SetFloat(Far, settings.far); + _effectMaterial.SetFloat(UseDistanceFog, settings.useDistance ? 1f : 0f); + _effectMaterial.SetFloat(UseDistanceFogOnSky, settings.useDistanceFogOnSky ? 1f : 0f); + _effectMaterial.SetFloat(DistanceFogIntensity, settings.distanceFogIntensity); + UpdateHeightLut(); + _effectMaterial.SetTexture(HeightLut, _lutHeight); + _effectMaterial.SetFloat(LowWorldY, settings.low); + _effectMaterial.SetFloat(HighWorldY, settings.high); + _effectMaterial.SetFloat(UseHeightFog, settings.useHeight ? 1f : 0f); + _effectMaterial.SetFloat(UseHeightFogOnSky, settings.useHeightFogOnSky ? 1f : 0f); + _effectMaterial.SetFloat(HeightFogIntensity, settings.heightFogIntensity); + _effectMaterial.SetFloat(DistanceHeightBlend, settings.distanceHeightBlend); + } + } + + private void UpdateDistanceLut() + { + if (settings.distanceGradient == null) + { + return; + } + if (_lutDepth != null) + { + Object.DestroyImmediate(_lutDepth); + } + _lutDepth = new Texture2D(256, 1, TextureFormat.RGBA32, mipChain: false) + { + wrapMode = TextureWrapMode.Clamp, + hideFlags = HideFlags.HideAndDontSave, + filterMode = FilterMode.Bilinear + }; + for (float num = 0f; num < 256f; num += 1f) + { + Color color = settings.distanceGradient.Evaluate(num / 255f); + for (float num2 = 0f; num2 < 1f; num2 += 1f) + { + _lutDepth.SetPixel(Mathf.CeilToInt(num), Mathf.CeilToInt(num2), color); + } + } + _lutDepth.Apply(); + } + + private void UpdateHeightLut() + { + if (settings.heightGradient == null) + { + return; + } + if (_lutHeight != null) + { + Object.DestroyImmediate(_lutHeight); + } + _lutHeight = new Texture2D(256, 1, TextureFormat.RGBA32, mipChain: false) + { + wrapMode = TextureWrapMode.Clamp, + hideFlags = HideFlags.HideAndDontSave, + filterMode = FilterMode.Bilinear + }; + for (float num = 0f; num < 256f; num += 1f) + { + Color color = settings.heightGradient.Evaluate(num / 255f); + for (float num2 = 0f; num2 < 1f; num2 += 1f) + { + _lutHeight.SetPixel(Mathf.CeilToInt(num), Mathf.CeilToInt(num2), color); + } + } + _lutHeight.Apply(); + } +} diff --git a/Thronefall_1_57/Decompile/FlatKit/FlatKitOutline.cs b/Thronefall_1_57/Decompile/FlatKit/FlatKitOutline.cs new file mode 100644 index 0000000..aefc75d --- /dev/null +++ b/Thronefall_1_57/Decompile/FlatKit/FlatKitOutline.cs @@ -0,0 +1,139 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; + +namespace FlatKit; + +public class FlatKitOutline : ScriptableRendererFeature +{ + [Tooltip("To create new settings use 'Create > FlatKit > Outline Settings'.")] + public OutlineSettings settings; + + [SerializeField] + [HideInInspector] + private Material _effectMaterial; + + private BlitTexturePass _blitTexturePass; + + private static readonly string OutlineShaderName = "Hidden/FlatKit/OutlineFilter"; + + private static readonly int EdgeColor = Shader.PropertyToID("_EdgeColor"); + + private static readonly int Thickness = Shader.PropertyToID("_Thickness"); + + private static readonly int DepthThresholdMin = Shader.PropertyToID("_DepthThresholdMin"); + + private static readonly int DepthThresholdMax = Shader.PropertyToID("_DepthThresholdMax"); + + private static readonly int NormalThresholdMin = Shader.PropertyToID("_NormalThresholdMin"); + + private static readonly int NormalThresholdMax = Shader.PropertyToID("_NormalThresholdMax"); + + private static readonly int ColorThresholdMin = Shader.PropertyToID("_ColorThresholdMin"); + + private static readonly int ColorThresholdMax = Shader.PropertyToID("_ColorThresholdMax"); + + public override void Create() + { + if (settings == null) + { + Debug.LogWarning("[FlatKit] Missing Outline Settings"); + } + else if (_blitTexturePass == null) + { + _blitTexturePass = new BlitTexturePass + { + renderPassEvent = settings.renderEvent + }; + } + } + + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) + { + if (settings == null) + { + Debug.LogWarning("[FlatKit] Missing Outline Settings"); + } + else if (CreateMaterials()) + { + SetMaterialProperties(); + _blitTexturePass.Setup(_effectMaterial, settings.useDepth, settings.useNormals, useColor: true); + renderer.EnqueuePass(_blitTexturePass); + } + } + + protected override void Dispose(bool disposing) + { + CoreUtils.Destroy(_effectMaterial); + } + + private bool CreateMaterials() + { + if (_effectMaterial == null) + { + Shader shader = Shader.Find(OutlineShaderName); + Shader shader2 = Shader.Find(BlitTexturePass.CopyEffectShaderName); + if (shader == null || shader2 == null) + { + return false; + } + _effectMaterial = CoreUtils.CreateEngineMaterial(shader); + } + return true; + } + + private void SetMaterialProperties() + { + if (!(_effectMaterial == null)) + { + if (settings.useDepth) + { + _effectMaterial.EnableKeyword("OUTLINE_USE_DEPTH"); + } + else + { + _effectMaterial.DisableKeyword("OUTLINE_USE_DEPTH"); + } + if (settings.useNormals) + { + _effectMaterial.EnableKeyword("OUTLINE_USE_NORMALS"); + } + else + { + _effectMaterial.DisableKeyword("OUTLINE_USE_NORMALS"); + } + if (settings.useColor) + { + _effectMaterial.EnableKeyword("OUTLINE_USE_COLOR"); + } + else + { + _effectMaterial.DisableKeyword("OUTLINE_USE_COLOR"); + } + if (settings.outlineOnly) + { + _effectMaterial.EnableKeyword("OUTLINE_ONLY"); + } + else + { + _effectMaterial.DisableKeyword("OUTLINE_ONLY"); + } + if (settings.resolutionInvariant) + { + _effectMaterial.EnableKeyword("RESOLUTION_INVARIANT_THICKNESS"); + } + else + { + _effectMaterial.DisableKeyword("RESOLUTION_INVARIANT_THICKNESS"); + } + _effectMaterial.SetColor(EdgeColor, settings.edgeColor); + _effectMaterial.SetFloat(Thickness, settings.thickness); + _effectMaterial.SetFloat(DepthThresholdMin, settings.minDepthThreshold); + _effectMaterial.SetFloat(DepthThresholdMax, settings.maxDepthThreshold); + _effectMaterial.SetFloat(NormalThresholdMin, settings.minNormalsThreshold); + _effectMaterial.SetFloat(NormalThresholdMax, settings.maxNormalsThreshold); + _effectMaterial.SetFloat(ColorThresholdMin, settings.minColorThreshold); + _effectMaterial.SetFloat(ColorThresholdMax, settings.maxColorThreshold); + } + } +} diff --git a/Thronefall_1_57/Decompile/FlatKit/FogSettings.cs b/Thronefall_1_57/Decompile/FlatKit/FogSettings.cs new file mode 100644 index 0000000..60e5eb0 --- /dev/null +++ b/Thronefall_1_57/Decompile/FlatKit/FogSettings.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using UnityEngine.Rendering.Universal; + +namespace FlatKit; + +[CreateAssetMenu(fileName = "FogSettings", menuName = "FlatKit/Fog Settings")] +public class FogSettings : ScriptableObject +{ + [Header("Distance Fog")] + public bool useDistance = true; + + public Gradient distanceGradient; + + public float near; + + public float far = 100f; + + [Range(0f, 1f)] + public float distanceFogIntensity = 1f; + + public bool useDistanceFogOnSky; + + [Header("Height Fog")] + [Space] + public bool useHeight; + + public Gradient heightGradient; + + public float low; + + public float high = 10f; + + [Range(0f, 1f)] + public float heightFogIntensity = 1f; + + public bool useHeightFogOnSky; + + [Header("Blending")] + [Space] + [Range(0f, 1f)] + public float distanceHeightBlend = 0.5f; + + [Header("Advanced settings")] + [Space] + [Tooltip("The render stage at which the effect is applied. To exclude transparent objects, like water or UI elements, set this to \"Before Transparent\".")] + public RenderPassEvent renderEvent = RenderPassEvent.BeforeRenderingPostProcessing; + + private void OnValidate() + { + if (low > high) + { + Debug.LogWarning("[FlatKit] Fog Height configuration error: 'Low' must not be greater than 'High'"); + } + if (near > far) + { + Debug.LogWarning("[FlatKit] Fog Distance configuration error: 'Near' must not be greater than 'Far'"); + } + } +} diff --git a/Thronefall_1_57/Decompile/FlatKit/OutlineSettings.cs b/Thronefall_1_57/Decompile/FlatKit/OutlineSettings.cs new file mode 100644 index 0000000..47a6b97 --- /dev/null +++ b/Thronefall_1_57/Decompile/FlatKit/OutlineSettings.cs @@ -0,0 +1,61 @@ +using UnityEngine; +using UnityEngine.Rendering.Universal; + +namespace FlatKit; + +[CreateAssetMenu(fileName = "OutlineSettings", menuName = "FlatKit/Outline Settings")] +public class OutlineSettings : ScriptableObject +{ + public Color edgeColor = Color.white; + + [Range(0f, 5f)] + public int thickness = 1; + + [Tooltip("If enabled, the line width will stay constant regardless of the rendering resolution. However, some of the lines may appear blurry.")] + public bool resolutionInvariant; + + [Space] + public bool useDepth = true; + + public bool useNormals; + + public bool useColor; + + [Header("Advanced settings")] + public float minDepthThreshold; + + public float maxDepthThreshold = 0.25f; + + [Space] + public float minNormalsThreshold; + + public float maxNormalsThreshold = 0.25f; + + [Space] + public float minColorThreshold; + + public float maxColorThreshold = 0.25f; + + [Space] + [Tooltip("The render stage at which the effect is applied. To exclude transparent objects, like water or UI elements, set this to \"Before Transparent\".")] + public RenderPassEvent renderEvent = RenderPassEvent.BeforeRenderingPostProcessing; + + [Space] + public bool outlineOnly; + + private void OnValidate() + { + if (minDepthThreshold > maxDepthThreshold) + { + Debug.LogWarning("[FlatKit] Outline configuration error: 'Min Depth Threshold' must not be greater than 'Max Depth Threshold'"); + } + if (minNormalsThreshold > maxNormalsThreshold) + { + Debug.LogWarning("[FlatKit] Outline configuration error: 'Min Normals Threshold' must not be greater than 'Max Normals Threshold'"); + } + if (minColorThreshold > maxColorThreshold) + { + Debug.LogWarning("[FlatKit] Outline configuration error: 'Min Color Threshold' must not be greater than 'Max Color Threshold'"); + } + } +} diff --git a/Thronefall_1_57/Decompile/FlatKit/UvScroller.cs b/Thronefall_1_57/Decompile/FlatKit/UvScroller.cs new file mode 100644 index 0000000..e3ab4a3 --- /dev/null +++ b/Thronefall_1_57/Decompile/FlatKit/UvScroller.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +namespace FlatKit; + +public class UvScroller : MonoBehaviour +{ + public Material targetMaterial; + + public float speedX; + + public float speedY; + + private Vector2 offset; + + private Vector2 initOffset; + + private void Start() + { + offset = targetMaterial.mainTextureOffset; + initOffset = targetMaterial.mainTextureOffset; + } + + private void OnDisable() + { + targetMaterial.mainTextureOffset = initOffset; + } + + private void Update() + { + offset.x += speedX * Time.deltaTime; + offset.y += speedY * Time.deltaTime; + targetMaterial.mainTextureOffset = offset; + } +} |
