Skip to content

Commit a928c07

Browse files
committed
feat(units): add unit level up shader+material+prefab
1 parent a0d62a5 commit a928c07

6 files changed

Lines changed: 287 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 6
6+
m_ObjectHideFlags: 0
7+
m_CorrespondingSourceObject: {fileID: 0}
8+
m_PrefabInstance: {fileID: 0}
9+
m_PrefabAsset: {fileID: 0}
10+
m_Name: UnitLevelUp
11+
m_Shader: {fileID: 4800000, guid: bd5af6afd9b484127b719c581f89c608, type: 3}
12+
m_ShaderKeywords:
13+
m_LightmapFlags: 4
14+
m_EnableInstancingVariants: 0
15+
m_DoubleSidedGI: 0
16+
m_CustomRenderQueue: -1
17+
stringTagMap: {}
18+
disabledShaderPasses: []
19+
m_SavedProperties:
20+
serializedVersion: 3
21+
m_TexEnvs:
22+
- _BumpMap:
23+
m_Texture: {fileID: 0}
24+
m_Scale: {x: 1, y: 1}
25+
m_Offset: {x: 0, y: 0}
26+
- _DetailAlbedoMap:
27+
m_Texture: {fileID: 0}
28+
m_Scale: {x: 1, y: 1}
29+
m_Offset: {x: 0, y: 0}
30+
- _DetailMask:
31+
m_Texture: {fileID: 0}
32+
m_Scale: {x: 1, y: 1}
33+
m_Offset: {x: 0, y: 0}
34+
- _DetailNormalMap:
35+
m_Texture: {fileID: 0}
36+
m_Scale: {x: 1, y: 1}
37+
m_Offset: {x: 0, y: 0}
38+
- _EmissionMap:
39+
m_Texture: {fileID: 0}
40+
m_Scale: {x: 1, y: 1}
41+
m_Offset: {x: 0, y: 0}
42+
- _MainTex:
43+
m_Texture: {fileID: 0}
44+
m_Scale: {x: 1, y: 1}
45+
m_Offset: {x: 0, y: 0}
46+
- _MetallicGlossMap:
47+
m_Texture: {fileID: 0}
48+
m_Scale: {x: 1, y: 1}
49+
m_Offset: {x: 0, y: 0}
50+
- _OcclusionMap:
51+
m_Texture: {fileID: 0}
52+
m_Scale: {x: 1, y: 1}
53+
m_Offset: {x: 0, y: 0}
54+
- _ParallaxMap:
55+
m_Texture: {fileID: 0}
56+
m_Scale: {x: 1, y: 1}
57+
m_Offset: {x: 0, y: 0}
58+
m_Floats:
59+
- _Bands: 2
60+
- _BumpScale: 1
61+
- _CurrentTime: 0
62+
- _Cutoff: 0.5
63+
- _Deformation: 0.08
64+
- _DetailNormalMapScale: 1
65+
- _DstBlend: 0
66+
- _Frequency: 3
67+
- _GlossMapScale: 1
68+
- _Glossiness: 0.5
69+
- _GlossyReflections: 1
70+
- _Lifetime: 2
71+
- _LoopCompression: 3
72+
- _LoopWidth: 0.05
73+
- _Loops: 2
74+
- _Loopspread: 8.53
75+
- _Loopwidth: 0.05
76+
- _Metallic: 0
77+
- _Mode: 0
78+
- _OcclusionStrength: 1
79+
- _Parallax: 0.02
80+
- _SmoothnessTextureChannel: 0
81+
- _SpecularHighlights: 1
82+
- _Speed: 4
83+
- _SrcBlend: 1
84+
- _StartTime: 0
85+
- _Turns: 3
86+
- _UVSec: 0
87+
- _ZWrite: 1
88+
m_Colors:
89+
- _BottomColor: {r: 1, g: 0.8348688, b: 0.3820755, a: 1}
90+
- _Color: {r: 1, g: 1, b: 1, a: 1}
91+
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
92+
- _TopColor: {r: 1, g: 0.19264887, b: 0.0039215684, a: 1}

