GPU Lightning Weapons

This commit is contained in:
Reinier Vens 2021-02-05 03:21:15 +00:00
commit 8d10e33db0
26 changed files with 1163 additions and 876 deletions

View file

@ -68,42 +68,6 @@
<e p="HoverCursorChange.cs" t="Include" />
<e p="ItemFilter.cs" t="Include" />
<e p="LineMaterialOffset.cs" t="Include" />
<e p="Packages" t="Include">
<e p="GPUTrail" t="Include">
<e p="GPUTrail.cs" t="Include" />
<e p="GPUTrailIndirect.cs" t="Include" />
<e p="GPUTrailIndirectCulling.cs" t="Include" />
<e p="Sample" t="Include">
<e p="GPUTrailIndirectSample" t="Include">
<e p="GPUTrailIndirectCullingSample.cs" t="Include" />
<e p="GPUTrailIndirectSample.cs" t="Include" />
<e p="GPUTrailIndirectSampleParticle.cs" t="Include" />
<e p="GPUTrailIndirectSampleParticleCS.compute" t="Include" />
</e>
<e p="GPUTrailSample" t="Include">
<e p="AutoRotate.cs" t="Include" />
<e p="GenerateSphere.cs" t="Include" />
</e>
<e p="GPUTrailSpline" t="Include">
<e p="GPUTrailSplineSample.cs" t="Include" />
</e>
</e>
<e p="Scripts" t="Include">
<e p="GPUTrailBase.cs" t="Include" />
<e p="GPUTrailSpline.cs" t="Include" />
</e>
<e p="Shaders" t="Include">
<e p="GPUTrail.compute" t="Include" />
<e p="GPUTrail.shader" t="Include" />
<e p="GPUTrailIndirect.compute" t="Include" />
<e p="GPUTrailIndirectCulling.compute" t="Include" />
<e p="GPUTrailInput.cginc" t="Include" />
<e p="GPUTrailVariables.cginc" t="Include" />
<e p="GPUTrailVariablesCS.compute" t="Include" />
<e p="GPUTrailVertex.cginc" t="Include" />
</e>
</e>
</e>
<e p="Plugins" t="Include">
<e p="AsyncAwaitUtil" t="Include">
<e p="Source" t="Include">
@ -248,6 +212,40 @@
<e p="SimplexNoiseGrad2D.cginc" t="Include" />
<e p="SimplexNoiseGrad3D.cginc" t="Include" />
</e>
<e p="GPUTrail" t="Include">
<e p="GPUTrail.cs" t="Include" />
<e p="GPUTrailIndirect.cs" t="Include" />
<e p="GPUTrailIndirectCulling.cs" t="Include" />
<e p="Sample" t="Include">
<e p="GPUTrailIndirectSample" t="Include">
<e p="GPUTrailIndirectCullingSample.cs" t="Include" />
<e p="GPUTrailIndirectSample.cs" t="Include" />
<e p="GPUTrailIndirectSampleParticle.cs" t="Include" />
<e p="GPUTrailIndirectSampleParticleCS.compute" t="Include" />
</e>
<e p="GPUTrailSample" t="Include">
<e p="AutoRotate.cs" t="Include" />
<e p="GenerateSphere.cs" t="Include" />
</e>
<e p="GPUTrailSpline" t="Include">
<e p="GPUTrailSplineSample.cs" t="Include" />
</e>
</e>
<e p="Scripts" t="Include">
<e p="GPUTrailBase.cs" t="Include" />
<e p="GPUTrailSpline.cs" t="Include" />
</e>
<e p="Shaders" t="Include">
<e p="GPUTrail.compute" t="Include" />
<e p="GPUTrail.shader" t="Include" />
<e p="GPUTrailIndirect.compute" t="Include" />
<e p="GPUTrailIndirectCulling.compute" t="Include" />
<e p="GPUTrailInput.cginc" t="Include" />
<e p="GPUTrailVariables.cginc" t="Include" />
<e p="GPUTrailVariablesCS.compute" t="Include" />
<e p="GPUTrailVertex.cginc" t="Include" />
</e>
</e>
<e p="MessagePack" t="Include">
<e p="Annotations" t="Include">
<e p="Attributes.cs" t="Include" />

View file

@ -176,6 +176,8 @@
<Compile Include="Assets\Scripts\UI\Spreadsheet.cs" />
<Compile Include="Assets\Scripts\CameraPerlinOrbit.cs" />
<Compile Include="Assets\Scripts\Gameplay\HullCollider.cs" />
<Compile Include="Assets\Scripts\Gameplay\Weapons\ConstantLightning.cs" />
<Compile Include="Assets\Scripts\Gameplay\Weapons\ConstantLightningManager.cs" />
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\UIAdditive.shader" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro.cginc" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF-Mobile Overlay.shader" />

View file

