Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outline shader for non-standard materials, Add better explosion feedback #754

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/Materials/Gunparts/Coil/CoilWire.mat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Material:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
m_CustomRenderQueue: 2000
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand Down Expand Up @@ -126,7 +126,7 @@ Material:
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 0
- _QueueControl: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SHADOWS_SOFT: 1
Expand Down
13 changes: 5 additions & 8 deletions Assets/Materials/Gunparts/DDR/WireDdr.mat
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ Material:
m_Shader: {fileID: -6465566751694194690, guid: c5f92ba5fc8552c4dacafaa631cd2fb8, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- MAIN_LIGHT_CALCULATE_SHADOWS
- _MAIN_LIGHT_SHADOWS_CASCADE
- _SHADOWS_SOFT
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
m_CustomRenderQueue: 2001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand Down Expand Up @@ -117,7 +114,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- MAIN_LIGHT_CALCULATE_SHADOWS: 1
- MAIN_LIGHT_CALCULATE_SHADOWS: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _BendStartOffset: 0
Expand All @@ -136,14 +133,14 @@ Material:
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _MAIN_LIGHT_SHADOWS_CASCADE: 1
- _MAIN_LIGHT_SHADOWS_CASCADE: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SHADOWS_SOFT: 1
- _SHADOWS_SOFT: 0
- _Shadow_Texture: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/Materials/Gunparts/JIggleAntenna.mat
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Material:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
m_CustomRenderQueue: 2001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand Down
2 changes: 1 addition & 1 deletion Assets/Materials/Gunparts/SniperJiggleMaterial.mat
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Material:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
m_CustomRenderQueue: 2001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand Down
13 changes: 5 additions & 8 deletions Assets/Materials/Gunparts/Solar/Wire1.mat
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ Material:
m_Shader: {fileID: -6465566751694194690, guid: c5f92ba5fc8552c4dacafaa631cd2fb8, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- MAIN_LIGHT_CALCULATE_SHADOWS
- _MAIN_LIGHT_SHADOWS_CASCADE
- _SHADOWS_SOFT
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
m_CustomRenderQueue: 2001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand Down Expand Up @@ -117,7 +114,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- MAIN_LIGHT_CALCULATE_SHADOWS: 1
- MAIN_LIGHT_CALCULATE_SHADOWS: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _BendStartOffset: 0
Expand All @@ -136,15 +133,15 @@ Material:
- _GlossMapScale: 1
- _Glossiness: 1
- _GlossyReflections: 1
- _MAIN_LIGHT_SHADOWS_CASCADE: 1
- _MAIN_LIGHT_SHADOWS_CASCADE: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueControl: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SHADOWS_SOFT: 1
- _SHADOWS_SOFT: 0
- _Shadow_Texture: 1
- _Smoothness: 1
- _SmoothnessTextureChannel: 0
Expand Down
13 changes: 5 additions & 8 deletions Assets/Materials/Gunparts/Solar/Wire2.mat
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ Material:
m_Shader: {fileID: -6465566751694194690, guid: c5f92ba5fc8552c4dacafaa631cd2fb8, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- MAIN_LIGHT_CALCULATE_SHADOWS
- _MAIN_LIGHT_SHADOWS_CASCADE
- _SHADOWS_SOFT
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
m_CustomRenderQueue: 2001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand Down Expand Up @@ -104,7 +101,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- MAIN_LIGHT_CALCULATE_SHADOWS: 1
- MAIN_LIGHT_CALCULATE_SHADOWS: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _BendStartOffset: 0
Expand All @@ -123,15 +120,15 @@ Material:
- _GlossMapScale: 1
- _Glossiness: 0.70183486
- _GlossyReflections: 1
- _MAIN_LIGHT_SHADOWS_CASCADE: 1
- _MAIN_LIGHT_SHADOWS_CASCADE: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueControl: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SHADOWS_SOFT: 1
- _SHADOWS_SOFT: 0
- _Shadow_Texture: 1
- _Smoothness: 0.70183486
- _SmoothnessTextureChannel: 0
Expand Down
13 changes: 5 additions & 8 deletions Assets/Materials/Gunparts/Tether/TetherWire1.mat
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ Material:
m_Shader: {fileID: -6465566751694194690, guid: c5f92ba5fc8552c4dacafaa631cd2fb8, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- MAIN_LIGHT_CALCULATE_SHADOWS
- _MAIN_LIGHT_SHADOWS_CASCADE
- _SHADOWS_SOFT
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3001
m_CustomRenderQueue: 2001
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
Expand Down Expand Up @@ -100,7 +97,7 @@ Material:
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- MAIN_LIGHT_CALCULATE_SHADOWS: 1
- MAIN_LIGHT_CALCULATE_SHADOWS: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _BendStartOffset: 0
Expand All @@ -119,14 +116,14 @@ Material:
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _MAIN_LIGHT_SHADOWS_CASCADE: 1
- _MAIN_LIGHT_SHADOWS_CASCADE: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SHADOWS_SOFT: 1
- _SHADOWS_SOFT: 0
- _Shadow_Texture: 1
- _Smoothness: 0.934
- _SmoothnessTextureChannel: 0
Expand Down
114 changes: 113 additions & 1 deletion Assets/Prefabs/Interactables/ExplodingBarrel.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,117 @@ VFXRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &1024717719296835402
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7406710177114371503}
- component: {fileID: 3414885665117331682}
- component: {fileID: 4672865956108471853}
m_Layer: 3
m_Name: ShockWave
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7406710177114371503
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1024717719296835402}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6664999429958091405}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!2083052967 &3414885665117331682
VisualEffect:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1024717719296835402}
m_Enabled: 0
m_Asset: {fileID: 8926484042661614526, guid: 6981c21faa5329a468335451ba63132b, type: 3}
m_InitialEventName: OnPlay
m_InitialEventNameOverriden: 1
m_StartSeed: 0
m_ResetSeedOnPlay: 1
m_AllowInstancing: 1
m_ResourceVersion: 1
m_PropertySheet:
m_Float:
m_Array: []
m_Vector2f:
m_Array: []
m_Vector3f:
m_Array: []
m_Vector4f:
m_Array: []
m_Uint:
m_Array: []
m_Int:
m_Array: []
m_Matrix4x4f:
m_Array: []
m_AnimationCurve:
m_Array: []
m_Gradient:
m_Array: []
m_NamedObject:
m_Array: []
m_Bool:
m_Array: []
--- !u!73398921 &4672865956108471853
VFXRenderer:
serializedVersion: 1
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1024717719296835402}
m_Enabled: 0
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
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
--- !u!1 &1036079300693734787
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -577,7 +688,8 @@ Transform:
m_LocalPosition: {x: 0, y: 0.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 7406710177114371503}
m_Father: {fileID: 7135334762222197563}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down
16 changes: 10 additions & 6 deletions Assets/Scripts/ExplosionController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.VFX;