Assets/Resources/Materials/UnitLevelUp.mat.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1 &7425975466048765977
4+
GameObject:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
serializedVersion: 6
10+
m_Component:
11+
- component: {fileID: 3974308329725597486}
12+
- component: {fileID: 1846128006108076900}
13+
- component: {fileID: 6970553434338867092}
14+
m_Layer: 0
15+
m_Name: LevelUpVFX
16+
m_TagString: Untagged
17+
m_Icon: {fileID: 0}
18+
m_NavMeshLayer: 0
19+
m_StaticEditorFlags: 0
20+
m_IsActive: 1
21+
--- !u!4 &3974308329725597486
22+
Transform:
23+
m_ObjectHideFlags: 0
24+
m_CorrespondingSourceObject: {fileID: 0}
25+
m_PrefabInstance: {fileID: 0}
26+
m_PrefabAsset: {fileID: 0}
27+
m_GameObject: {fileID: 7425975466048765977}
28+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
29+
m_LocalPosition: {x: -0, y: 0, z: 0}
30+
m_LocalScale: {x: 1, y: 1, z: 1}
31+
m_Children: []
32+
m_Father: {fileID: 0}
33+
m_RootOrder: 0
34+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35+
--- !u!33 &1846128006108076900
36+
MeshFilter:
37+
m_ObjectHideFlags: 0
38+
m_CorrespondingSourceObject: {fileID: 0}
39+
m_PrefabInstance: {fileID: 0}
40+
m_PrefabAsset: {fileID: 0}
41+
m_GameObject: {fileID: 7425975466048765977}
42+
m_Mesh: {fileID: -2432090755550338912, guid: 499a4c018e9304139b6449a207931517, type: 3}
43+
--- !u!23 &6970553434338867092
44+
MeshRenderer:
45+
m_ObjectHideFlags: 0
46+
m_CorrespondingSourceObject: {fileID: 0}
47+
m_PrefabInstance: {fileID: 0}
48+
m_PrefabAsset: {fileID: 0}
49+
m_GameObject: {fileID: 7425975466048765977}
50+
m_Enabled: 1
51+
m_CastShadows: 1
52+
m_ReceiveShadows: 1
53+
m_DynamicOccludee: 1
54+
m_MotionVectors: 1
55+
m_LightProbeUsage: 1
56+
m_ReflectionProbeUsage: 1
57+
m_RayTracingMode: 2
58+
m_RenderingLayerMask: 1
59+
m_RendererPriority: 0
60+
m_Materials:
61+
- {fileID: 2100000, guid: dd54a7bce4dc14294ba390f1e1e4dbbe, type: 2}
62+
m_StaticBatchInfo:
63+
firstSubMesh: 0
64+
subMeshCount: 0
65+
m_StaticBatchRoot: {fileID: 0}
66+
m_ProbeAnchor: {fileID: 0}
67+
m_LightProbeVolumeOverride: {fileID: 0}
68+
m_ScaleInLightmap: 1
69+
m_ReceiveGI: 1
70+
m_PreserveUVs: 0
71+
m_IgnoreNormalsForChartDetection: 0
72+
m_ImportantGI: 0
73+
m_StitchLightmapSeams: 1
74+
m_SelectedEditorRenderState: 3
75+
m_MinimumChartSize: 4
76+
m_AutoUVMaxDistance: 0.5
77+
m_AutoUVMaxAngle: 89
78+
m_LightmapParameters: {fileID: 0}
79+
m_SortingLayerID: 0
80+
m_SortingLayer: 0
81+
m_SortingOrder: 0

Assets/Resources/Prefabs/Units/LevelUpVFX.prefab.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
Shader "Custom/FX/Unit Level Up"
2+
{
3+
Properties
4+
{
5+
_BottomColor ("Bottom Color", Color) = (1, 1, 1, 1)
6+
_TopColor ("Top Color", Color) = (1, 1, 1, 1)
7+
_CurrentTime ("Current time", Range(0, 1)) = 0.0
8+
_Loops ("Loops", Float) = 2.0
9+
_LoopCompression ("Loop Compression", Float) = 4
10+
}
11+
SubShader
12+
{
13+
Tags {
14+
"RenderType" = "Transparent"
15+
"Queue" = "Transparent"
16+
}
17+
18+
Pass
19+
{
20+
Cull Off
21+
ZWrite Off
22+
Blend One One
23+
24+
CGPROGRAM
25+
#pragma vertex vert
26+
#pragma fragment frag
27+
28+
#include "UnityCG.cginc"
29+
30+
float4 _BottomColor;
31+
float4 _TopColor;
32+
float _CurrentTime;
33+
float _Loops;
34+
float _LoopCompression;
35+
36+
struct MeshData
37+
{
38+
float4 vertex : POSITION;
39+
float2 uv : TEXCOORD0;
40+
};
41+
42+
struct Interpolators
43+
{
44+
float4 vertex : SV_POSITION;
45+
float2 uv : TEXCOORD1;
46+
};
47+
48+
Interpolators vert (MeshData v)
49+
{
50+
Interpolators o;
51+
o.vertex = UnityObjectToClipPos(v.vertex);
52+
o.uv = v.uv;
53+
return o;
54+
}
55+
56+
float InverseLerp( float a, float b, float v )
57+
{
58+
return ( v - a ) / ( b - a );
59+
}
60+
61+
float4 frag (Interpolators i) : SV_Target
62+
{
63+
// get spiral mask
64+
65+
float lineMask = 0;
66+
float timeOffset = _Time.y;
67+
for(int n=0; n<_Loops; n++)
68+
{
69+
float compression = _LoopCompression;
70+
lineMask += saturate( 1 - compression * abs ( i.uv.x - ( i.uv.y * _Loops - n ) ) );
71+
}
72+
73+
// remap vertical range to [0, 0.85] to get fade earlier
74+
75+
float tColor = InverseLerp( 0, 0.9, i.uv.y );
76+
77+
// lerp according to (remapped) vertical position
78+
79+
float4 lineColor = lerp ( _BottomColor, _TopColor, tColor );
80+
float4 lineFinal = lerp( float4(0, 0, 0, 0), lineColor, lineMask );
81+
82+
// apply reveal over time
83+
float reveal = saturate( 1 - abs ( 1 - i.uv.y * _Loops + _Loops * ( 2.0 * _CurrentTime - 1) ) );
84+
85+
return lineFinal * reveal;
86+
}
87+
ENDCG
88+
}
89+
}
90+
}

Assets/Resources/Shaders/FXUnitLevelUp.shader.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)