@ -0,0 +1,142 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7383646976225659343
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7383646976225659342}
- component: {fileID: 7383646976225659329}
m_Layer: 0
m_Name: Lightning
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7383646976225659342
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7383646976225659343}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7383646976225659329
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7383646976225659343}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 044c2be5da0fc2340a09f856be731cea, type: 3}
m_Name:
m_EditorClassIdentifier:
Camera: {fileID: 0}
StartPosition: {x: 0, y: 500, z: 0}
EndPosition: {x: 0, y: 0, z: 0}
StartWidth: 2.5
EndWidth: 0.5
BranchLength: 64
MorphSpeed: 2.5
NoiseAmplitude: 64
NoiseFrequency: 0.0025
NoiseGain: 0.2
NoiseLacunarity: 5
FixedEndpoint: 0
LeaderWidth: 2
LeaderDuration: 4
LeaderIntensity: 10
PulseDuration: 2
PulseIntensity: 1000
PulseWidth: 2
PulseTrunkIntensityCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.1
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
PulseBranchIntensityCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.01
inSlope: -0.044314474
outSlope: -0.044314474
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0.05641593
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
PulseWidthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: -1.7295918
outSlope: -1.7295918
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0.05420354
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
TrunkNodeCount: 2048
BranchCount: 16
BranchNodeCount: 128
RenderMaterial: {fileID: 2100000, guid: c94ec17d8118c2749ad885c2b378ea01, type: 2}
ComputeShader: {fileID: 7200000, guid: a974189fea3fe9a46a7859ef6ea8da09, type: 3}
DebugDrawNodes: 0
DebugDrawVertices: 0

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: eb3a880755444d144a4d7f13ef11df77
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -29,8 +29,7 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7930492351484902759}
- {fileID: 8908669924470592673}
- {fileID: 8454157079536979760}
m_Father: {fileID: 6101924816820053886}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -46,72 +45,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5c75d76a7b418d3479761187b2d420bc, type: 3}
m_Name:
m_EditorClassIdentifier:
Trunk: {fileID: 1576755778947147315}
BranchPrototype: {fileID: 7950428215667845793}
LightningCompute: {fileID: 8454157079536979775}
HitRadius: 5
Duration: 0.5
IntensityCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 15.255
outSlope: 15.255
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0.2198576
- serializedVersion: 3
time: 0.099529654
value: 0.7125015
inSlope: -0.07577679
outSlope: -0.07577679
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.07689258
- serializedVersion: 3
time: 0.23082784
value: 0.23103416
inSlope: 4.1353536
outSlope: 4.1353536
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.48861334
- serializedVersion: 3
time: 0.352674
value: 0.9862572
inSlope: 0.11107577
outSlope: 0.11107577
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.0907272
- serializedVersion: 3
time: 1
value: 0
inSlope: -2.1678352
outSlope: -2.1678352
tangentMode: 0
weightedMode: 0
inWeight: 0.07860794
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
BranchCount: 8
BranchDistance: 32
PointCount: 256
BranchPointCount: 64
MorphSpeed: 20
Octaves: 3
Frequency: 0.01
Offset: 0
Amplitude: 15
Lacunarity: 2
Gain: 0.5
--- !u!114 &4364339867848153585
MonoBehaviour:
m_ObjectHideFlags: 0
@ -169,576 +104,165 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
Prototype: {fileID: 4364339867848153585}
--- !u!1 &8231147997880483471
GameObject:
--- !u!1001 &1379448248635655934
PrefabInstance:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7930492351484902759}
- component: {fileID: 1576755778947147315}
m_Layer: 0
m_Name: Line
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7930492351484902759
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4033498549525708839}
m_Modifications:
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: Animate
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: MorphSpeed
value: 3
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartWidth
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: LeaderWidth
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: BranchLength
value: 32
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: EndPosition.x
value: -3424.384
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: EndPosition.y
value: -311.8413
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: EndPosition.z
value: 6464.0195
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: PulseDuration
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: LeaderDuration
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: NoiseAmplitude
value: 32
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: NoiseLacunarity
value: 6
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartPosition.x
value: -4001.9797
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartPosition.y
value: -362.0634
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartPosition.z
value: 6939.794
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659343, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_Name
value: Lightning
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: eb3a880755444d144a4d7f13ef11df77, type: 3}
--- !u!4 &8454157079536979760 stripped
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
m_PrefabInstance: {fileID: 1379448248635655934}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8231147997880483471}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4033498549525708839}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!120 &1576755778947147315
LineRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8231147997880483471}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 9c20b9ccbbbb1b14cb5729e0c8460cd9, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: -0.5
tangentMode: 69
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.5
inSlope: -0.5
outSlope: 0
tangentMode: 69
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 0.050000012, b: 0.9991149, a: 1}
key1: {r: 0.050000012, g: 0.3610669, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
shadowBias: 0.5
generateLightingData: 0
m_UseWorldSpace: 1
m_Loop: 0
--- !u!1 &9043411360431727333
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8908669924470592673}
- component: {fileID: 7280962290875153966}
- component: {fileID: 7950428215667845793}
m_Layer: 0
m_Name: Branch
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8908669924470592673
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9043411360431727333}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4033498549525708839}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!120 &7280962290875153966
LineRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9043411360431727333}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 9c20b9ccbbbb1b14cb5729e0c8460cd9, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Positions:
- {x: 0, y: 0, z: 0}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: -1
tangentMode: 69
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: -1
outSlope: 0
tangentMode: 69
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 0}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
shadowBias: 0.5
generateLightingData: 0
m_UseWorldSpace: 1
m_Loop: 0
--- !u!114 &7950428215667845793
--- !u!114 &8454157079536979775 stripped
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
m_PrefabInstance: {fileID: 1379448248635655934}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9043411360431727333}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3}
m_Script: {fileID: 11500000, guid: 044c2be5da0fc2340a09f856be731cea, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,305 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6697988721035608826
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8092217512616552971}
- component: {fileID: 8139927425898867051}
- component: {fileID: 4961115960910193164}
m_Layer: 0
m_Name: Bolt
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8092217512616552971
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6697988721035608826}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7692568534316527279}
m_Father: {fileID: 6705871793161460977}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8139927425898867051
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6697988721035608826}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b184352ea3694b8d892f1402b8d51153, type: 3}
m_Name:
m_EditorClassIdentifier:
Lightning: {fileID: 7692568534316527264}
HitRadius: 8
FadeCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
StartWidth: 0.5
EndWidth: 0.5
FadeDuration: 0.5
--- !u!114 &4961115960910193164
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6697988721035608826}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &8960602767558375808
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6705871793161460977}
- component: {fileID: 8350558017173826883}
m_Layer: 0
m_Name: Tesla Gun
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6705871793161460977
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8960602767558375808}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 8092217512616552971}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8350558017173826883
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8960602767558375808}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ecabe4f078a147459bba6172582d7bc8, type: 3}
m_Name:
m_EditorClassIdentifier:
LightningPrototype: {fileID: 4961115960910193164}
--- !u!1001 &916066491333994337
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 8092217512616552971}
m_Modifications:
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: Camera
value:
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: EndWidth
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: NoiseGain
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: MorphSpeed
value: 150
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartWidth
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: BranchCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: BranchLength
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: EndPosition.x
value: 2367.149
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: EndPosition.y
value: -475.3712
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: EndPosition.z
value: 2901.6836
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: NoiseAmplitude
value: 8
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: NoiseFrequency
value: 0.005
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: RenderMaterial
value:
objectReference: {fileID: 2100000, guid: 476f7453551d79b469dda2d6926b93fd, type: 2}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: TrunkNodeCount
value: 4096
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartPosition.x
value: 2794.1182
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartPosition.y
value: -483.92413
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: StartPosition.z
value: 2641.6372
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659343, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_Name
value: Lightning
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: eb3a880755444d144a4d7f13ef11df77, type: 3}
--- !u!4 &7692568534316527279 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
m_PrefabInstance: {fileID: 916066491333994337}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7692568534316527264 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
m_PrefabInstance: {fileID: 916066491333994337}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 044c2be5da0fc2340a09f856be731cea, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e319f59ddd6d4fb42a1c47bb5ca0abd5
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -7004,13 +7004,13 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519840345}
m_LocalRotation: {x: 0, y: 0, z: -0.258819, w: 0.9659259}
m_LocalRotation: {x: 0, y: 0, z: -0.38268343, w: 0.92387956}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 263352743}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -30}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -45}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
@ -17819,7 +17819,7 @@ PrefabInstance:
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 55.675
objectReference: {fileID: 0}
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}
@ -18182,13 +18182,13 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1558182380}
m_LocalRotation: {x: 0, y: 0, z: 0.2588191, w: 0.9659258}
m_LocalRotation: {x: 0, y: 0, z: 0.38268343, w: 0.92387956}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 263352743}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 30}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 45}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
@ -18750,7 +18750,7 @@ PrefabInstance:
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 60.98
objectReference: {fileID: 0}
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}

View file

@ -123,67 +123,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &23518774
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 23518775}
- component: {fileID: 23518776}
m_Layer: 0
m_Name: Lightning
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &23518775
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 23518774}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &23518776
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 23518774}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 044c2be5da0fc2340a09f856be731cea, type: 3}
m_Name:
m_EditorClassIdentifier:
StartPosition: {x: 0, y: 500, z: 0}
EndPosition: {x: 0, y: 0, z: 0}
StartWidth: 2.5
EndWidth: 0.5
BranchLength: 50
MorphSpeed: 2.5
NoiseAmplitude: 80
NoiseFrequency: 0.0025
NoiseGain: 0.2
NoiseLacunarity: 6
Camera: {fileID: 104940729}
TrunkNodeCount: 4096
BranchCount: 8
BranchNodeCount: 128
RenderMaterial: {fileID: 2100000, guid: c94ec17d8118c2749ad885c2b378ea01, type: 2}
ComputeShader: {fileID: 7200000, guid: a974189fea3fe9a46a7859ef6ea8da09, type: 3}
DebugDrawNodes: 0
DebugDrawVertices: 0
--- !u!1 &104940725
GameObject:
m_ObjectHideFlags: 0
@ -330,13 +269,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 104940725}
m_LocalRotation: {x: -0.258819, y: 0, z: 0, w: 0.9659259}
m_LocalPosition: {x: 0, y: 0, z: -285}
m_LocalRotation: {x: -0.2419218, y: 0, z: 0, w: 0.9702958}
m_LocalPosition: {x: 0, y: 0, z: -330}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 310526803}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -30, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: -28, y: 0, z: 0}
--- !u!1 &310526802
GameObject:
m_ObjectHideFlags: 0
@ -381,7 +320,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 47e64413aeb5ae740b410d70fb05d20c, type: 3}
m_Name:
m_EditorClassIdentifier:
rotSpeed: {x: 0, y: 1, z: 0}
rotSpeed: {x: 0, y: 15, z: 0}
--- !u!1 &1812750579
GameObject:
m_ObjectHideFlags: 0
@ -535,3 +474,77 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &7383646976240752633
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 7383646976225659329, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: Camera
value:
objectReference: {fileID: 104940729}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659342, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7383646976225659343, guid: eb3a880755444d144a4d7f13ef11df77,
type: 3}
propertyPath: m_Name
value: Lightning
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: eb3a880755444d144a4d7f13ef11df77, type: 3}

