From e54843751a4dc14654af87ca8d766fd9e0208b1f Mon Sep 17 00:00:00 2001 From: kimrdd Date: Sun, 21 Apr 2024 00:40:14 +0200 Subject: [PATCH] gameScene stuff not done --- Assets/Materials/SilhouetteMaterial.mat | 4 +- Assets/Scenes/GameScene.unity | 357 +++++++++++++++++++++++- Assets/Scripts/Camera/HideWall.cs | 14 +- Assets/Scripts/Camera/WallOpacity.cs | 2 - 4 files changed, 354 insertions(+), 23 deletions(-) diff --git a/Assets/Materials/SilhouetteMaterial.mat b/Assets/Materials/SilhouetteMaterial.mat index 2ef5043..cd060c9 100644 --- a/Assets/Materials/SilhouetteMaterial.mat +++ b/Assets/Materials/SilhouetteMaterial.mat @@ -17,7 +17,7 @@ Material: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: 3000 + m_CustomRenderQueue: 3010 stringTagMap: RenderType: Transparent disabledShaderPasses: @@ -106,7 +106,7 @@ Material: - _Metallic: 0 - _OcclusionStrength: 1 - _Parallax: 0.005 - - _QueueOffset: 0 + - _QueueOffset: 10 - _ReceiveShadows: 1 - _SampleGI: 0 - _Smoothness: 0.5 diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index 395c38f..e4c40dd 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -134,17 +134,17 @@ PrefabInstance: - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} propertyPath: m_LocalPosition.x - value: -7.313 + value: -6.25 objectReference: {fileID: 0} - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} propertyPath: m_LocalPosition.y - value: 0.208 + value: 0.125 objectReference: {fileID: 0} - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} propertyPath: m_LocalPosition.z - value: -7.307 + value: -6.25 objectReference: {fileID: 0} - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} @@ -181,20 +181,30 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.x + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.y + value: 0.1 + objectReference: {fileID: 0} - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} propertyPath: GridSize.x - value: 13 + value: 11 objectReference: {fileID: 0} - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} propertyPath: GridSize.y - value: 13 + value: 11 objectReference: {fileID: 0} - target: {fileID: 4738812082694162819, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} propertyPath: m_Name - value: GridSpawner + value: GridSpawnerGround objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -555,6 +565,110 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c2cdf8a35ccaacc4695675d2ada4aecf, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &359510068 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 968288136} + m_Modifications: + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.x + value: 7.075 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.y + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.z + value: -7.3 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.w + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.y + value: -0.5 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.z + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.x + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.y + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: gridType + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: GridSize.x + value: 13 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: GridSize.y + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 4738812082694162819, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_Name + value: GridSpawnerWall+x + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} +--- !u!4 &359510069 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + m_PrefabInstance: {fileID: 359510068} + m_PrefabAsset: {fileID: 0} --- !u!1 &779612215 GameObject: m_ObjectHideFlags: 0 @@ -807,12 +921,12 @@ PrefabInstance: - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} propertyPath: m_LocalRotation.w - value: -0.1002336 + value: -0.10023358 objectReference: {fileID: 0} - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} propertyPath: m_LocalRotation.x - value: -0.022605719 + value: -0.022605715 objectReference: {fileID: 0} - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} @@ -822,7 +936,7 @@ PrefabInstance: - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} propertyPath: m_LocalRotation.z - value: -0.21884014 + value: -0.21884015 objectReference: {fileID: 0} - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} @@ -859,10 +973,25 @@ PrefabInstance: propertyPath: m_LocalRotation.z value: -0.2465418 objectReference: {fileID: 0} + - target: {fileID: 3313768392743891090, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: sphereRange + value: 1.5 + objectReference: {fileID: 0} - target: {fileID: 3313768392743891090, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} propertyPath: sphereRadius - value: 3 + value: 3.5 + objectReference: {fileID: 0} + - target: {fileID: 3313768392743891090, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: sphereOffset.y + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 3313768392743891090, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: maxSphereRayDistance + value: 7 objectReference: {fileID: 0} - target: {fileID: 3665490202611795451, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} @@ -912,7 +1041,7 @@ PrefabInstance: - target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} propertyPath: m_LocalRotation.w - value: -0.09876942 + value: -0.098769404 objectReference: {fileID: 0} - target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} @@ -1035,6 +1164,9 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1812668201} + - {fileID: 1554436712} + - {fileID: 2098922851} + - {fileID: 359510069} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1515922344 @@ -1074,6 +1206,105 @@ Transform: - {fileID: 779612216} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1554436711 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 968288136} + m_Modifications: + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.x + value: 5.75 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.y + value: 9.875 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.z + value: 5.75 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.w + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.x + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.z + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -90 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 180 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.x + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.y + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: gridType + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: GridSize.x + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: GridSize.y + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 4738812082694162819, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_Name + value: GridSpawnerRoof + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} +--- !u!4 &1554436712 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + m_PrefabInstance: {fileID: 1554436711} + m_PrefabAsset: {fileID: 0} --- !u!1 &1785574039 GameObject: m_ObjectHideFlags: 0 @@ -1316,6 +1547,110 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c2cdf8a35ccaacc4695675d2ada4aecf, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &2098922850 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 968288136} + m_Modifications: + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.x + value: -7.475 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.y + value: 9.7 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalPosition.z + value: -7.3 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalRotation.z + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: -90 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.x + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: Gap.y + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: gridType + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: GridSize.x + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 3798840069121289071, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: GridSize.y + value: 13 + objectReference: {fileID: 0} + - target: {fileID: 4738812082694162819, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + propertyPath: m_Name + value: GridSpawnerWall-x + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 0c13e24f92c86f84a85c76e0bca22830, type: 3} +--- !u!4 &2098922851 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 2739991145043243501, guid: 0c13e24f92c86f84a85c76e0bca22830, + type: 3} + m_PrefabInstance: {fileID: 2098922850} + m_PrefabAsset: {fileID: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Camera/HideWall.cs b/Assets/Scripts/Camera/HideWall.cs index e525479..b2a3e0c 100644 --- a/Assets/Scripts/Camera/HideWall.cs +++ b/Assets/Scripts/Camera/HideWall.cs @@ -10,19 +10,17 @@ public class HideWall : MonoBehaviour [Range(1f, 10f)] public float showFadeSpeed; public float sphereRadius; - public Vector3 maxSphereRayDistanceOffset; + [Range(0, 10)] public float sphereRange; + public Vector3 sphereOffset; float maxSphereRayDistance; private List prevHitObjects = new List(); - private void Start() - { - maxSphereRayDistance = Vector3.Distance(origin.transform.position, target.transform.position) - (sphereRadius * 2 + 1); - } - void Update() { - Vector3 direction = ((target.transform.position + maxSphereRayDistanceOffset) - origin.transform.position).normalized; + maxSphereRayDistance = Vector3.Distance(origin.transform.position, target.transform.position) - (sphereRadius * 2) + sphereRange; + + Vector3 direction = ((target.transform.position + sphereOffset) - origin.transform.position).normalized; RaycastHit[] hits = Physics.SphereCastAll(origin.transform.position, sphereRadius, direction, maxSphereRayDistance); List hitObjectsThisFrame = new List(); @@ -30,7 +28,7 @@ public class HideWall : MonoBehaviour for (int i = 0; i < hits.Length; i++) { - //print(hits[i].collider.gameObject.name); + //print(hits[i].collider.gameObject.name); if (hits[i].collider != null) { var hitGameObject = hits[i].collider.gameObject; diff --git a/Assets/Scripts/Camera/WallOpacity.cs b/Assets/Scripts/Camera/WallOpacity.cs index cee8778..136d5ef 100644 --- a/Assets/Scripts/Camera/WallOpacity.cs +++ b/Assets/Scripts/Camera/WallOpacity.cs @@ -41,13 +41,11 @@ public class WallOpacity : MonoBehaviour { isShowing = true; showFadeSpeed = speed; - print("showing wall"); } public void HideWall(float speed) { isShowing = false; hideFadeSpeed = speed; - print("hdiding wall"); } }