Expand All @@ -20,7 +21,7 @@ public class ExplosionController : MonoBehaviour

[SerializeField] private AudioGroup soundEffect;

private VisualEffect visualEffect;
private List<VisualEffect> visualEffects = new();
private AudioSource audioSource;

// Makes sure a player doesn't take damage for each hitbox
Expand All @@ -29,13 +30,13 @@ public class ExplosionController : MonoBehaviour

private void Start()
{
if (!visualEffect) Init();
if (visualEffects.Count < 1) Init();
}

public void Init()
{
visualEffect = GetComponent<VisualEffect>();
visualEffect.enabled = false;
visualEffects = GetComponentsInChildren<VisualEffect>().ToList();
visualEffects.ForEach(vfx => vfx.enabled = false);
audioSource = GetComponent<AudioSource>();
}

Expand All @@ -47,8 +48,11 @@ public void OnDrawGizmos()

public List<(RaycastHit hit, float damage)> Explode(PlayerManager sourcePlayer)
{
visualEffect.enabled = true;
visualEffect.SendEvent(VisualEffectAsset.PlayEventID);
visualEffects.ForEach(vfx =>
{
vfx.enabled = true;
vfx.SendEvent(VisualEffectAsset.PlayEventID);
});
soundEffect.Play(audioSource);
var targets = Physics.SphereCastAll(transform.position, radius, Vector3.up, 0.01f, hitBoxLayers);
var hits = new List<(RaycastHit, float)>(targets.Length);
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/Utils/Rope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public float RopeLength
{
get
{
if (Target == null || CollisionPoints.Count < 1)
return accumulatedAnchorLength;
return accumulatedAnchorLength + Vector3.Distance(Target.position, CollisionPoints[CollisionPoints.Count - 1]);
}
}
Expand Down
Loading