View file

@ -177,7 +177,13 @@ public class ActionGameManager : MonoBehaviour
_input.Global.Dock.performed += context =>
{
if (CurrentShip.Parent == null) Dock();
if (CurrentShip == null)
{
ConfirmationDialog.Clear();
ConfirmationDialog.Title.text = "Can't undock. You dont have a ship!";
ConfirmationDialog.Show();
}
else if (CurrentShip.Parent == null) Dock();
else Undock();
};

View file

@ -0,0 +1,79 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ConstantLightning : MonoBehaviour
{
public LightningCompute Lightning;
public float HitRadius;
public AnimationCurve FadeCurve;
public float StartWidth = 1;
public float EndWidth = 1;
public float FadeDuration;
public Transform Barrel { get; set; }
public float Damage { get; set; }
public float Penetration { get; set; }
public float Spread { get; set; }
public DamageType DamageType { get; set; }
public EntityInstance Source { get; set; }
public float Range { get; set; }
private bool _stopping;
private float _startTime;
private void OnEnable()
{
_stopping = false;
Lightning.StartAnimation();
}
private void Update()
{
if (Barrel == null) return;
if (_stopping)
{
var lerp = (Time.time - _startTime) / FadeDuration;
Lightning.StartWidth = FadeCurve.Evaluate(lerp) * StartWidth;
Lightning.EndWidth = FadeCurve.Evaluate(lerp) * EndWidth;
if (lerp > 1)
{
GetComponent<Prototype>().ReturnToPool();
return;
}
}
else
{
Lightning.StartWidth = StartWidth;
Lightning.EndWidth = EndWidth;
}
Lightning.FixedEndpoint = false;
var hits = Physics.SphereCastAll(Barrel.position, HitRadius, Barrel.forward, Range, 1);
foreach (var hit in hits)
{
var hull = hit.collider.GetComponent<HullCollider>();
if (hull)
{
if (hull.Entity == Source.Entity) continue;
hull.SendHit(Damage * Time.deltaTime, Penetration, Spread, DamageType, Source.Entity, hit, Barrel.forward);
}
Lightning.FixedEndpoint = true;
Lightning.EndPosition = hit.point;
break;
}
if(!Lightning.FixedEndpoint)
Lightning.EndPosition = Barrel.position + Barrel.forward * Range;
Lightning.StartPosition = Barrel.position;
}
public void Stop()
{
_stopping = true;
_startTime = Time.time;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b184352ea3694b8d892f1402b8d51153
timeCreated: 1612491884

View file

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
public class ConstantLightningManager : ConstantWeaponEffectManager
{
public Prototype LightningPrototype;
private Dictionary<EquippedItem, ConstantLightning> _bolts = new Dictionary<EquippedItem, ConstantLightning>();
public override void StartFiring(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target)
{
var p = LightningPrototype.Instantiate<ConstantLightning>();
p.Source = source;
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
var barrel = source.GetBarrel(hp);
p.Barrel = barrel;
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item.EquippableItem, source.Entity);
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item.EquippableItem, source.Entity);
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item.EquippableItem, source.Entity);
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item.EquippableItem, source.Entity);
p.DamageType = data.DamageType;
_bolts.Add(item, p);
}
public override void StopFiring(EquippedItem item)
{
_bolts[item].Stop();
_bolts.Remove(item);
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ecabe4f078a147459bba6172582d7bc8
timeCreated: 1612491892

View file

@ -9,23 +9,8 @@ using Random = UnityEngine.Random;
public class Lightning : MonoBehaviour
{
public LineRenderer Trunk;
public Prototype BranchPrototype;
public LightningCompute LightningCompute;
public float HitRadius;
public float Duration;
public AnimationCurve IntensityCurve;
public int BranchCount;
public float BranchDistance;
public int PointCount;
public int BranchPointCount;
public int MorphSpeed;
public int Octaves;
public float Frequency;
public float Offset;
public float Amplitude;
public float Lacunarity;
public float Gain;
public float Damage { get; set; }
public float Penetration { get; set; }
@ -36,46 +21,16 @@ public class Lightning : MonoBehaviour
public EntityInstance Target { get; set; }
public Transform Barrel { get; set; }
private float _startTime;
private LineRenderer[] _branches;
private Vector3[] _points;
private Vector3[][] _branchPoints;
private int[] _branchStarts;
private bool _colliderHit;
private Vector3 _colliderLocalPosition;
private Transform _colliderTransform;
private Vector3 _endpoint;
private float _offset;
private void Awake()
{
_points = new Vector3[PointCount];
_branchPoints = new Vector3[BranchCount][];
_branchStarts = new int[BranchCount];
_branches = new LineRenderer[BranchCount];
for (int i = 0; i < BranchCount; i++)
{
_branchPoints[i] = new Vector3[BranchPointCount];
_branches[i] = BranchPrototype.Instantiate<LineRenderer>();
}
}
public void Fire()
{
_offset = Random.value * 1000;
_startTime = Time.time;
Trunk.widthMultiplier = 0;
foreach(var line in _branches)
line.widthMultiplier = 0;
for (int i = 0; i < BranchCount; i++)
{
_branchStarts[i] = Random.Range(0, PointCount);
var lerp = (float) _branchStarts[i] / PointCount;
_branches[i].startColor = Trunk.colorGradient.Evaluate(lerp);
}
_colliderHit = false;
LightningCompute.OnLeaderComplete = null;
LightningCompute.FixedEndpoint = false;
var hits = Physics.SphereCastAll(Barrel.position, HitRadius, Barrel.forward, Range, 1);
foreach (var hit in hits)
{
@ -83,64 +38,32 @@ public class Lightning : MonoBehaviour
if (hull)
{
if (hull.Entity == Source.Entity) continue;
hull.SendHit(Damage, Penetration, Spread, DamageType, Source.Entity, hit, Barrel.forward);
LightningCompute.OnLeaderComplete = () =>
hull.SendHit(Damage, Penetration, Spread, DamageType, Source.Entity, hit, Barrel.forward);
}
_colliderHit = true;
_colliderLocalPosition = hit.collider.transform.InverseTransformPoint(hit.point);
_colliderTransform = hit.collider.transform;
LightningCompute.FixedEndpoint = true;
break;
}
LightningCompute.OnPulseComplete = () =>
GetComponent<Prototype>().ReturnToPool();
LightningCompute.StartAnimation();
_endpoint = Barrel.position + Barrel.forward * Range;
}
private void Update()
{
if (Barrel == null) return;
var time = (Time.time - _startTime) / Duration;
if (time > 1)
{
GetComponent<Prototype>().ReturnToPool();
return;
}
Trunk.widthMultiplier = IntensityCurve.Evaluate(time);
if (_colliderHit)
{
if(_colliderTransform) _endpoint = _colliderTransform.TransformPoint(_colliderLocalPosition);
if (_colliderTransform) _endpoint = _colliderTransform.TransformPoint(_colliderLocalPosition);
}
else _endpoint = Barrel.position + Barrel.forward * Range + (Vector3) NoiseFbm.fBm3(Time.time, Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain);
var startPoint = Barrel.position;
var dist = (_endpoint - startPoint).magnitude;
var startOffset = -NoiseFbm.fBm3(float2(0+_offset, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain);
var endOffset = -NoiseFbm.fBm3(float2(dist+_offset, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain);
for (int i = 0; i < PointCount; i++)
{
var l = (float) i / (PointCount - 1);
var sampleDist = dist * l;
var pos = lerp(startPoint, _endpoint, l) +
NoiseFbm.fBm3(float2(sampleDist+_offset, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain);
if (l < .5f) pos += startOffset * (1 - l * 2);
else pos += endOffset * (2 * (l - .5f));
_points[i] = pos;
}
Trunk.SetPositions(_points);
for (int i = 0; i < BranchCount; i++)
{
_branches[i].widthMultiplier = Trunk.widthMultiplier * Trunk.widthCurve.Evaluate((float) _branchStarts[i] / PointCount);
var branchStartPoint = _points[_branchStarts[i]];
var branchEndPoint = branchStartPoint + Random.onUnitSphere * BranchDistance;
var branchstartOffset = -NoiseFbm.fBm3(float2(_branchStarts[i]*10, Time.time*MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain);
for (int j = 0; j < BranchPointCount; j++)
{
var l = (float) j / (BranchPointCount - 1);
var sampleDist = BranchDistance * l + _branchStarts[i]*10;
var pos = lerp(branchStartPoint, branchEndPoint, l) +
NoiseFbm.fBm3(float2(sampleDist * 2, Time.time * MorphSpeed), Octaves, Frequency, Offset, Amplitude, Lacunarity, Gain);
if (l < .5f) pos += branchstartOffset * (1 - l * 2);
_branchPoints[i][j] = pos;
}
_branches[i].SetPositions(_branchPoints[i]);
}
LightningCompute.EndPosition = _endpoint;
LightningCompute.StartPosition = Barrel.position;
}
}

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
executionOrder: 53
icon: {instanceID: 0}
userData:
assetBundleName:

View file

@ -373,9 +373,9 @@ public class SectorRenderer : MonoBehaviour
hitShape[v] = true;
}
for (int i = 0; i < hit.Spread - 1; i++)
for (int i = 0; i < Mathf.RoundToInt(hit.Spread); i++)
{
hitShape.Expand();
hitShape = hitShape.Expand();
}
if (hit.Penetration > .5f)

View file

@ -0,0 +1,85 @@
%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: Lightning 1
m_Shader: {fileID: 4800000, guid: 21dd485e846b4d3a8213cf5551832776, 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}
- _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_Floats:
- _BranchIntensity: 10
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Intensity: 100
- _LeaderIntensity: 100
- _LeaderProgress: 2
- _LeaderSize: 0.025
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EndColor: {r: 1, g: 0.049999997, b: 0.049999997, a: 1}
- _StartColor: {r: 1, g: 0.20970267, b: 0.051643193, a: 1}
m_BuildTextureStacks: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 476f7453551d79b469dda2d6926b93fd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -78,10 +78,9 @@ void UpdateNodes (uint3 id : SV_DispatchThreadID)
float distance = length(bolt.startPos - samplePos);
node.pos = samplePos +
fbm3(float2(distance, _Time + node.bolt * 10)) +
bolt.startOffset * max(.5 - node.time, 0) * 2 +
bolt.endOffset * max(node.time - .5, 0) * 2;
node.pos = samplePos + fbm3(float2(distance, _Time + node.bolt * 10));
if(node.bolt == 0) node.pos += bolt.startOffset * max(.5 - node.time, 0) * 2 + bolt.endOffset * max(node.time - .5, 0) * 2;
else node.pos += bolt.startOffset;
_NodeBuffer[idx] = node;
}
@ -129,10 +128,10 @@ void CreateWidth (uint3 id : SV_DispatchThreadID)
float uvx = bolt.startTime + node.time * (1-bolt.startTime);
v0.pos = pos - right;
v0.uv = float2(uvx, 0);
v0.uv = float2(uvx, 0 + node.bolt);
v1.pos = pos + right;
v1.uv = float2(uvx, 1);
v1.uv = float2(uvx, 1 + node.bolt);
uint vId = idx * 2;
_VertexBuffer[vId] = v0;

View file

@ -56,6 +56,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BranchIntensity: 10
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
@ -63,6 +64,10 @@ Material:
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Intensity: 10
- _LeaderIntensity: 100
- _LeaderProgress: 0.81259537
- _LeaderSize: 0.025
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
@ -75,6 +80,6 @@ Material:
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _EndColor: {r: 0.40784314, g: 0.9411765, b: 8, a: 0}
- _StartColor: {r: 16, g: 0.8156863, b: 11.043138, a: 1}
- _EndColor: {r: 0.062478006, g: 0.11552096, b: 0.801, a: 0}
- _StartColor: {r: 0.83699995, g: 0.043821972, b: 0.57845026, a: 1}
m_BuildTextureStacks: []

View file

@ -1,7 +1,12 @@
Shader "Aetheria/GPU Lightning" {
Properties {
[HDR]_StartColor("StartColor", Color) = (1,1,1,1)
[HDR]_EndColor("EndColor", Color) = (0,0,0,1)
_StartColor("StartColor", Color) = (1,1,1,1)
_EndColor("EndColor", Color) = (0,0,0,1)
_Intensity("Intensity", Float) = 1
_LeaderIntensity("LeaderIntensity", Float) = 10
_LeaderProgress("Leader Progress", Float) = 1
_LeaderSize("Leader Size", Float) = .01
_BranchIntensity("Branch Intensity", Float) = 1
}
SubShader {
@ -10,7 +15,6 @@ Pass{
CGPROGRAM
#pragma target 5.0
#pragma shader_feature GPUTRAIL_TRAIL_INDEX_ON
#pragma vertex vert
#pragma fragment frag
@ -18,10 +22,14 @@ Pass{
#include "UnityCG.cginc"
#include "LightningVertex.cginc"
#include "Assets/Shaders/Dither Functions.cginc"
float _Intensity;
float _LeaderIntensity;
float _LeaderProgress;
float _LeaderSize;
float _BranchIntensity;
fixed4 _StartColor;
fixed4 _EndColor;
uint _VerticesPerInstance;
StructuredBuffer<uint> _IndexBuffer;
StructuredBuffer<Vertex> _VertexBuffer;
@ -52,9 +60,15 @@ Pass{
fixed4 frag (vs_out In) : COLOR0
{
// Discard fragments that are further than the leader progress
clip(_LeaderProgress-In.uv.x);
// Simple quadratic curve "texture"
float x = 2 * In.uv.y - 1;
float x = 2 * (In.uv.y % 1) - 1;
float a = 1 - x * x;
float i = In.uv.y > 1 ? _BranchIntensity : _Intensity;
a *= lerp(i, _LeaderIntensity, smoothstep(_LeaderProgress - _LeaderSize * 1.5, _LeaderProgress - _LeaderSize, In.uv.x));
// Apply screen space dithering
float2 screenUV = In.screenPos.xy / In.screenPos.w;
@ -65,6 +79,69 @@ Pass{
ENDCG
}
Pass{
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
CGPROGRAM
#pragma target 5.0
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "LightningVertex.cginc"
#include "Assets/Shaders/Dither Functions.cginc"
float _LeaderProgress;
float _LeaderSize;
StructuredBuffer<uint> _IndexBuffer;
StructuredBuffer<Vertex> _VertexBuffer;
Vertex GetVertex(uint indexBufferIdx) {
uint idx = _IndexBuffer[indexBufferIdx];
return _VertexBuffer[idx];
}
struct vs_out {
float4 pos : SV_POSITION;
float4 col : COLOR;
float2 uv : TEXCOORD;
float4 screenPos : TEXCOORD1;
};
vs_out vert (uint id : SV_VertexID, uint iId : SV_InstanceID)
{
vs_out Out;
Vertex vtx = GetVertex(id);
Out.pos = UnityObjectToClipPos(float4(vtx.pos, 1.0));
Out.uv = vtx.uv;
Out.col = 1;
Out.screenPos = ComputeScreenPos(float4(vtx.pos, 1.0));
return Out;
}
fixed4 frag (vs_out In) : COLOR0
{
// Discard fragments that are further than the leader progress
clip(_LeaderProgress-In.uv.x);
// Simple quadratic curve "texture"
float x = 2 * (In.uv.y % 1) - 1;
float a = 1 - x * x;
// Apply screen space dithering
float2 screenUV = In.screenPos.xy / In.screenPos.w;
ditherClip(screenUV, a);
SHADOW_CASTER_FRAGMENT(In)
}
ENDCG
}
}

View file

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@ -5,12 +6,16 @@ using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Rendering;
using Unity.Mathematics;
using UnityEngine.InputSystem;
using UnityEngine.Serialization;
using static Unity.Mathematics.math;
using static Unity.Mathematics.noise;
using Random = UnityEngine.Random;
public class LightningCompute : MonoBehaviour
{
public Camera Camera;
[Header("Bolt Properties")]
public Vector3 StartPosition;
public Vector3 EndPosition;
@ -22,7 +27,19 @@ public class LightningCompute : MonoBehaviour
public float NoiseFrequency;
public float NoiseGain;
public float NoiseLacunarity;
public Camera Camera;
public bool FixedEndpoint;
public bool Animate;
[Header("Animation Properties")]
public float LeaderWidth;
public float LeaderDuration;
public float LeaderIntensity;
public float PulseDuration;
public float PulseIntensity;
public float PulseWidth;
public AnimationCurve PulseTrunkIntensityCurve;
public AnimationCurve PulseBranchIntensityCurve;
public AnimationCurve PulseWidthCurve;
[Header("Buffer Sizes")]
public int TrunkNodeCount;
@ -36,6 +53,9 @@ public class LightningCompute : MonoBehaviour
public bool DebugDrawNodes;
public bool DebugDrawVertices;
public Action OnLeaderComplete;
public Action OnPulseComplete;
private Transform _cameraTransform;
private ComputeBuffer _nodeBuffer;
@ -48,6 +68,12 @@ public class LightningCompute : MonoBehaviour
private const int GROUP_SIZE = 64;
private int _updateKernel;
private int _createWidthKernel;
private float _animationStartTime;
private float _time;
private bool _leaderComplete;
private bool _pulseComplete;
private bool _initialized;
private Material _materialInstance;
private int NodeBufferSize => TrunkNodeCount + BranchCount * BranchNodeCount;
private int VertexBufferSize => NodeBufferSize * 2;
@ -78,14 +104,21 @@ public class LightningCompute : MonoBehaviour
void Start()
{
Initialize();
_materialInstance = Instantiate(RenderMaterial);
}
void Initialize()
{
if (_initialized) return;
_initialized = true;
if (!Camera)
Camera = Camera.main;
_cameraTransform = Camera.transform;
_updateKernel = ComputeShader.FindKernel("UpdateNodes");
_createWidthKernel = ComputeShader.FindKernel("CreateWidth");
InitBuffers();
}
void InitBuffers()
{
_nodeBuffer = new ComputeBuffer(NodeBufferSize, Marshal.SizeOf(typeof(Node)));
var nodeList = new List<Node>();
for (int i = 0; i < TrunkNodeCount; i++)
@ -113,17 +146,6 @@ public class LightningCompute : MonoBehaviour
endPos = EndPosition,
startTime = 0
};
for (int i = 0; i < BranchCount; i++)
{
_branchEndpoints[i] = Random.insideUnitSphere * BranchLength;
var parent = nodeList[(int)((float) i / BranchCount * TrunkNodeCount)];
_bolts[i+1] = new Bolt
{
startPos = parent.pos,
endPos = parent.pos + _branchEndpoints[i],
startTime = parent.time
};
}
_boltBuffer.SetData(_bolts);
@ -159,6 +181,24 @@ public class LightningCompute : MonoBehaviour
_indexBuffer = new ComputeBuffer(indexData.Length, Marshal.SizeOf(typeof(uint))); // 1 node to 2 triangles(6vertexs)
_indexBuffer.SetData(indexData);
}
public void StartAnimation()
{
Initialize();
_animationStartTime = Time.time;
_time = Random.value * 1000;
_leaderComplete = false;
_pulseComplete = false;
for (int i = 0; i < BranchCount; i++)
{
_branchEndpoints[i] = Random.insideUnitSphere * BranchLength;
_bolts[i+1] = new Bolt
{
startTime = Random.value * .8f
};
}
}
float fbm(float2 p)
{
@ -183,23 +223,51 @@ public class LightningCompute : MonoBehaviour
void Update()
{
var time = Time.time * MorphSpeed;
_time += Time.deltaTime * MorphSpeed;
if(Animate)
{
var leaderLerp = (Time.time - _animationStartTime) / LeaderDuration;
if (leaderLerp > 1 && !_leaderComplete)
{
OnLeaderComplete?.Invoke();
_leaderComplete = true;
}
var pulseLerp = (Time.time - _animationStartTime - LeaderDuration) / PulseDuration;
if (pulseLerp > 1 && !_pulseComplete)
{
OnPulseComplete?.Invoke();
_pulseComplete = true;
}
ComputeShader.SetFloat("_StartWidth", leaderLerp < 1 ? LeaderWidth : StartWidth * PulseWidthCurve.Evaluate(pulseLerp)*PulseWidth);
ComputeShader.SetFloat("_EndWidth", leaderLerp < 1 ? LeaderWidth : EndWidth * PulseWidthCurve.Evaluate(pulseLerp)*PulseWidth);
_materialInstance.SetFloat("_LeaderProgress", leaderLerp);
_materialInstance.SetFloat("_BranchIntensity", leaderLerp < 1 ? LeaderIntensity : PulseBranchIntensityCurve.Evaluate(pulseLerp) * PulseIntensity);
_materialInstance.SetFloat("_Intensity", leaderLerp < 1 ? LeaderIntensity : PulseTrunkIntensityCurve.Evaluate(pulseLerp) * PulseIntensity);
}
else
{
ComputeShader.SetFloat("_StartWidth", StartWidth);
ComputeShader.SetFloat("_EndWidth", EndWidth);
}
var diff = EndPosition - StartPosition;
var dist = diff.magnitude;
_bolts[0].startPos = StartPosition;
_bolts[0].startOffset = -(Vector3) fbm3(float2(0, time));
_bolts[0].startOffset = -(Vector3) fbm3(float2(0, _time));
_bolts[0].endPos = EndPosition;
_bolts[0].endOffset = -(Vector3) fbm3(float2(dist, time));
_bolts[0].endOffset = FixedEndpoint ? -(Vector3) fbm3(float2(dist, _time)) : Vector3.zero;
for (int i = 0; i < BranchCount; i++)
{
var root = Vector3.Lerp(StartPosition, EndPosition, _bolts[i + 1].startTime);
var rootDist = _bolts[i + 1].startTime * dist;
_bolts[i + 1].startPos =
root + (Vector3) fbm3(float2(rootDist, time)) +
root + (Vector3) fbm3(float2(rootDist, _time)) +
_bolts[0].startOffset * (max(.5f - _bolts[i + 1].startTime, 0) * 2) +
_bolts[0].endOffset * (max(_bolts[i + 1].startTime - .5f, 0) * 2);
_bolts[i + 1].startOffset = -(Vector3) fbm3(float2(0, time + (i + 1) * 10));
_bolts[i + 1].startOffset = -(Vector3) fbm3(float2(0, _time + (i + 1) * 10));
_bolts[i + 1].endPos = root + _branchEndpoints[i];
}
@ -208,7 +276,7 @@ public class LightningCompute : MonoBehaviour
ComputeShader.SetBuffer(_updateKernel, "_NodeBuffer", _nodeBuffer);
ComputeShader.SetBuffer(_updateKernel, "_BoltBuffer", _boltBuffer);
ComputeShader.SetFloat("_Time", time);
ComputeShader.SetFloat("_Time", _time);
ComputeShader.SetFloat("_NoiseAmplitude", NoiseAmplitude);
ComputeShader.SetFloat("_NoiseFrequency", NoiseFrequency);
ComputeShader.SetFloat("_NoiseGain", NoiseGain);
@ -219,8 +287,6 @@ public class LightningCompute : MonoBehaviour
ComputeShader.SetInt("_TrunkNodeCount", TrunkNodeCount);
ComputeShader.SetInt("_BranchNodeCount", BranchNodeCount);
ComputeShader.SetVector("_CameraPos", _cameraTransform.position);
ComputeShader.SetFloat("_StartWidth", StartWidth);
ComputeShader.SetFloat("_EndWidth", EndWidth);
ComputeShader.SetBuffer(_createWidthKernel, "_NodeBuffer", _nodeBuffer);
ComputeShader.SetBuffer(_createWidthKernel, "_BoltBuffer", _boltBuffer);
@ -228,10 +294,10 @@ public class LightningCompute : MonoBehaviour
ComputeShader.Dispatch(_createWidthKernel, NodeBufferSize/GROUP_SIZE, 1, 1);
RenderMaterial.SetBuffer("_IndexBuffer", _indexBuffer);
RenderMaterial.SetBuffer("_VertexBuffer", _vertexBuffer);
_materialInstance.SetBuffer("_IndexBuffer", _indexBuffer);
_materialInstance.SetBuffer("_VertexBuffer", _vertexBuffer);
Graphics.DrawProcedural(
RenderMaterial,
_materialInstance,
new Bounds((EndPosition + StartPosition) / 2, (EndPosition - StartPosition).magnitude * Vector3.one),
MeshTopology.Triangles,
IndexBufferSize,
@ -241,6 +307,9 @@ public class LightningCompute : MonoBehaviour
ShadowCastingMode.Off,
false,
0);
//
// if(pulseLerp > 2)
// StartAnimation();
}
#region cleanup

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
executionOrder: 55
icon: {instanceID: 0}
userData:
assetBundleName:

Binary file not shown.

BIN
UserSettings/EditorUserSettings.asset (Stored with Git LFS)

Binary file not shown.