特效新内容。修复gameplay致命bug和分数保存bug

This commit is contained in:
FloatGaming
2026-02-16 01:55:18 +08:00
parent 3a7a0b4669
commit 9f7c1c57b7
206 changed files with 112684 additions and 857 deletions
+105
View File
@@ -0,0 +1,105 @@
Shader "Custom/SphereGradientShader"
{
Properties
{
[HDR] _BaseColor("Base Color", Color) = (1,1,1,1)
[HDR] _HeadColor("Head Color (Facing End)", Color) = (1,1,1,1)
[HDR] _TailColor("Tail Color (Facing Start)", Color) = (1,1,1,1)
[Toggle(_EMISSION_ON)] _UseEmission("Enable Emission", Float) = 0
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0,0)
_EmissionIntensity("Emission Intensity", Range(0, 10)) = 1.0
_MoveDir("Movement Direction", Vector) = (0,0,1,0)
_GradientScale("Gradient Scale", Range(0, 2)) = 1.0
_GradientPower("Gradient Power", Range(0.5, 5)) = 2.0
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("Src Blend", Float) = 1
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("Dst Blend", Float) = 0
[Enum(Off, 0, On, 1)] _ZWrite("ZWrite", Float) = 1
}
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "Queue" = "Geometry" }
LOD 100
Pass
{
Blend [_SrcBlend] [_DstBlend]
ZWrite [_ZWrite]
HLSLPROGRAM
#pragma shader_feature _EMISSION_ON
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
float3 normalOS : NORMAL;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
float3 normalWS : TEXCOORD1;
float3 positionWS : TEXCOORD2;
};
CBUFFER_START(UnityPerMaterial)
float4 _BaseColor;
float4 _HeadColor;
float4 _TailColor;
float4 _EmissionColor;
float _EmissionIntensity;
float4 _MoveDir;
float _GradientScale;
float _GradientPower;
CBUFFER_END
Varyings vert(Attributes input)
{
Varyings output;
output.positionWS = TransformObjectToWorld(input.positionOS.xyz);
output.positionCS = TransformWorldToHClip(output.positionWS);
output.uv = input.uv;
output.normalWS = TransformObjectToWorldNormal(input.normalOS);
return output;
}
half4 frag(Varyings input) : SV_Target
{
float3 normal = normalize(input.normalWS);
float3 moveDir = normalize(_MoveDir.xyz);
// 计算空间渐变:-1 到 1 映射到 0 到 1
// 面向 endPoint (moveDir) 时 dot 接近 1,使用 HeadColor
// 面向 startPoint (-moveDir) 时 dot 接近 -1,使用 TailColor
// 反转:使用 -dot 或者 1.0 - spatialLerp
float spatialLerp = dot(normal, -moveDir) * 0.5 + 0.5;
// 应用幂函数调整渐变分布
spatialLerp = clamp(spatialLerp, 0.0, 1.0);
half4 color = lerp(_TailColor, _HeadColor, spatialLerp);
// 叠加一个基础的菲涅尔效果增加立体感
float3 viewDir = normalize(GetWorldSpaceViewDir(input.positionWS));
float fresnel = 1.0 - saturate(dot(normal, viewDir));
fresnel = pow(fresnel, _GradientPower) * _GradientScale;
color.rgb += fresnel * color.rgb * 0.5; // 边缘轻微提亮
// 自发光叠加
#if defined(_EMISSION_ON)
color.rgb += _EmissionColor.rgb * _EmissionIntensity;
#endif
return color;
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c8180535896bd50409dca3bae51df40f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
+47
View File
@@ -0,0 +1,47 @@
%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: blue
m_Shader: {fileID: 4800000, guid: c8180535896bd50409dca3bae51df40f, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3100
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _DstBlend: 10
- _EmissionIntensity: 0.2
- _GradientPower: 2
- _GradientScale: 1
- _SrcBlend: 5
- _UseEmission: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0.27987415, g: 0.982562, b: 1, a: 0}
- _HeadColor: {r: 1, g: 1, b: 1, a: 1}
- _MoveDir: {r: 0, g: 0, b: 1, a: 0}
- _TailColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bae91c010b2630249ab7bd477c95eb63
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+47
View File
@@ -0,0 +1,47 @@
%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: green
m_Shader: {fileID: 4800000, guid: c8180535896bd50409dca3bae51df40f, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3100
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _DstBlend: 10
- _EmissionIntensity: 0.2
- _GradientPower: 2
- _GradientScale: 1
- _SrcBlend: 5
- _UseEmission: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0.5104446, g: 1, b: 0.41194963, a: 0}
- _HeadColor: {r: 1, g: 1, b: 1, a: 1}
- _MoveDir: {r: 0, g: 0, b: 1, a: 0}
- _TailColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 09dfb121bcaf4ba44a5416b386453977
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+47
View File
@@ -0,0 +1,47 @@
%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: purple
m_Shader: {fileID: 4800000, guid: c8180535896bd50409dca3bae51df40f, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3100
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _DstBlend: 10
- _EmissionIntensity: 0.2
- _GradientPower: 2
- _GradientScale: 1
- _SrcBlend: 5
- _UseEmission: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0.540828, g: 0.25471687, b: 1, a: 0}
- _HeadColor: {r: 1, g: 1, b: 1, a: 1}
- _MoveDir: {r: 0, g: 0, b: 1, a: 0}
- _TailColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cbd3bd211dc2cd742a456623f2894895
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+47
View File
@@ -0,0 +1,47 @@
%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: red
m_Shader: {fileID: 4800000, guid: c8180535896bd50409dca3bae51df40f, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3100
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _DstBlend: 10
- _EmissionIntensity: 0.2
- _GradientPower: 2
- _GradientScale: 1
- _SrcBlend: 5
- _UseEmission: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 1, g: 0.24213827, b: 0.24213827, a: 0}
- _HeadColor: {r: 1, g: 1, b: 1, a: 1}
- _MoveDir: {r: 0, g: 0, b: 1, a: 0}
- _TailColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fda61a4e48014e24cacbb48c3f50a2f7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+47
View File
@@ -0,0 +1,47 @@
%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: yellow
m_Shader: {fileID: 4800000, guid: c8180535896bd50409dca3bae51df40f, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3100
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _DstBlend: 10
- _EmissionIntensity: 0.2
- _GradientPower: 2
- _GradientScale: 1
- _SrcBlend: 5
- _UseEmission: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 1, g: 0.78039753, b: 0.18431371, a: 0}
- _HeadColor: {r: 1, g: 1, b: 1, a: 1}
- _MoveDir: {r: 0, g: 0, b: 1, a: 0}
- _TailColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e509704f49208d64e8d94d3054c8bbe8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant: