diff --git a/Assets/Accessibility/Accessibility Options.asset b/Assets/Accessibility/Accessibility Options.asset index 88eea28..88f7b1e 100644 --- a/Assets/Accessibility/Accessibility Options.asset +++ b/Assets/Accessibility/Accessibility Options.asset @@ -14,8 +14,8 @@ MonoBehaviour: m_EditorClassIdentifier: _mode: 2 _calm: - _tunnel: {fileID: 2100000, guid: 735a92a62479ffd458216009452fec2b, type: 2} - _vibe: - _tunnel: {fileID: 2100000, guid: 9429becea685bce4fa7b6595601ea615, type: 2} - _party: _tunnel: {fileID: 2100000, guid: 439b4d6018bd23e4e91136d099c5b815, type: 2} + _vibe: + _tunnel: {fileID: 2100000, guid: 735a92a62479ffd458216009452fec2b, type: 2} + _party: + _tunnel: {fileID: 2100000, guid: 9429becea685bce4fa7b6595601ea615, type: 2} diff --git a/Assets/Audio/Audio Visualiser.asset b/Assets/Audio/Audio Visualiser.asset index 1a1a9eb..b688704 100644 --- a/Assets/Audio/Audio Visualiser.asset +++ b/Assets/Audio/Audio Visualiser.asset @@ -24,6 +24,14 @@ MonoBehaviour: multiplier: 2 channel: 0 sample: 355 + - name: _NebulaWeight + multiplier: 5 + channel: 0 + sample: 355 + - name: _BarsWeight + multiplier: -500 + channel: 1 + sample: 525 _shipAnimations: - name: _VertexScale multiplier: 3703.2 diff --git a/Assets/Data/Camera Shake Duration.asset b/Assets/Data/Camera Shake Duration.asset index ae99f48..7bacbc0 100644 --- a/Assets/Data/Camera Shake Duration.asset +++ b/Assets/Data/Camera Shake Duration.asset @@ -12,5 +12,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d86361ffc5ae478d9e976629c5d651bd, type: 3} m_Name: Camera Shake Duration m_EditorClassIdentifier: - _initialValue: 0.5 + _initialValue: 1 _readOnly: 1 diff --git a/Assets/Data/Camera Shake Intensity.asset b/Assets/Data/Camera Shake Intensity.asset index f612abc..904aca6 100644 --- a/Assets/Data/Camera Shake Intensity.asset +++ b/Assets/Data/Camera Shake Intensity.asset @@ -12,5 +12,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d86361ffc5ae478d9e976629c5d651bd, type: 3} m_Name: Camera Shake Intensity m_EditorClassIdentifier: - _initialValue: 0.2 + _initialValue: 0.5 _readOnly: 1 diff --git a/Assets/Input/HorizontalPosition.asset b/Assets/Input/HorizontalPosition.asset new file mode 100644 index 0000000..cfec0ff --- /dev/null +++ b/Assets/Input/HorizontalPosition.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d86361ffc5ae478d9e976629c5d651bd, type: 3} + m_Name: HorizontalPosition + m_EditorClassIdentifier: + _initialValue: 0 + _readOnly: 0 diff --git a/Assets/Input/HorizontalPosition.asset.meta b/Assets/Input/HorizontalPosition.asset.meta new file mode 100644 index 0000000..bcbcf09 --- /dev/null +++ b/Assets/Input/HorizontalPosition.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25280515e18c66c44827faf0cb01ca42 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/__TempUnlitPlayerBullet.mat b/Assets/Materials/Bullet.mat similarity index 100% rename from Assets/Materials/__TempUnlitPlayerBullet.mat rename to Assets/Materials/Bullet.mat diff --git a/Assets/Materials/__TempUnlitPlayerBullet.mat.meta b/Assets/Materials/Bullet.mat.meta similarity index 100% rename from Assets/Materials/__TempUnlitPlayerBullet.mat.meta rename to Assets/Materials/Bullet.mat.meta diff --git a/Assets/Materials/Fractal.mat b/Assets/Materials/Fractal.mat index f386d73..13b0e88 100644 --- a/Assets/Materials/Fractal.mat +++ b/Assets/Materials/Fractal.mat @@ -102,6 +102,7 @@ Material: - _SpecularHighlights: 1 - _SrcBlend: 1 - _Surface: 0 + - _TimeOffset: 10 - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: diff --git a/Assets/Materials/Ship.mat b/Assets/Materials/Ship.mat index 5e34867..ec86b5d 100644 --- a/Assets/Materials/Ship.mat +++ b/Assets/Materials/Ship.mat @@ -112,7 +112,7 @@ Material: m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Color1: {r: 0.5411765, g: 1.8509804, b: 2, a: 1} + - _Color1: {r: 0, g: 0.48155433, b: 0.5377358, a: 1} - _Color2: {r: 1.2078432, g: 0, b: 1.1058824, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _FlashColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Materials/Tunnel_Calm.mat b/Assets/Materials/Tunnel_Calm.mat index 1781a47..09438d2 100644 --- a/Assets/Materials/Tunnel_Calm.mat +++ b/Assets/Materials/Tunnel_Calm.mat @@ -102,31 +102,41 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _AlphaClip: 0 - - _BarsWeight: 0 + - _BarsWeight: 1 - _Blend: 0 - _BumpScale: 1 + - _CircleRadius: 1.5 + - _CircleThickness: 0.07 - _ClearCoatMask: 0 - _ClearCoatSmoothness: 0 + - _CoreRadius: 0.27 + - _CoreThiccness: 1 + - _CoreThickness: 0.46 - _Cull: 2 - _Cutoff: 0.5 - _DetailAlbedoMapScale: 1 - _DetailNormalMapScale: 1 - _DstBlend: 0 - _EnvironmentReflections: 1 + - _FractalFadeHeight: 0.3 + - _FractalFadeOut: 1 - _FractalInner: 0.3 - _FractalPower: 1 - _FractalRotateSpeed: 20 - _FractalScale: 6 - - _FractalWeight: 0 + - _FractalWeight: 0.6 - _GlossMapScale: 0 - _Glossiness: 0 - _GlossyReflections: 0 + - _GroundWeight: 1 - _Intensity: 1 - _Metallic: 0 - - _Nebula1Power: 1 - - _Nebula2Power: 1 - - _NebulaWeight: 0 + - _Nebula1Power: 3 + - _Nebula2Power: 5 + - _NebulaWeight: 0.63 - _OcclusionStrength: 1 + - _OuterCircleRadius: 0.2 + - _OuterCircleThickness: 0.1 - _OverallPower: 1 - _Parallax: 0.005 - _QueueOffset: 0 @@ -136,17 +146,19 @@ Material: - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 - - _StarsWeight: 0.05 + - _StarsWeight: 0.48 - _Surface: 0 - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - _BackgroundColor: {r: 0.09794411, g: 0.27564344, b: 0.2924528, a: 0} + - _BackgroundColor: {r: 0.5471698, g: 0.49697047, b: 0, a: 0} - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _CircleColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _FractalColor: {r: 1.3876811, g: 1.0683917, b: 2.3455496, a: 1} - - _NebulaColor1: {r: 0, g: 0.67775345, b: 1, a: 1} - - _NebulaColor2: {r: 0.54217625, g: 0.25, b: 1, a: 1} + - _GroundColor: {r: 4.5947943, g: 4.5947943, b: 4.5947943, a: 1} + - _NebulaColor1: {r: 1, g: 1, b: 1, a: 1} + - _NebulaColor2: {r: 1, g: 1, b: 1, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] diff --git a/Assets/Materials/Tunnel_Party.mat b/Assets/Materials/Tunnel_Party.mat index dba2b87..838cfde 100644 --- a/Assets/Materials/Tunnel_Party.mat +++ b/Assets/Materials/Tunnel_Party.mat @@ -102,32 +102,38 @@ Material: m_Offset: {x: 0, y: 0} m_Floats: - _AlphaClip: 0 - - _BarsWeight: 0.25 + - _BarsWeight: 1 - _Blend: 0 - _BumpScale: 1 - _ClearCoatMask: 0 - _ClearCoatSmoothness: 0 + - _CoreRadius: 0.035 + - _CoreThiccness: 0.2 - _Cull: 2 - _Cutoff: 0.5 - _DetailAlbedoMapScale: 1 - _DetailNormalMapScale: 1 - _DstBlend: 0 - _EnvironmentReflections: 1 + - _FractalFadeHeight: 0.25 - _FractalInner: 0.3 - _FractalPower: 1 - _FractalRotateSpeed: 20 - _FractalScale: 6 - - _FractalWeight: 0.35 + - _FractalWeight: 0.29 - _GlossMapScale: 0 - _Glossiness: 0 - _GlossyReflections: 0 + - _GroundMaskAngle: 2.61 - _GroundWeight: 1 - _Intensity: 1 - _Metallic: 0 - - _Nebula1Power: 3 - - _Nebula2Power: 5 - - _NebulaWeight: 0.4 + - _Nebula1Power: 3.06 + - _Nebula2Power: 3.46 + - _NebulaWeight: 0.25 - _OcclusionStrength: 1 + - _OuterCircleRadius: 0.5 + - _OuterCircleThickness: 0.1 - _OverallPower: 1 - _Parallax: 0.005 - _QueueOffset: 0 @@ -137,17 +143,20 @@ Material: - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 - - _StarsWeight: 0.75 + - _StarsWeight: 0.1 - _Surface: 0 - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} + - _BackgroundColor: {r: 0, g: 0, b: 0, a: 1} + - _BarsColor: {r: 0.007843138, g: 0.45490196, b: 0.7490196, a: 1} - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _CircleColor: {r: 0, g: 0, b: 0, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} + - _CoreColor: {r: 0.70987976, g: 1.0648196, b: 2.1185474, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - - _FractalColor: {r: 1.3876811, g: 1.0683917, b: 2.3455496, a: 1} - - _GroundColor: {r: 1.287958, g: 0.565445, b: 2.251309, a: 1} + - _FractalColor: {r: 4.18079, g: 0, b: 0.6094301, a: 1} + - _GroundColor: {r: 0.45868373, g: 3.3127158, b: 0, a: 1} - _NebulaColor1: {r: 0, g: 0.67775345, b: 1, a: 1} - _NebulaColor2: {r: 0.54217625, g: 0.25, b: 1, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} diff --git a/Assets/Materials/Tunnel_Vibe.mat b/Assets/Materials/Tunnel_Vibe.mat index 867ee30..713d343 100644 --- a/Assets/Materials/Tunnel_Vibe.mat +++ b/Assets/Materials/Tunnel_Vibe.mat @@ -107,26 +107,32 @@ Material: - _BumpScale: 1 - _ClearCoatMask: 0 - _ClearCoatSmoothness: 0 + - _CoreRadius: 1 + - _CoreThiccness: 1 - _Cull: 2 - _Cutoff: 0.5 - _DetailAlbedoMapScale: 1 - _DetailNormalMapScale: 1 - _DstBlend: 0 - _EnvironmentReflections: 1 + - _FractalFadeHeight: 0.25 - _FractalInner: 0.3 - _FractalPower: 1 - _FractalRotateSpeed: 20 - _FractalScale: 6 - - _FractalWeight: 0.1 + - _FractalWeight: 0 - _GlossMapScale: 0 - _Glossiness: 0 - _GlossyReflections: 0 + - _GroundWeight: 1 - _Intensity: 1 - _Metallic: 0 - - _Nebula1Power: 2 - - _Nebula2Power: 3 - - _NebulaWeight: 0.2 + - _Nebula1Power: 1 + - _Nebula2Power: 1 + - _NebulaWeight: 0 - _OcclusionStrength: 1 + - _OuterCircleRadius: 0.5 + - _OuterCircleThickness: 0.1 - _OverallPower: 1 - _Parallax: 0.005 - _QueueOffset: 0 @@ -136,16 +142,18 @@ Material: - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 - - _StarsWeight: 0.1 + - _StarsWeight: 0.05 - _Surface: 0 - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - _BackgroundColor: {r: 0.09803922, g: 0.109295845, b: 0.29411766, a: 0} + - _BackgroundColor: {r: 0.09794411, g: 0.27564344, b: 0.2924528, a: 0} - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _CircleColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _FractalColor: {r: 1.3876811, g: 1.0683917, b: 2.3455496, a: 1} + - _GroundColor: {r: 1, g: 1, b: 1, a: 1} - _NebulaColor1: {r: 0, g: 0.67775345, b: 1, a: 1} - _NebulaColor2: {r: 0.54217625, g: 0.25, b: 1, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} diff --git a/Assets/Player/MovePlayer.cs b/Assets/Player/MovePlayer.cs index 1e9fdea..f163458 100644 --- a/Assets/Player/MovePlayer.cs +++ b/Assets/Player/MovePlayer.cs @@ -1,5 +1,6 @@ using System; using Ktyl.Util; +using UnityEditor.ShaderGraph.Internal; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; @@ -11,6 +12,7 @@ public class MovePlayer : MonoBehaviour [SerializeField] private RectOffset extents; [SerializeField] private float lerpAmount = 0.95f; [SerializeField] private SerialFloat horizontalInput; + [SerializeField] private SerialFloat horizontalPosition; private PlayerInput _input; @@ -44,16 +46,30 @@ public class MovePlayer : MonoBehaviour _input.Default.Move.performed -= DoMove; } + private float _x; + private void Update() { _transform.localPosition += (Vector3) _currentInput * speed * Time.deltaTime; + + var w = Mathf.Abs(extents.right - extents.left); + var x = _transform.localPosition.x; + if (x > extents.right) + { + x -= w; + } + else if (x < extents.left) + { + x += w; + } _transform.localPosition = new Vector3( - Mathf.Clamp(_transform.localPosition.x, extents.left, extents.right), + x, _yPos, _zPos); horizontalInput.Value = _currentInput.x; + horizontalPosition.Value = _transform.localPosition.x; } private void DoMove(InputAction.CallbackContext context) diff --git a/Assets/Prefabs/Enemy.prefab b/Assets/Prefabs/Enemy.prefab index 4f82167..3d71938 100644 --- a/Assets/Prefabs/Enemy.prefab +++ b/Assets/Prefabs/Enemy.prefab @@ -30,7 +30,7 @@ Transform: m_GameObject: {fileID: 1738226812227614583} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.5, y: 0.4, z: 0.6} + m_LocalScale: {x: 0.1, y: 0.05, z: 0.6} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 diff --git a/Assets/Prefabs/Rendering.prefab b/Assets/Prefabs/Rendering.prefab index 0814ffd..76415f7 100644 --- a/Assets/Prefabs/Rendering.prefab +++ b/Assets/Prefabs/Rendering.prefab @@ -58,7 +58,7 @@ Camera: height: 1 near clip plane: 0.3 far clip plane: 1000 - field of view: 60 + field of view: 50 orthographic: 0 orthographic size: 5 m_Depth: -1 diff --git a/Assets/Prefabs/Ship.prefab b/Assets/Prefabs/Ship.prefab index 82dc6b8..a4e7c2e 100644 --- a/Assets/Prefabs/Ship.prefab +++ b/Assets/Prefabs/Ship.prefab @@ -12,6 +12,7 @@ GameObject: - component: {fileID: 5276750110334005504} - component: {fileID: 5276750110334005507} - component: {fileID: 5276750110334005506} + - component: {fileID: 8761754940900000814} m_Layer: 6 m_Name: Ship m_TagString: Untagged @@ -95,3 +96,21 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &8761754940900000814 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5276750110334005516} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f8df2e7d5a1ae6469f46ad810552f21, type: 3} + m_Name: + m_EditorClassIdentifier: + _ship: {fileID: 0} + _horizontalInput: {fileID: 11400000, guid: 7371e84b7c82f4631a96ac1c00b55fa0, type: 2} + _distanceSinceLastBeat: {fileID: 11400000, guid: 8d22f3ed946820445adcc586d2cc6e5a, type: 2} + _bounce: 0 + _maxTilt: 30 + _tiltSensitivity: 10 diff --git a/Assets/Scenes/Chief's Sandbox.unity b/Assets/Scenes/Chief's Sandbox.unity index 0bb695e..1c4f995 100644 --- a/Assets/Scenes/Chief's Sandbox.unity +++ b/Assets/Scenes/Chief's Sandbox.unity @@ -492,10 +492,6 @@ PrefabInstance: propertyPath: m_RenderPostProcessing value: 1 objectReference: {fileID: 0} - - target: {fileID: 3397488660173986648, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - propertyPath: field of view - value: 60 - objectReference: {fileID: 0} - target: {fileID: 3397488660571973483, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} propertyPath: m_RenderPostProcessing value: 0 @@ -503,18 +499,18 @@ PrefabInstance: - target: {fileID: 3397488660842926088, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} propertyPath: m_Materials.Array.data[0] value: - objectReference: {fileID: 2100000, guid: 439b4d6018bd23e4e91136d099c5b815, type: 2} + objectReference: {fileID: 2100000, guid: 9429becea685bce4fa7b6595601ea615, type: 2} - target: {fileID: 3397488660842926092, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} propertyPath: m_LocalScale.x - value: 2303.7488 + value: 1767.2549 objectReference: {fileID: 0} - target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} propertyPath: m_LocalScale.y - value: 1039.2305 + value: 839.3538 objectReference: {fileID: 0} - target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} propertyPath: m_LocalPosition.y @@ -576,6 +572,10 @@ PrefabInstance: propertyPath: m_LocalPosition.z value: -100 objectReference: {fileID: 0} + - target: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} + propertyPath: _playerXPos + value: + objectReference: {fileID: 11400000, guid: 25280515e18c66c44827faf0cb01ca42, type: 2} - target: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} propertyPath: _anim.m_Curve.Array.size value: 3 @@ -758,6 +758,7 @@ MonoBehaviour: m_Bottom: -4 lerpAmount: 0.95 horizontalInput: {fileID: 11400000, guid: 7371e84b7c82f4631a96ac1c00b55fa0, type: 2} + horizontalPosition: {fileID: 11400000, guid: 25280515e18c66c44827faf0cb01ca42, type: 2} --- !u!114 &1173812010 MonoBehaviour: m_ObjectHideFlags: 0 @@ -822,7 +823,7 @@ MonoBehaviour: - {fileID: 1611642542} - {fileID: 728836294} polygon: {fileID: 1639649353} - _cameraShake: {fileID: 531937975} + _tunnelController: {fileID: 531937975} --- !u!1 &1215971662 GameObject: m_ObjectHideFlags: 0 @@ -1261,5 +1262,9 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8761754940900000814, guid: bd5f27d2b3a6b4a40aab2af5c3c4586e, type: 3} + propertyPath: _ship + value: + objectReference: {fileID: 1173812008} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: bd5f27d2b3a6b4a40aab2af5c3c4586e, type: 3} diff --git a/Assets/Scripts/LoseLife.cs b/Assets/Scripts/LoseLife.cs index b099c0f..b335be9 100644 --- a/Assets/Scripts/LoseLife.cs +++ b/Assets/Scripts/LoseLife.cs @@ -11,7 +11,7 @@ public class LoseLife : MonoBehaviour [SerializeField] private Renderer[] healthMarkers; [SerializeField] private Renderer polygon; - [SerializeField] private CameraShake _cameraShake; + [SerializeField] private TunnelController _tunnelController; private EntityHealth _health; @@ -22,7 +22,7 @@ public class LoseLife : MonoBehaviour public void LifeLost(int livesLeft) { - _cameraShake.Shake(); + _tunnelController.LoseLifeShake(); healthMarkers[livesLeft].transform.DOScale(Vector3.zero, 1f).SetEase(Ease.InBack).SetUpdate(true); _health.enabled = false; diff --git a/Assets/Scripts/Rendering/AudioVisualizer.cs b/Assets/Scripts/Rendering/AudioVisualizer.cs index f9d0498..e5ba235 100644 --- a/Assets/Scripts/Rendering/AudioVisualizer.cs +++ b/Assets/Scripts/Rendering/AudioVisualizer.cs @@ -50,7 +50,7 @@ public class AudioVisualizer : ScriptableObject } } - public void Update(DSP fft, Renderer fractal, Renderer tunnel, Renderer ship) + public void UpdateAudio(DSP fft, Renderer fractal, Renderer tunnel, Renderer ship) { // update beat-based things Shader.SetGlobalFloat("_DistanceSinceLastBeat", _distanceSinceLastBeat); diff --git a/Assets/Scripts/Rendering/AudioVisualizerRuntime.cs b/Assets/Scripts/Rendering/AudioVisualizerRuntime.cs index 0f3eb6d..699c098 100644 --- a/Assets/Scripts/Rendering/AudioVisualizerRuntime.cs +++ b/Assets/Scripts/Rendering/AudioVisualizerRuntime.cs @@ -38,6 +38,6 @@ public class AudioVisualizerRuntime : MonoBehaviour private void LateUpdate() { - _system.Update(_fft, _fractal, _tunnel, _ship); + _system.UpdateAudio(_fft, _fractal, _tunnel, _ship); } } \ No newline at end of file diff --git a/Assets/Scripts/Rendering/ShipGraphics.cs b/Assets/Scripts/Rendering/ShipGraphics.cs index f89fa65..928cfbe 100644 --- a/Assets/Scripts/Rendering/ShipGraphics.cs +++ b/Assets/Scripts/Rendering/ShipGraphics.cs @@ -1,15 +1,37 @@ using System; using System.Collections; using System.Collections.Generic; +using Ktyl.Util; using UnityEngine; [RequireComponent(typeof(Renderer))] public class ShipGraphics : MonoBehaviour { + [SerializeField] private Transform _ship; + [SerializeField] private SerialFloat _horizontalInput; + + [SerializeField] private SerialFloat _distanceSinceLastBeat; + [SerializeField] private float _bounce; + + [SerializeField] private float _maxTilt; + [Range(0, 100)] [SerializeField] private float _tiltSensitivity; + private Renderer _renderer; + private float _tilt; private void Awake() { _renderer = GetComponent(); } + + private void LateUpdate() + { + var targetRotationAngle = _maxTilt * _horizontalInput; + _tilt = Mathf.Lerp(_tilt, targetRotationAngle, _tiltSensitivity * Time.deltaTime); + + var rot = Quaternion.Euler(0, 0, -_tilt); + transform.rotation = rot; + + transform.position = _ship.position + Vector3.up * _distanceSinceLastBeat * _bounce; + } } diff --git a/Assets/Shaders/bullet.shader b/Assets/Shaders/bullet.shader new file mode 100644 index 0000000..560bbd7 --- /dev/null +++ b/Assets/Shaders/bullet.shader @@ -0,0 +1,138 @@ +// This shader draws a texture on the mesh. +Shader "custom/bullet" +{ + // The _BaseMap variable is visible in the Material's Inspector, as a field + // called Base Map. + Properties + { + [HDR] _Color1("Color1", Color) = (1,1,1,1) + [HDR] _Color2("Color2", Color) = (1,1,1,1) + [HDR] _FarColor("Far Color", Color) = (1,1,1,1) + + _Alpha("Alpha", Float) = 1.0 +// [HDR] _Color2("Color 2", Color) = (1,1,1,1) +// _FadeStrength("Fade Strength", Float) = 0.1 +// _VertexScale("Vertex Scale", Float) = 0 + _PulseIntensity("Pulse Intensity", Float) = 1.0 + _TrackWidth("Track Width", Float) = 20 + + _M("M", Float) = 0.5 + _C("C", Float) = 0.0 + + _NoiseMap("Noise Map", 2D) = "black" + } + + SubShader + { + Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalRenderPipeline" } + + Pass + { + HLSLPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + + struct Attributes + { + float4 positionOS : POSITION; + // The uv variable contains the UV coordinate on the texture for the + // given vertex. + float2 uv : TEXCOORD0; + half3 normal : NORMAL; + }; + + struct Varyings + { + float4 positionHCS : SV_POSITION; + // The uv variable contains the UV coordinate on the texture for the + // given vertex. + float2 uv : TEXCOORD0; + float3 wpos : TEXCOORD1; + half3 normal : NORMAL; + }; + + float _M = 0.5; + float _C = 0.0; + float4 _Color1; + float4 _Color2; + float4 _FarColor; + float _Alpha; + float _PulseIntensity; + + float _TrackWidth; + float _PlayerXPos; + + float _DistanceToNextBeat; + float _DistanceFromLastBeat; + + // float _VertexScale; + // float _FadeStrength; + + // This macro declares _BaseMap as a Texture2D object. + TEXTURE2D(_BaseMap); + // This macro declares the sampler for the _BaseMap texture. + SAMPLER(sampler_BaseMap); + TEXTURE2D(_NoiseMap); + SAMPLER(sampler_NoiseMap); + + CBUFFER_START(UnityPerMaterial) + // The following line declares the _BaseMap_ST variable, so that you + // can use the _BaseMap variable in the fragment shader. The _ST + // suffix is necessary for the tiling and offset function to work. + float4 _BaseMap_ST; + float4 _NoiseMap_ST; + CBUFFER_END + + Varyings vert(Attributes IN) + { + Varyings OUT; + + float3 vpos = IN.positionOS.xyz; + float3 wpos = TransformObjectToWorld(vpos); + float radius = 4.0; + float d = _TrackWidth; + float r = radius - vpos.y; + float x = wpos.x; + x -= _PlayerXPos; + + float a = 2*PI*(x/d+0.5); + a += 0.5*PI; + + wpos = float3(cos(a)*r,sin(a)*r, wpos.z); + + vpos = TransformWorldToObject(wpos); + + OUT.wpos = wpos; + OUT.positionHCS = TransformObjectToHClip(vpos); + // The TRANSFORM_TEX macro performs the tiling and offset + // transformation. + OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap); + return OUT; + } + + half4 frag(Varyings IN) : SV_Target + { + // calculate pixel + float2 res = _ScreenParams; + float2 p = -1.0+2.0*IN.positionHCS.xy/res.xy; + + float2 toCentre = TransformObjectToWorld(-IN.wpos).xy; + toCentre = normalize(toCentre); + + float t = dot(IN.normal, toCentre) * 0.5 + 0.5; + + // float t = dot(IN.normal, float3(0,1,0)) * 0.5 + 0.5; + + // float t = length(p); + // return lerp(_Color1,_Color2,t * _FadeStrength); + float4 c = float4(lerp(_Color1, _Color2, t).xyz, _Alpha); + c = lerp(c, _FarColor, IN.wpos.z * 0.0075); + + return c; + } + ENDHLSL + } + } +} \ No newline at end of file diff --git a/Assets/Shaders/bullet.shader.meta b/Assets/Shaders/bullet.shader.meta new file mode 100644 index 0000000..4bc968e --- /dev/null +++ b/Assets/Shaders/bullet.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 3fbfd755d973879408e445fecb08c7ae +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/enemy.shader b/Assets/Shaders/enemy.shader index 928d09f..d415d51 100644 --- a/Assets/Shaders/enemy.shader +++ b/Assets/Shaders/enemy.shader @@ -7,11 +7,14 @@ Shader "custom/enemy" { [HDR] _Color1("Color1", Color) = (1,1,1,1) [HDR] _Color2("Color2", Color) = (1,1,1,1) + [HDR] _FarColor("Far Color", Color) = (1,1,1,1) + _Alpha("Alpha", Float) = 1.0 // [HDR] _Color2("Color 2", Color) = (1,1,1,1) // _FadeStrength("Fade Strength", Float) = 0.1 // _VertexScale("Vertex Scale", Float) = 0 _PulseIntensity("Pulse Intensity", Float) = 1.0 + _TrackWidth("Track Width", Float) = 20 _M("M", Float) = 0.5 _C("C", Float) = 0.0 @@ -54,9 +57,13 @@ Shader "custom/enemy" float _C = 0.0; float4 _Color1; float4 _Color2; + float4 _FarColor; float _Alpha; float _PulseIntensity; + float _TrackWidth; + float _PlayerXPos; + float _DistanceToNextBeat; float _DistanceFromLastBeat; @@ -77,7 +84,7 @@ Shader "custom/enemy" float4 _BaseMap_ST; float4 _NoiseMap_ST; CBUFFER_END - + Varyings vert(Attributes IN) { Varyings OUT; @@ -88,6 +95,8 @@ Shader "custom/enemy" float beat = _DistanceToNextBeat*_DistanceToNextBeat; vpos *= 1.0+beat*_PulseIntensity; + vpos.x *= 0.3; + //float d = 1.0+length(wpos)*0.5; //float2 uv = wpos.zx; // float noise = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, uv, 0) - 0.5; @@ -96,15 +105,33 @@ Shader "custom/enemy" // noise *= d*d * 0.1; // vpos *= lerp (0.9,1.1,noise); + // float3 owpos = TransformObjectToWorld(float3(0,0,0)); + // calculate position on circle float3 wpos = TransformObjectToWorld(vpos); - float3 fromCentre = normalize(wpos); - float3 distanceFromCentre = length(wpos); - - float3 wposOffset = float3(0,0,fromCentre.y*fromCentre.x)*distanceFromCentre*beat; - wpos += wpos; - vpos += wposOffset; + float radius = 4.0; + float d = _TrackWidth; + float r = radius - vpos.y * 0.5; + float x = wpos.x; + x -= _PlayerXPos; + // x += 0.5*PI; + + float a = 2*PI*(x/d + 0.5); + a += 0.5*PI; + // a *= (radius - r) * -1.0; + + + + wpos = float3(cos(a)*r,sin(a)*r,wpos.z); + vpos = TransformWorldToObject(wpos); + + // TransformWorldToObject() + // vpos += wposOffset; + + // float x_with_distance = normalize(wpos.x)*wpos.z*0.1; + // x_with_distance = abs(x_with_distance); + // vpos += float3(x_with_distance,0,0); OUT.wpos = wpos; OUT.positionHCS = TransformObjectToHClip(vpos); @@ -130,6 +157,8 @@ Shader "custom/enemy" // float t = length(p); // return lerp(_Color1,_Color2,t * _FadeStrength); float4 c = float4(lerp(_Color1, _Color2, t).xyz, _Alpha); + c = lerp(c, _FarColor, IN.wpos.z * 0.0075); + return c; } ENDHLSL diff --git a/Assets/Shaders/julia.shader b/Assets/Shaders/julia.shader index 79fffcd..e0efd63 100644 --- a/Assets/Shaders/julia.shader +++ b/Assets/Shaders/julia.shader @@ -9,6 +9,7 @@ Shader "custom/julia" _Color2("Color 2", Color) = (1,1,1,1) _BassPower("Bass Power", Float) = 0.0 + _TimeOffset("Time Offset", Float) = 10.0 _Fractality("Fractality", Float) = 1.02 } @@ -44,6 +45,7 @@ Shader "custom/julia" float4 _Color1; float4 _Color2; float _Fractality; + float _TimeOffset; float _BassAmplitude; // This macro declares _BaseMap as a Texture2D object. @@ -76,7 +78,7 @@ Shader "custom/julia" float2 z = p * 1.5; float2 c; - float an = _Time + _BassAmplitude; + float an = _TimeOffset + _Time + _BassAmplitude; c.x = 0.5*cos(an) - 0.25*cos(2.0*an); c.y = 0.5*sin(an) - 0.25*sin(2.0*an); c *= _Fractality; diff --git a/Assets/Shaders/ship.shader b/Assets/Shaders/ship.shader index d9faa66..9e22a38 100644 --- a/Assets/Shaders/ship.shader +++ b/Assets/Shaders/ship.shader @@ -48,6 +48,7 @@ Shader "custom/ship" float _VertexScale; float _FadeStrength; float _FlashAmount; + float _PlayerXPos; // This macro declares _BaseMap as a Texture2D object. TEXTURE2D(_BaseMap); @@ -72,10 +73,12 @@ Shader "custom/ship" float3 wpos = TransformObjectToWorld(vpos); float d = 1.0+length(wpos)*0.5; - float2 uv = wpos.yx; + wpos.x -= _PlayerXPos; + wpos += _VertexScale*float3(0,0,1)*d; + // float2 uv = wpos.yx; // float noise = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, uv, 0) -0.5; - - vpos += _VertexScale*float3(0,0,5)*d; + + vpos = TransformWorldToObject(wpos); // noise *= d*d * 0.1; diff --git a/Assets/Shaders/tunnel.shader b/Assets/Shaders/tunnel.shader index d050aad..2f96204 100644 --- a/Assets/Shaders/tunnel.shader +++ b/Assets/Shaders/tunnel.shader @@ -10,21 +10,32 @@ Shader "custom/tunnel" [HDR] _NebulaColor2("Nebula Color 2", Color) = (1,1,1,1) [HDR] _FractalColor("Fractal Color", Color) = (1,1,1,1) [HDR] _GroundColor("Ground Color", Color) = (1,1,1,1) + [HDR] _CoreColor("Core Color", Color) = (1,1,1,1) + [HDR] _BarsColor("Bars Color", Color) = (1,1,1,1) + _SkyWeight("Sky Weight", Float) = 1.0 _FractalWeight("Fractal Weight", Range(0.0,1.0)) = 1.0 _NebulaWeight("Nebula Weight", Range(0.0,1.0)) = 1.0 - _BarsWeight("Bars Weight", Range(0.0,1.0)) = 1.0 + _BarsWeight("Bars Weight", Float) = 1.0 _StarsWeight("Stars Weight", Range(0.0,1.0)) = 1.0 - _GroundWeight("Ground Weight", Range(0.0,1.0)) = 1.0 + _GroundWeight("Ground Weight", Float) = 1.0 + _GroundMaskAngle("Ground Mask Angle", Float) = 1.0 _FractalScale("Fractal Scale", Float) = 6.0 _FractalRotateSpeed("Fractal Rotate Speed", Float) = 20.0 _FractalPower("Fractal Power", Float) = 1.0 _FractalInner("Fractal Inner", Float) = 0.2 + _FractalFadeHeight("Fractal Fade Height", Float) = 0.25 _Nebula1Power("Nebula 1 Power", Float) = 1.0 _Nebula2Power("Nebula 2 Power", Float) = 1.0 + _CoreRadius("Core Radius", Range(0, 1.0)) = 1.0 + _CoreThiccness("Core Thiccness", Range(0,1.0)) = 1.0 + + _OuterCircleRadius("Outer Circle Radius", Range(0,10)) = 0.5 + _OuterCircleThickness("Outer Circle Thickness", Range(0,1.0)) = 0.1 + _NebulaMap("Nebula Map", 2D) = "black" _StarMap("Star Map", 2D) = "black" _FractalMap("Fractal Map", 2D) = "black" @@ -67,24 +78,42 @@ Shader "custom/tunnel" float4 _NebulaColor2; float4 _FractalColor; float4 _GroundColor; + float4 _CoreColor; + float4 _BarsColor; float _FractalScale = 6.0; float _FractalRotateSpeed = 20.0; float _FractalPower = 1.0; float _FractalInner = 0.2; float _FractalWeight = 1.0; + float _FractalFadeHeight = 0.25; float _Nebula1Power = 1.0; float _Nebula2Power = 1.0; float _NebulaWeight = 1.0; - + + float _SkyWeight; float _BarsWeight; float _StarsWeight; float _GroundWeight; + float _GroundMaskAngle; + + // circles + float _CoreRadius; + float _CoreThiccness; + float _OuterCircleRadius; + float _OuterCircleThickness; float _Intensity; float _CameraShake = 0.0; + float _DistanceToNextBeat; + float _DistanceSinceLastBeat; + + float _PlayerXPos; + float _PlayerXMove; + float _TrackWidth = 20; + TEXTURE2D(_NebulaMap); SAMPLER(sampler_NebulaMap); TEXTURE2D(_StarMap); @@ -178,7 +207,6 @@ Shader "custom/tunnel" fuv1 = rotateUV(fuv1,_Time*_FractalRotateSpeed); half4 fractal1 = SAMPLE_TEXTURE2D(_FractalMap, sampler_FractalMap, fuv1); fractal1 *= _FractalColor; - fractal1 *= max(0, r-_FractalInner); fractal1 *= _FractalPower; // fractal 2 @@ -187,7 +215,6 @@ Shader "custom/tunnel" fuv2.x=1.0-fuv2.x; half4 fractal2 = SAMPLE_TEXTURE2D(_FractalMap, sampler_FractalMap, fuv2); fractal2 *= _FractalColor * sin(_Time*3); - fractal2 *= max(0, r-_FractalInner); fractal2 *= _FractalPower; half4 fractal = max(fractal1,fractal2) * _Intensity; @@ -201,7 +228,8 @@ Shader "custom/tunnel" float angle = PI; float t = (abs(a/PI)*PI) * -min(p.y, 0); - t = min(r*0.4, t); + t = min(r, t); + // t *= -abs(p.y); // t += ; // t *= (1.0-r*0.5); @@ -209,6 +237,35 @@ Shader "custom/tunnel" return lerp(nothing, _GroundColor, t) * _GroundWeight; } + + float4 blurry_circle(float2 p, float radius, float thickness) + { + float r_p = length(p); + // outer circle is white/circle color + // inner circle is black and a bit smaller + + float d =abs(radius-r_p)*1.0/thickness; + d*=d; + float4 color = max(d, 0); + color.a = 1.0; + + // color -= max((_CircleRadius-_CircleThickness)-r, 0); + + color = 1.0-color; + + float b = _DistanceToNextBeat; + b*=b; + + color *= 1.0+b; + + return max(color, 0); + } + + float4 filled_circle(float2 p, float r) + { + float inside = step(length(p),r); + return lerp(float4(0,0,0,0),float4(1,1,1,1),inside); + } float4 frag(Varyings IN) : SV_Target { @@ -233,36 +290,100 @@ Shader "custom/tunnel" fuv1 = rotateUV(fuv1,_Time*_FractalRotateSpeed); half4 fractal1 = SAMPLE_TEXTURE2D(_FractalMap, sampler_FractalMap, fuv1); fractal1 *= _FractalColor; - fractal1 *= max(0, r-_FractalInner); + // fractal1 *= max(0, r-_CoreRadius); fractal1 *= _FractalWeight; fractal1 *= _Intensity; - fractal1 *= max(2.0*normalize(p).y+0.25,0); float2 fuv2 = p / _FractalScale + float2(0.5,0.5); - fuv2 = rotateUV(fuv2,-_Time*_FractalRotateSpeed*3.561); - fuv2.x=1.0-fuv2.x; + fuv2 = rotateUV(fuv2,PI*-(_PlayerXPos/20.0)); + // fuv2.x=1.0-fuv2.x; half4 fractal2 = SAMPLE_TEXTURE2D(_FractalMap, sampler_FractalMap, fuv2); fractal2 *= _FractalColor * sin(_Time*3); - fractal2 *= max(0, r-_FractalInner); + // fractal2 *= max(0, r-_CoreRadius); fractal2 *= _FractalWeight; fractal2 *= _Intensity; - fractal2 *= max(2.0*normalize(p).y+0.25,0); float4 color = _BackgroundColor; - color += fractal1; - color += fractal2; - color -= ground(p, r, a); + // precalc some stuff + float f = fractal1 + fractal2; + // float f = fractal2; + float g = ground(p, r, a); + // float g_mask = step(_GroundMaskAngle,g); + float n = nebula(r, a); + float s = stars(r, a); + float b = bars(r, p); + + // fractal + // color += fractal_both; + + // nebula + // float4 normal_bars = normalize(bars(r,p)); + // color += normal_bars; + // float4 nebula_bars = bars(r, p) * _DistanceSinceLastBeat * 5; + // color += stars(r, a); + // color += circle(p, r); + // float4 neb = nebula(r, a); + // color += neb; - color += nebula(r, a); - color += bars(r, p); - color += stars(r, a); + // sky + float4 sky = _BackgroundColor; + sky += f * _FractalColor; // fractal + sky += s; // stars + float4 clouds = n; + clouds *= (1.0-g); // mask out ground + sky += clouds; + sky *= (1.0-g); // mask out ground + + // sky = max(f,s); + // stars masked by ground + // color += max(0,s,g_mask); + + // ground + float4 ground_color = float4(0,0,0,0); + // hazy ground base + ground_color += g; + // speedy boye + float4 ground_fast = n * g; + ground_color += ground_fast; + ground_color *= _GroundColor; + color = max(color, ground_color); + + // bars + float4 bars_color = b; + bars_color = lerp(bars_color,ground_color,g); + bars_color *= _BarsColor; + bars_color *= lerp(0, bars_color, _DistanceToNextBeat); + bars_color = lerp(bars_color, ground_color, g); + + sky += bars_color * _BarsWeight; + sky *= _SkyWeight; + color += sky; + + // core + float4 core_color = blurry_circle(p, _CoreRadius, _CoreThiccness); + core_color *= _CoreColor; + color += core_color; + // color = lerp(color, core_color, step(0.001,core_color)); + + // rays + float4 rays_colour; + + // spee + // color += lerp(sky, n, g); + + + // float4 outer_circle = blurry_circle(p,_OuterCircleRadius,_OuterCircleThickness); + // color += lerp(0,outer_circle,ground(p,r,a)); + + // float4 core = filled_circle(p,_CoreRadius); + // color += core; + + // color = float4(1,1,1,1)*outer_circle; // bars, nebula, fractal, // average across all fx - color = saturate(color); - return color; } ENDHLSL diff --git a/Assets/CameraShake.cs b/Assets/TunnelController.cs similarity index 65% rename from Assets/CameraShake.cs rename to Assets/TunnelController.cs index 416fc4f..db215e4 100644 --- a/Assets/CameraShake.cs +++ b/Assets/TunnelController.cs @@ -4,11 +4,13 @@ using System.Collections.Generic; using Ktyl.Util; using UnityEngine; -public class CameraShake : MonoBehaviour +public class TunnelController : MonoBehaviour { [SerializeField] private SerialFloat _intensity; [SerializeField] private SerialFloat _duration; [SerializeField] private AnimationCurve _anim; + [SerializeField] private SerialFloat _playerXPos; + [SerializeField] private SerialFloat _playerXMove; private float _start = -1; @@ -19,14 +21,18 @@ public class CameraShake : MonoBehaviour void LateUpdate() { + Shader.SetGlobalFloat("_PlayerXMove", _playerXMove); + Shader.SetGlobalFloat("_PlayerXPos", _playerXPos); + var elapsed = Time.time - _start; if (elapsed > _duration) return; var normalisedElapsed = elapsed / _duration; + Shader.SetGlobalFloat("_CameraShake", _anim.Evaluate(normalisedElapsed) * _intensity); } - public void Shake() + public void LoseLifeShake() { _start = Time.time; } diff --git a/Assets/CameraShake.cs.meta b/Assets/TunnelController.cs.meta similarity index 100% rename from Assets/CameraShake.cs.meta rename to Assets/TunnelController.cs.meta