scale bounce with intensity, shake camera on calm

This commit is contained in:
Cat Flynn 2021-01-11 09:28:15 +00:00
parent 11e47860e2
commit c021109b5a
5 changed files with 15 additions and 43 deletions

View File

@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c271cfa846431634db54fa41238b7b35, type: 3} m_Script: {fileID: 11500000, guid: c271cfa846431634db54fa41238b7b35, type: 3}
m_Name: Accessibility Options m_Name: Accessibility Options
m_EditorClassIdentifier: m_EditorClassIdentifier:
_mode: 2 _mode: 0
_calm: _calm:
_value: 0 _value: 0
_tunnel: {fileID: 2100000, guid: e26770f868f0d0d44960f5354b21e17c, type: 2} _tunnel: {fileID: 2100000, guid: e26770f868f0d0d44960f5354b21e17c, type: 2}

View File

@ -34,6 +34,8 @@ public class AudioVisualizerRuntime : MonoBehaviour
channelGroup.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, _fft); channelGroup.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, _fft);
_system.Initialise(_fractal.material, _tunnel.Active.material, _ship.material); _system.Initialise(_fractal.material, _tunnel.Active.material, _ship.material);
Shader.SetGlobalFloat("_Intensity", _accessibility.Intensity.Value);
} }
private void LateUpdate() private void LateUpdate()

View File

@ -81,6 +81,7 @@ Shader "custom/enemy"
float _PulseIntensity; float _PulseIntensity;
float _BaseTubeRadius; float _BaseTubeRadius;
float _Intensity;
// float _VertexScale; // float _VertexScale;
// float _FadeStrength; // float _FadeStrength;
@ -122,49 +123,11 @@ Shader "custom/enemy"
float wpz = mo_wpos.z; float wpz = mo_wpos.z;
float r = length(radius) + wpz*wpz*wpz*_RadiusWithDistance; float r = length(radius) + wpz*wpz*wpz*_RadiusWithDistance;
// compress horiztonally
// vpos.x = vpos.x * _HorizontalScale;
// vpos.y = vpos.y * _VerticalScale * 1.0-(r-radius);
// vpos = mul(UNITY_MATRIX_P,
// mul(UNITY_MATRIX_MV, float4(0,0,0,1))
// + float4(vpos.x, vpos.y, 0,0)
// + float4(1, 1,1,1));
// recalculate wpos with updated vpos
// wpos = TransformObjectToWorld(vpos);
// matrix m = GetObjectToWorldMatrix();
//float d = 1.0+length(wpos)*0.5;
//float2 uv = wpos.zx;
// float noise = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, uv, 0) - 0.5;
// vpos += _VertexScale*float3(0,0,5)*d;
// vpos += sin(180)*sin(1800)*float3(0,0,5)*d;
// noise *= d*d * 0.1;
// vpos *= lerp (0.9,1.1,noise);
// float3 owpos = TransformObjectToWorld(float3(0,0,0));
// calculate position on circle
// float3 object_origin = TransformObjectToWorld(float3(0,0,0));
// float r_origin = float
// float wpz = abs(mo_wpos.z-6); // offset due to player position
// // wpz *= wpz;
// r += wpz*_RadiusWithDistance;
// mo_wpos.z *= _SpeedMultiplier;
float x = mo_wpos; float x = mo_wpos;
// float x = mo_wpos.x+vpos.x;
x -= _PlayerXPos; x -= _PlayerXPos;
// x += 0.5*PI;
float a = 2*PI*(x/d); float a = 2*PI*(x/d);
a -= 0.5*PI; a -= 0.5*PI;
// a *= (radius - r) * -1.0;
// vpos.y += 0.5*radius*cos(a);
float3 wpos = float3(cos(a)*r,sin(a)*r,mo_wpos.z); float3 wpos = float3(cos(a)*r,sin(a)*r,mo_wpos.z);
@ -178,7 +141,10 @@ Shader "custom/enemy"
wpos += float3(noise1, noise2, 0) * 2.0; wpos += float3(noise1, noise2, 0) * 2.0;
wpos += float3(vpos.xy,0); wpos += float3(vpos.xy,0);
wpos.y += radius; wpos.y += radius;
wpos.z *= (_SpeedMultiplier+5*(_DistanceToNextBeat*_DistanceSinceLastBeat));
float bounceStrength=5.0*_Intensity;
float bounce = (_SpeedMultiplier+bounceStrength*(_DistanceToNextBeat*_DistanceSinceLastBeat));
wpos.z *= bounce;
// wpos.z *= max(1, (wpos.z-6)* _SpeedMultiplier); // wpos.z *= max(1, (wpos.z-6)* _SpeedMultiplier);
vpos = TransformWorldToObject(wpos); vpos = TransformWorldToObject(wpos);

View File

@ -83,6 +83,7 @@ Shader "custom/obstacle"
float _VerticalScale; float _VerticalScale;
float _BaseTubeRadius; float _BaseTubeRadius;
float _Intensity;
// float _VertexScale; // float _VertexScale;
// float _FadeStrength; // float _FadeStrength;
@ -222,8 +223,11 @@ Shader "custom/obstacle"
wpos += float3(vpos.xy,0); wpos += float3(vpos.xy,0);
wpos.y += radius; wpos.y += radius;
wpos.z *= (_SpeedMultiplier+5*(_DistanceToNextBeat*_DistanceSinceLastBeat));
// wpos.z *= max(1, (wpos.z-6)* _SpeedMultiplier); float boundsStrength = 5.0*_Intensity;
float bounce = (_SpeedMultiplier+boundsStrength*(_DistanceToNextBeat*_DistanceSinceLastBeat));
wpos.z *= bounce;
vpos = TransformWorldToObject(wpos); vpos = TransformWorldToObject(wpos);
// TransformWorldToObject() // TransformWorldToObject()

View File

@ -71,7 +71,7 @@ public class TunnelController : MonoBehaviour
var normalisedElapsed = elapsed / _duration; var normalisedElapsed = elapsed / _duration;
var shake = Mathf.Max(_anim.Evaluate(normalisedElapsed), _baseCameraShake) * cameraShakeIntensity; var shake = Mathf.Max(_anim.Evaluate(normalisedElapsed), _baseCameraShake) * _intensity;
Shader.SetGlobalFloat("_CameraShake", shake); Shader.SetGlobalFloat("_CameraShake", shake);
} }