Transparent walls

This commit is contained in:
kimrdd 2024-04-20 15:33:12 +02:00
parent 481d431d94
commit 15cb065999
4 changed files with 49 additions and 38 deletions

View File

@ -11,15 +11,19 @@ Material:
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: [] m_InvalidKeywords: []
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: -1 m_CustomRenderQueue: 3000
stringTagMap: stringTagMap:
RenderType: Opaque RenderType: Transparent
disabledShaderPasses: [] disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_LockedProperties: m_LockedProperties:
m_SavedProperties: m_SavedProperties:
serializedVersion: 3 serializedVersion: 3
@ -93,8 +97,8 @@ Material:
- _Cutoff: 0.5 - _Cutoff: 0.5
- _DetailAlbedoMapScale: 1 - _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1 - _DetailNormalMapScale: 1
- _DstBlend: 0 - _DstBlend: 10
- _DstBlendAlpha: 0 - _DstBlendAlpha: 10
- _EnvironmentReflections: 1 - _EnvironmentReflections: 1
- _GlossMapScale: 0 - _GlossMapScale: 0
- _Glossiness: 0 - _Glossiness: 0
@ -109,12 +113,12 @@ Material:
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SrcBlend: 1 - _SrcBlend: 1
- _SrcBlendAlpha: 1 - _SrcBlendAlpha: 1
- _Surface: 0 - _Surface: 1
- _WorkflowMode: 1 - _WorkflowMode: 1
- _ZWrite: 1 - _ZWrite: 0
m_Colors: m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _BaseColor: {r: 0.3803922, g: 0.38431376, b: 0.3921569, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 0.38039213, g: 0.38431373, b: 0.39215687, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

View File

@ -127,8 +127,8 @@ Material:
- _WorkflowMode: 1 - _WorkflowMode: 1
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 0} - _BaseColor: {r: 1, g: 1, b: 1, a: 0.53333336}
- _Color: {r: 1, g: 1, b: 1, a: 0} - _Color: {r: 1, g: 1, b: 1, a: 0.53333336}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

View File

@ -310,7 +310,7 @@ MeshRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - {fileID: 2100000, guid: 1fb12e769af8dfc4b9c47b291e1da192, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
@ -490,7 +490,7 @@ MeshRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - {fileID: 2100000, guid: 1fb12e769af8dfc4b9c47b291e1da192, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
@ -606,7 +606,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 350821431} m_GameObject: {fileID: 350821431}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.011139549, y: 0.9888443, z: -0.107838966, w: -0.10214565} m_LocalRotation: {x: -0.016176268, y: 0.9823031, z: -0.15659793, w: -0.10147004}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -688,7 +688,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_BindingMode: 5 m_BindingMode: 5
m_FollowOffset: {x: 0, y: 3.45, z: -10} m_FollowOffset: {x: 0, y: 3.45, z: -7.5}
m_XDamping: 1 m_XDamping: 1
m_YDamping: 1 m_YDamping: 1
m_ZDamping: 1 m_ZDamping: 1
@ -935,7 +935,7 @@ MonoBehaviour:
- m_Height: 5.37 - m_Height: 5.37
m_Radius: 5 m_Radius: 5
- m_Height: 3.45 - m_Height: 3.45
m_Radius: 10 m_Radius: 7.5
- m_Height: -1.86 - m_Height: -1.86
m_Radius: 5 m_Radius: 5
m_LegacyHeadingBias: 3.4028235e+38 m_LegacyHeadingBias: 3.4028235e+38
@ -952,7 +952,7 @@ Transform:
m_GameObject: {fileID: 626584084} m_GameObject: {fileID: 626584084}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.0441487, y: 3.45, z: 9.788845} m_LocalPosition: {x: 1.5331123, y: 3.45, z: 7.3416333}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1129,7 +1129,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 869513165} m_GameObject: {fileID: 869513165}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.014060542, y: 0.98535, z: -0.13611624, w: -0.10178472} m_LocalRotation: {x: -0.019075839, y: 0.97741497, z: -0.18466787, w: -0.100965105}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -1242,7 +1242,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_BindingMode: 5 m_BindingMode: 5
m_FollowOffset: {x: 0, y: 3.45, z: -10} m_FollowOffset: {x: 0, y: 3.45, z: -7.5}
m_XDamping: 1 m_XDamping: 1
m_YDamping: 1 m_YDamping: 1
m_ZDamping: 1 m_ZDamping: 1
@ -1685,8 +1685,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1356673984} m_GameObject: {fileID: 1356673984}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.014060538, y: 0.98534995, z: -0.13611627, w: -0.1017847} m_LocalRotation: {x: -0.019075843, y: 0.9774149, z: -0.1846679, w: -0.100965105}
m_LocalPosition: {x: 2.0441487, y: 3.45, z: 9.788845} m_LocalPosition: {x: 1.5331123, y: 3.45, z: 7.3416333}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -1856,7 +1856,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_BindingMode: 5 m_BindingMode: 5
m_FollowOffset: {x: 0, y: 3.45, z: -10} m_FollowOffset: {x: 0, y: 3.45, z: -7.5}
m_XDamping: 1 m_XDamping: 1
m_YDamping: 1 m_YDamping: 1
m_ZDamping: 1 m_ZDamping: 1
@ -2048,7 +2048,7 @@ MeshRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - {fileID: 2100000, guid: 1fb12e769af8dfc4b9c47b291e1da192, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
@ -2164,7 +2164,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1630127787} m_GameObject: {fileID: 1630127787}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.016989296, y: 0.9810159, z: -0.16446878, w: -0.101336986} m_LocalRotation: {x: -0.021978885, y: 0.97168434, z: -0.21277146, w: -0.100373134}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -2232,7 +2232,7 @@ MeshRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - {fileID: 2100000, guid: 1fb12e769af8dfc4b9c47b291e1da192, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
@ -2337,7 +2337,7 @@ MeshRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - {fileID: 2100000, guid: 1fb12e769af8dfc4b9c47b291e1da192, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0

View File

@ -1,5 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class HideWall : MonoBehaviour public class HideWall : MonoBehaviour
@ -24,16 +22,25 @@ public class HideWall : MonoBehaviour
{ {
if (hit.collider.CompareTag("Wall")) if (hit.collider.CompareTag("Wall"))
{ {
if (prevObject == hit.collider.gameObject) if (prevObject != null)
{ if (prevObject == hit.collider.gameObject)
hit.collider.GetComponent<Renderer>().material = hitMaterial; {
prevObject = hit.collider.gameObject; var renderer = hit.collider.GetComponent<Renderer>();
} var originalMat = renderer.material;
else var originalColor = originalMat.color;
{ originalMat.color = new Color(originalColor.r, originalColor.g, originalColor.b, originalColor.a *0f);
hit.collider.GetComponent<Renderer>().material = defaultMaterial; renderer.material = originalMat;
} }
else
{
var renderer = prevObject.GetComponent<Collider>().GetComponent<Renderer>();
var originalMat = renderer.material;
var originalColor = originalMat.color;
originalMat.color = new Color(originalColor.r, originalColor.g, originalColor.b, originalColor.a + 1f);
renderer.material = originalMat;
}
prevObject = hit.collider.gameObject;
} }
} }
} }