tunnel shader

fix the left sound
This commit is contained in:
minenice55 2023-11-21 21:49:58 -05:00
parent 915a5d32d0
commit 6aef8fe04b
6 changed files with 134 additions and 150 deletions

View file

@ -95,7 +95,7 @@ GameObject:
- component: {fileID: 5642857275700946485}
- component: {fileID: 7883806491233334313}
m_Layer: 0
m_Name: car_temp
m_Name: Interior
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -136,7 +136,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -269,7 +269,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -374,7 +374,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -542,7 +542,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -853,6 +853,9 @@ MonoBehaviour:
scheduledInputs: []
bg: {fileID: 5922759351382802404}
bgScrollTime: 30
tunnelLightMaterial: {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
tunnelTint: {r: 1, g: 0.89411765, b: 0.7921569, a: 1}
tunnelScreen: {r: 0.09803922, g: 0.09803922, b: 0.09803922, a: 1}
tunnelWall: {fileID: 51355916537813500}
tunnelWallRenderer: {fileID: 695466435713197560}
tunnelChunksPerSec: 4
@ -969,7 +972,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1053,7 +1056,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1221,7 +1224,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1389,7 +1392,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1635,7 +1638,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 4cba047f96191b44b8704748da03c5f2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

View file

@ -0,0 +1,88 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TunnelLightEffect
m_Shader: {fileID: 4800000, guid: b4cada49e3bbaee4b96deed8a436d7fd, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _AddColor: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View file

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: 3ef018d03877aec45b92c32336dc8f6f
guid: 4cba047f96191b44b8704748da03c5f2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleName: ntrtunnel/common
assetBundleVariant:

View file

@ -1,105 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ref
m_Shader: {fileID: 4800000, guid: 68e6db2ebdc24f95958faec2be5558d6, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cube:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FaceTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 5f08755b980f39548bd74b511d7a8a12, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OutlineTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Ambient: 0.5
- _Bevel: 0.5
- _BevelClamp: 0
- _BevelOffset: 0
- _BevelRoundness: 0
- _BevelWidth: 0
- _BumpFace: 0
- _BumpOutline: 0
- _ColorMask: 15
- _CullMode: 0
- _Diffuse: 0.5
- _FaceDilate: 0
- _FaceUVSpeedX: 0
- _FaceUVSpeedY: 0
- _GlowInner: 0.05
- _GlowOffset: 0
- _GlowOuter: 0.05
- _GlowPower: 0.75
- _GradientScale: 5
- _LightAngle: 3.1416
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 1
- _ScaleRatioB: 1
- _ScaleRatioC: 1
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
- _Sharpness: 0
- _SpecularPower: 2
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _TextureHeight: 512
- _TextureWidth: 512
- _UnderlayDilate: 0
- _UnderlayOffsetX: 0
- _UnderlayOffsetY: 0
- _UnderlaySoftness: 0
- _VertexOffsetX: 0
- _VertexOffsetY: 0
- _WeightBold: 0.5
- _WeightNormal: 0
m_Colors:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
m_BuildTextureStacks: []

View file

@ -163,5 +163,5 @@ TextureImporter:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleName: ntrtunnel/common
assetBundleVariant:

View file

@ -61,21 +61,20 @@ namespace HeavenStudio.Games
[SerializeField] Transform bg;
[SerializeField] float bgScrollTime;
[SerializeField] Material tunnelLightMaterial;
[SerializeField] Color tunnelTint;
[SerializeField] Color tunnelScreen;
[SerializeField] GameObject tunnelWall;
[SerializeField] SpriteRenderer tunnelWallRenderer;
[SerializeField] float tunnelChunksPerSec;
[SerializeField] float tunnelWallChunkSize;
Tween bgColorTween;
Tween fgColorTween;
Vector3 tunnelStartPos;
Sound tunnelSoundRight, tunnelSoundMiddle, tunnelSoundLeft;
[Header("References")]
[SerializeField] GameObject frontHand;
[Header("Animators")]
[SerializeField] Animator cowbellAnimator;
[SerializeField] Animator driverAnimator;
@ -83,12 +82,8 @@ namespace HeavenStudio.Games
[Header("Curves")]
[SerializeField] BezierCurve3D handCurve;
GameEvent cowbell = new GameEvent();
int driverState;
float bgStartX;
float fadeDuration = 2f;
double tunnelStartTime = double.MinValue;
@ -97,7 +92,7 @@ namespace HeavenStudio.Games
float handStart;
float handProgress;
bool started;
bool inTunnel;
public struct QueuedCowbell
{
@ -119,9 +114,12 @@ namespace HeavenStudio.Games
{
evt.Disable();
}
if (Conductor.instance != null && Conductor.instance.NotStopped())
if (Conductor.instance != null && !(Conductor.instance.isPlaying || Conductor.instance.isPaused))
{
Conductor.instance.FadeMinigameVolume(Conductor.instance.songPositionInBeatsAsDouble, 0, 1);
tunnelLightMaterial.SetColor("_Color", Color.white);
tunnelLightMaterial.SetColor("_AddColor", Color.black);
tunnelSoundRight?.Stop();
tunnelSoundMiddle?.Stop();
tunnelSoundLeft?.Stop();
@ -130,7 +128,6 @@ namespace HeavenStudio.Games
private void Start()
{
driverState = 0;
handStart = -1f;
tunnelWall.SetActive(false);
}
@ -172,13 +169,15 @@ namespace HeavenStudio.Games
{
tunnelWall.transform.localPosition = tunnelStartPos - new Vector3(tunnelChunksPerSec * tunnelWallChunkSize * (float)(cond.songPositionAsDouble - tunnelStartTime), 0, 0);
}
if (cond.songPositionAsDouble >= tunnelEndTime + PostTunnelScrnTime)
if (inTunnel && cond.songPositionAsDouble >= tunnelEndTime + PostTunnelScrnTime)
{
cond.FadeMinigameVolume(cond.GetBeatFromSongPos(tunnelEndTime + PostTunnelScrnTime), fadeDuration, 1);
tunnelLightMaterial.SetColor("_Color", Color.white);
tunnelLightMaterial.SetColor("_AddColor", Color.black);
inTunnel = false;
}
}
public void HitCowbell()
{
SoundByte.PlayOneShot("count-ins/cowbell");
@ -202,7 +201,6 @@ namespace HeavenStudio.Games
public void StartCowbell(double beat, float length)
{
started = true;
lastCowbell = beat - 1;
ScheduleInput(lastCowbell, 1, InputAction_BasicPress, CowbellSuccess, CowbellMiss, CowbellEmpty);
}
@ -210,7 +208,6 @@ namespace HeavenStudio.Games
public void CowbellSuccess(PlayerActionEvent caller, float state)
{
HitCowbell();
//print(state);
if (Math.Abs(state) >= 1f)
{
driverAnimator.Play("Disturbed", -1, 0);
@ -220,30 +217,19 @@ namespace HeavenStudio.Games
{
driverAnimator.Play("Idle", -1, 0);
}
}
public void CowbellMiss(PlayerActionEvent caller)
{
//HitCowbell();
driverAnimator.Play("Angry1", -1, 0);
}
public void CowbellEmpty(PlayerActionEvent caller)
{
//HitCowbell();
}
public void CowbellEmpty(PlayerActionEvent caller) { }
public static void CountIn(double beat, float length)
{
List<MultiSound.Sound> cuelist = new List<MultiSound.Sound>();
for (int i = 0; i < length; i++)
{
if (i % 2 == 0)
@ -264,7 +250,6 @@ namespace HeavenStudio.Games
}
public void StartTunnel(double beat, double length, float volume = 0.1f, float fadeDuration = 2f)
{
Conductor cond = Conductor.instance;
@ -284,14 +269,27 @@ namespace HeavenStudio.Games
this.fadeDuration = fadeDuration;
cond.FadeMinigameVolume(beat, fadeDuration, volume);
tunnelSoundRight?.Stop();
tunnelSoundMiddle?.Stop();
tunnelSoundLeft?.Stop();
tunnelSoundRight = SoundByte.PlayOneShotGame("tunnel/tunnelRight", beat, looping: true);
tunnelSoundMiddle = SoundByte.PlayOneShotGame("tunnel/tunnelMiddle", beat + (6/48f), looping: true);
tunnelSoundLeft = SoundByte.PlayOneShotGame("tunnel/tunnelLeft" + (12/48f), beat, looping: true);
tunnelSoundMiddle = SoundByte.PlayOneShotGame("tunnel/tunnelMiddle", beat + (6 / 48f), looping: true);
tunnelSoundLeft = SoundByte.PlayOneShotGame("tunnel/tunnelLeft", beat + (12 / 48f), looping: true);
double tunnelEnd = cond.GetBeatFromSongPos(tunnelEndTime + PostTunnelScrnTime);
tunnelSoundRight.SetLoopParams(tunnelEnd, 0.1);
tunnelSoundMiddle.SetLoopParams(tunnelEnd + (6/48f), 0.1);
tunnelSoundLeft.SetLoopParams(tunnelEnd + (12/48f), 0.1);
tunnelSoundMiddle.SetLoopParams(tunnelEnd + (6 / 48f), 0.1);
tunnelSoundLeft.SetLoopParams(tunnelEnd + (12 / 48f), 0.25);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(cond.GetBeatFromSongPos(tunnelStartTime + 0.25), delegate {
tunnelLightMaterial.SetColor("_Color", tunnelTint);
tunnelLightMaterial.SetColor("_AddColor", tunnelScreen);
}),
});
inTunnel = true;
}
}
}