diff --git a/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab b/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab index 11836679adc83bbdf6260537b078254ab0909bd7..01c15cac1035b8368fddeedd0ac0cb5b2a670e30 100644 --- a/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab +++ b/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab @@ -111,7 +111,7 @@ GameObject: - component: {fileID: 7455726115425455088} - component: {fileID: 933372636075482527} - component: {fileID: 539717056228735193} - m_Layer: 16 + m_Layer: 20 m_Name: TopSnapZone m_TagString: SnapZone m_Icon: {fileID: 0} diff --git a/Assets/Plugins/NaturePackLite/Prefabs/Tree_02.prefab b/Assets/Plugins/NaturePackLite/Prefabs/Tree_02.prefab index 1f814d64bab763afe72be9720ffbbcc0c497dc6b..82b77605a5dd99761703c4faff42ab306ae3192b 100644 --- a/Assets/Plugins/NaturePackLite/Prefabs/Tree_02.prefab +++ b/Assets/Plugins/NaturePackLite/Prefabs/Tree_02.prefab @@ -112,7 +112,7 @@ GameObject: - component: {fileID: 4646352123586789184} - component: {fileID: 6011793418505273338} - component: {fileID: 5015158088123139087} - m_Layer: 19 + m_Layer: 20 m_Name: TopSnapZone m_TagString: SnapZone m_Icon: {fileID: 0} diff --git a/Assets/Resources/Prefabs/Facts/Circle.prefab b/Assets/Resources/Prefabs/Facts/Circle.prefab index f58a40eb2203b7ca369e92069d394369705280fd..fbdbd506c7edaad4ca294b35084bd6728832bd6b 100644 --- a/Assets/Resources/Prefabs/Facts/Circle.prefab +++ b/Assets/Resources/Prefabs/Facts/Circle.prefab @@ -112,13 +112,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3} m_Name: m_EditorClassIdentifier: + _URI: FactText: [] StringLabelFormats: [] - renderer: [] - Default: {fileID: 0} - Selected: {fileID: 0} - Hint: {fileID: 0} - Solution: {fileID: 0} + renderer: + - {fileID: 5284903402926663935} + - {fileID: 1078883255209641429} + Default: {fileID: 2100000, guid: 8ae9adf4dc782964387385c1e8c0eb72, type: 2} + Selected: {fileID: 2100000, guid: 34a95baef388bb8458c97a626b732f9f, type: 2} + Hint: {fileID: 2100000, guid: 8621b710d7d1d5041bc6bfd0cc37cdff, type: 2} + Solution: {fileID: 2100000, guid: 2a003f0807acc1142965bb21bdc824f6, type: 2} --- !u!1 &4682201382595328041 GameObject: m_ObjectHideFlags: 0 @@ -397,13 +400,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3} m_Name: m_EditorClassIdentifier: + _URI: FactText: [] StringLabelFormats: [] - renderer: [] - Default: {fileID: 0} - Selected: {fileID: 0} - Hint: {fileID: 0} - Solution: {fileID: 0} + renderer: + - {fileID: 1078883255209641429} + - {fileID: 5284903402926663935} + Default: {fileID: 2100000, guid: 8ae9adf4dc782964387385c1e8c0eb72, type: 2} + Selected: {fileID: 2100000, guid: 34a95baef388bb8458c97a626b732f9f, type: 2} + Hint: {fileID: 2100000, guid: 8621b710d7d1d5041bc6bfd0cc37cdff, type: 2} + Solution: {fileID: 2100000, guid: 2a003f0807acc1142965bb21bdc824f6, type: 2} --- !u!1 &6839596689016440457 GameObject: m_ObjectHideFlags: 0 @@ -470,6 +476,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3} m_Name: m_EditorClassIdentifier: + _URI: FactText: [] StringLabelFormats: [] renderer: diff --git a/Assets/Resources/Prefabs/Facts/Ring.prefab b/Assets/Resources/Prefabs/Facts/Ring.prefab index 12e9010936ceda8be3e716bd49fdcd713a07d473..209d704cd516f16605910a927f961503f8418180 100644 --- a/Assets/Resources/Prefabs/Facts/Ring.prefab +++ b/Assets/Resources/Prefabs/Facts/Ring.prefab @@ -288,6 +288,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3} m_Name: m_EditorClassIdentifier: + _URI: FactText: [] StringLabelFormats: [] renderer: @@ -495,6 +496,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3} m_Name: m_EditorClassIdentifier: + _URI: FactText: - {fileID: 1254072669719294581} StringLabelFormats: diff --git a/Assets/Scenes/Worlds/RiverWorld.unity b/Assets/Scenes/Worlds/RiverWorld.unity index bac8bc63abaf865621648dcd4de69e1b8aea643b..6b084df8500bb46763a25d507b1b1d39d82734f4 100644 --- a/Assets/Scenes/Worlds/RiverWorld.unity +++ b/Assets/Scenes/Worlds/RiverWorld.unity @@ -2624,7 +2624,7 @@ GameObject: - component: {fileID: 139953605} - component: {fileID: 139953604} - component: {fileID: 139953603} - m_Layer: 0 + m_Layer: 2 m_Name: Cube (2) m_TagString: Untagged m_Icon: {fileID: 0} @@ -3870,7 +3870,7 @@ Mesh: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: pb_Mesh26262 + m_Name: pb_Mesh1141600 serializedVersion: 10 m_SubMeshes: - serializedVersion: 2 @@ -4283,7 +4283,7 @@ PrefabInstance: - target: {fileID: 5974816098015535063, guid: e289bf5debb17f6459818c207d781953, type: 3} propertyPath: m_Layer - value: 16 + value: 20 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: e289bf5debb17f6459818c207d781953, type: 3} @@ -32763,7 +32763,7 @@ GameObject: - component: {fileID: 1560940263} - component: {fileID: 1560940262} - component: {fileID: 1560940261} - m_Layer: 0 + m_Layer: 2 m_Name: Cube (3) m_TagString: Untagged m_Icon: {fileID: 0} @@ -33425,7 +33425,7 @@ GameObject: - component: {fileID: 1593527563} - component: {fileID: 1593527562} - component: {fileID: 1593527561} - m_Layer: 0 + m_Layer: 2 m_Name: Cube (1) m_TagString: Untagged m_Icon: {fileID: 0} @@ -36234,7 +36234,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1738359117} - m_Layer: 0 + m_Layer: 2 m_Name: Boarders m_TagString: Untagged m_Icon: {fileID: 0} @@ -36811,7 +36811,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1777335750} - m_Layer: 0 + m_Layer: 2 m_Name: Walls m_TagString: Untagged m_Icon: {fileID: 0} @@ -54270,7 +54270,7 @@ GameObject: - component: {fileID: 1911980458} - component: {fileID: 1911980457} - component: {fileID: 1911980456} - m_Layer: 0 + m_Layer: 2 m_Name: Cube (4) m_TagString: Untagged m_Icon: {fileID: 0} @@ -55581,18 +55581,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 04a4ac0a27312d04787dc2494b7aa690, type: 3} m_Name: m_EditorClassIdentifier: - URI: - materials: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - renderer: [] - cascade: [] - Default: {fileID: 0} - Selected: {fileID: 0} - Hint: {fileID: 0} - Solution: {fileID: 0} + _URI: repeat: 1 original: 1 --- !u!1001 &1970241703 diff --git a/Assets/ScriptableObjects/Gadgets/AngleToolDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/AngleToolDataContainerGadgetInit.asset index 8e7625f9b4070d75ee0d5733acbe9351d6e90e6f..a4d0f9990257b37113a5569f7bdd0a6929bb8da6 100644 --- a/Assets/ScriptableObjects/Gadgets/AngleToolDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/AngleToolDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Angle Tool MaterialIndx: 1 ButtonIndx: 3 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 391718 + m_Bits: 1024 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs b/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs index 4b02adb26e2ee477d2e1f51be3ec3ad0b71952b9..637075bc26cd0530bac31810b465bef0027120ba 100644 --- a/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs +++ b/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs @@ -13,6 +13,6 @@ public class DataContainerGadgetInit : ScriptableObject public int MaterialIndx = 0; public int ButtonIndx = 0; - public LayerMask IgnoreLayerMask; + public LayerMask LayerHitMask; public LayerMask SecondaryLayerMask; } \ No newline at end of file diff --git a/Assets/ScriptableObjects/Gadgets/DefaultDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/DefaultDataContainerGadgetInit.asset index e0dccd808e5c2e27097db8e641ec600cab254fb1..a726ab284c75fa25247499c462a5ea5b6548c7f4 100644 --- a/Assets/ScriptableObjects/Gadgets/DefaultDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/DefaultDataContainerGadgetInit.asset @@ -16,7 +16,11 @@ MonoBehaviour: MaxRange: Infinity MaxHeight: Infinity UiName: Not Defined - ButtonSprite: {fileID: 21300000, guid: f4c84b8f318e3cb469eb72c734ccbf39, type: 3} - IgnoreLayerMask: + MaterialIndx: 0 + ButtonIndx: 0 + LayerHitMask: + serializedVersion: 2 + m_Bits: 1637393 + SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/EqualCirclesDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/EqualCirclesDataContainerGadgetInit.asset index 846d7797a10b12f51799199daef826777bf32c59..7464b802d14511ba788908ef6b2ab9ec79f112f2 100644 --- a/Assets/ScriptableObjects/Gadgets/EqualCirclesDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/EqualCirclesDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Not Defined MaterialIndx: 0 ButtonIndx: 9 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 802342 + m_Bits: 49152 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/GadgetDataContainerGadgetCollection.asset b/Assets/ScriptableObjects/Gadgets/GadgetDataContainerGadgetCollection.asset index 92c159de8ac9a209ad8a4c85cd7aee231cb99897..f1d6edce81a5fe9963a3009d90e127377fb51b52 100644 --- a/Assets/ScriptableObjects/Gadgets/GadgetDataContainerGadgetCollection.asset +++ b/Assets/ScriptableObjects/Gadgets/GadgetDataContainerGadgetCollection.asset @@ -27,18 +27,6 @@ MonoBehaviour: - {fileID: 21300000, guid: d456617ba2282854d9570dcebcc2b279, type: 3} - {fileID: 21300000, guid: e35797aede3d7bd449ca9195a409b0cc, type: 3} - {fileID: 21300000, guid: 9831128faf2531e4cba52f58894091be, type: 3} - GadgetNames: - - undefined - - Point Tool - - Tape Tool - - Angle Tool - - Line Tool - - Lot Tool - - Pendulum - - Pole Tool - - Remover - - Equal Circles - - Middle Point GadgetType: ffffffff00000000010000000200000003000000040000000500000006000000070000000800000009000000 GadgetData: - {fileID: 11400000, guid: 7431ff31b707d2a4082b65b61e15e5df, type: 2} diff --git a/Assets/ScriptableObjects/Gadgets/LineDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/LineDataContainerGadgetInit.asset index c7988ab9ec0d528124c57466e1624db4e4e6ecf9..ea4489b1dbbeedd1220871531ad3f0a8e48757f7 100644 --- a/Assets/ScriptableObjects/Gadgets/LineDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/LineDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Line Tool MaterialIndx: 0 ButtonIndx: 4 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 391714 + m_Bits: 1024 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset index 7bd31f3833602fe65bea7383087d3f8dcc49878d..549af07f59fe13f256d10619f078fc2c39748d15 100644 --- a/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/LotToolDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Lot Tool MaterialIndx: 0 ButtonIndx: 5 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 365090 + m_Bits: 535553 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/MiddlePointDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/MiddlePointDataContainerGadgetInit.asset index 5f5febfe0eae2b8ff5a9da816630cf6d94459041..78bfc5313264f03800df9838615d1d400ad5f490 100644 --- a/Assets/ScriptableObjects/Gadgets/MiddlePointDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/MiddlePointDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Middle Point Tool MaterialIndx: 0 ButtonIndx: 10 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 326178 + m_Bits: 1024 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/PendulumDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/PendulumDataContainerGadgetInit.asset index d01896a96c03595fe33b5c076868a456b78a426f..8d22fd751d7de82f98f3611b83da49adfd11f6d8 100644 --- a/Assets/ScriptableObjects/Gadgets/PendulumDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/PendulumDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Pendulum MaterialIndx: 0 ButtonIndx: 6 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 391714 + m_Bits: 1024 SecondaryLayerMask: serializedVersion: 2 m_Bits: 1 diff --git a/Assets/ScriptableObjects/Gadgets/PointerDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/PointerDataContainerGadgetInit.asset index 62e031ed4499ce2627422b7e87ac05b857fec5ff..a8e6e5eb35ef62d649f0a3e7e5bc33ed3f378b46 100644 --- a/Assets/ScriptableObjects/Gadgets/PointerDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/PointerDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Pointer MaterialIndx: 0 ButtonIndx: 1 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 269858 + m_Bits: 1572913 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/PoleDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/PoleDataContainerGadgetInit.asset index dbd7fdc0e535d15350b84d1fa0f00be546cab838..5d778e7e1f2eddbee052cd7bd8f50024c7a2336a 100644 --- a/Assets/ScriptableObjects/Gadgets/PoleDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/PoleDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Pole MaterialIndx: 0 ButtonIndx: 7 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 391714 + m_Bits: 525313 SecondaryLayerMask: serializedVersion: 2 - m_Bits: 32769 + m_Bits: 524289 diff --git a/Assets/ScriptableObjects/Gadgets/RemoverDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/RemoverDataContainerGadgetInit.asset index 67d8f1cdeae4f9a01c0f619ea91011912df7ec47..260d2c5f5d2603e8cc329106ca6b80c72ecbafc3 100644 --- a/Assets/ScriptableObjects/Gadgets/RemoverDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/RemoverDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Delete Fact MaterialIndx: 0 ButtonIndx: 8 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 328243 + m_Bits: 64512 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/ScriptableObjects/Gadgets/TapeDataContainerGadgetInit.asset b/Assets/ScriptableObjects/Gadgets/TapeDataContainerGadgetInit.asset index 92855818116d0ed98b9a227183c8b027f40cb5e1..14664536dbc913960addc83f9b8d4e60ba7dbcf7 100644 --- a/Assets/ScriptableObjects/Gadgets/TapeDataContainerGadgetInit.asset +++ b/Assets/ScriptableObjects/Gadgets/TapeDataContainerGadgetInit.asset @@ -18,9 +18,9 @@ MonoBehaviour: UiName: Tape MaterialIndx: 0 ButtonIndx: 2 - IgnoreLayerMask: + LayerHitMask: serializedVersion: 2 - m_Bits: 391714 + m_Bits: 1024 SecondaryLayerMask: serializedVersion: 2 m_Bits: 0 diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs.meta b/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs.meta index 231482e768a2afb200f1cc7bca1ec3772f85b7a9..126c9319c4aab775cd7c58c0970729208d4f8836 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs.meta +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactObject.cs.meta @@ -3,7 +3,11 @@ guid: 626c435b76e0d334f959ede8b54b07ac MonoImporter: externalObjects: {} serializedVersion: 2 - defaultReferences: [] + defaultReferences: + - Default: {fileID: 2100000, guid: 8ae9adf4dc782964387385c1e8c0eb72, type: 2} + - Selected: {fileID: 2100000, guid: 34a95baef388bb8458c97a626b732f9f, type: 2} + - Hint: {fileID: 2100000, guid: 8621b710d7d1d5041bc6bfd0cc37cdff, type: 2} + - Solution: {fileID: 2100000, guid: 2a003f0807acc1142965bb21bdc824f6, type: 2} executionOrder: 0 icon: {instanceID: 0} userData: diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs index 8e4ed366f64541e3167c8b214989b1e178ea164c..21fcea377d6ce50b586a4b86a3624f0804515891 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs @@ -2,10 +2,7 @@ using System.Collections; using TMPro; using UnityEngine; -using UnityEngine.UIElements; -using UnityStandardAssets.Vehicles.Car; using static CommunicationEvents; -using static GlobalBehaviour; public class FactSpawner : MonoBehaviour { @@ -59,7 +56,6 @@ public void SpawnPoint(PointFact fact) GameObject point = GameObject.Instantiate(Sphere); point.GetComponent<FactObject>().URI = fact.Id; point.transform.SetPositionAndRotation(fact.Position, fact.Rotation); - //point.GetComponentInChildren<TextMeshPro>().text = fact.Label; fact.Representation = point; } @@ -95,37 +91,29 @@ public void SpawnRay(RayFact fact) line.transform.GetChild(0).localScale = fact.LocalScale; line.transform.GetChild(0).rotation = fact.Rotation; - //line.GetComponentInChildren<TextMeshPro>().text = fact.Label; - fact.Representation = line; } //Spawn an angle: point with id = angleFact.Pid2 is the point where the angle gets applied public void SpawnAngle(AbstractAngleFact fact) { - Vector3 Psotion = fact.Position; - Quaternion Rotation = fact.Rotation; - float angleValue = fact.angle; - //Change FactRepresentation to Angle GameObject angle = GameObject.Instantiate(Angle); angle.GetComponentInChildren<FactObject>().URI = fact.Id; - - //Place the Angle at position of point2 - angle.transform.SetPositionAndRotation(Psotion, Rotation); + angle.transform.SetPositionAndRotation(fact.Position, fact.Rotation); //Set text of angle TextMeshPro[] texts = angle.GetComponentsInChildren<TextMeshPro>(); foreach (TextMeshPro t in texts) { //Change Text not to the id, but to the angle-value (from both sides) - t.text = Math.Round(angleValue, 2) + "°"; + t.text = Math.Round((float)fact.angle, 2) + "°"; } //Generate angle mesh CircleSegmentGenerator[] segments = angle.GetComponentsInChildren<CircleSegmentGenerator>(); foreach (CircleSegmentGenerator c in segments) - c.setAngle(angleValue); + c.setAngle((float)fact.angle); fact.Representation = angle; } @@ -136,7 +124,6 @@ public void SpawnRingAndCircle(CircleFact fact) SpawnRing(fact, ringAndCircleGO.transform); SpawnCircle(fact, ringAndCircleGO.transform); - //Move Ring to middlePoint ringAndCircleGO.transform.SetPositionAndRotation(fact.Position, fact.Rotation); fact.Representation = ringAndCircleGO; @@ -149,10 +136,7 @@ public void SpawnRing(CircleFact circleFact, Transform parent = null) var tori = ring.GetComponentsInChildren<TorusGenerator>(); foreach (var torus in tori) - torus.torusRadius = circleFact.radius; - - //var tmpText = ring.GetComponentInChildren<TextMeshPro>(); - //tmpText.text = $"○{circleFact.Point1.Label}"; + torus.torusRadius = circleFact.radius + (float)Math3d.vectorPrecission; } public void SpawnCircle(CircleFact circleFact, Transform parent = null) diff --git a/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs index f630fbccb3c0e7993e0a3e4fc45180decea8ee19..79787d286fc19423549404e66772645a7408b258 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/AngleTool.cs @@ -14,16 +14,13 @@ public class AngleTool : Gadget private const int curveDrawingVertexCount = 36; private float curveRadius; + public override void _Hit(RaycastHit[] hit) { - if (hit[0].transform.gameObject.layer != LayerMask.NameToLayer("Point")) - return; - string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) Workflow.Add(tempFactId); - switch (Workflow.Count) { case 1: diff --git a/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs b/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs index 1e28f2231af3736f2f5c8a912cd5c83b3e53b1c7..6dbe00786752b556bc58e0de53f3a2678ee6cbcc 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs @@ -1,7 +1,4 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using static CommunicationEvents; /// <summary> /// a Gadget that checks whether two given circles have equal size and if yes it returns an EqualCirclesFact @@ -13,13 +10,8 @@ public class EqualCircleGadget : Gadget protected static new string s_type = "EqualCircles"; - public override void _Hit(RaycastHit[] hit) { - if (hit[0].transform.gameObject.layer != LayerMask.NameToLayer("Circle")) - //No Circles were hit - ResetGadget(); - string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) // filters double hits / exact ones Workflow.Add(tempFactId); @@ -31,9 +23,6 @@ public override void _Hit(RaycastHit[] hit) case 2: //If the first circle got already selected - //Debug.Log("hit it"); - //Debug.Log("data: radius dif" + Mathf.Abs(this.FirstCircle.radius - tempFact.radius) +" ids: 1. "+ this.FirstCircle.Id+", 2."+ tempFact.Id); - CircleFact tempFact = (CircleFact)FactOrganizer.AllFacts[Workflow[0]]; CircleFact FirstCircle = (CircleFact)FactOrganizer.AllFacts[tempFactId]; diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs b/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs index d402ccf3858b12bc2728f346a9b3d4f955148ba4..25cfffdfd77360e9d4b1a69ccf4985a9b3954af0 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Gadget.cs @@ -73,14 +73,13 @@ public enum GadgetIDs /// <remarks>Set in Inspector or <see cref="Awake"/></remarks> public float MaxRange = float.NegativeInfinity; public float MaxHeight = float.NegativeInfinity; - private float NewMaxRange = float.NegativeInfinity; /// <summary>Which sprite to use</summary> public int ButtonIndx = -1; public int MaterialIndx = -1; /// <summary>Layers to ignore for this gadget by default.</summary> /// <remarks>Set in Inspector</remarks> - public LayerMask IgnoreLayerMask = -1; + public LayerMask LayerHitMask = -1; public LayerMask SecondaryLayerMask = -1; private bool init_success = false; @@ -108,12 +107,12 @@ public static bool Equals(Gadget a, Gadget b) && a.MaxHeight == b.MaxHeight && a.ButtonIndx == b.ButtonIndx && a.MaterialIndx == b.MaterialIndx - && a.IgnoreLayerMask == b.IgnoreLayerMask + && a.LayerHitMask == b.LayerHitMask && a.SecondaryLayerMask == b.SecondaryLayerMask); public void Init(bool overrite) { - if ( init_success + if (init_success || GadgetBehaviour.DataContainerGadgetDict == null) return; @@ -124,10 +123,10 @@ public void Init(bool overrite) return; } var GadgetID = GadgetTypeToIDs[this_type]; - + if (!GadgetBehaviour.DataContainerGadgetDict.ContainsKey(GadgetID)) { - if(null != GameObject.FindObjectsOfType<GadgetBehaviour>()) + if (null != GameObject.FindObjectsOfType<GadgetBehaviour>()) Debug.LogError("No " + GadgetID.ToString() + " in assigned " + typeof(DataContainerGadgetCollection).Name + "!"); return; } @@ -141,18 +140,18 @@ public void Init(bool overrite) MaxRange = data_cache.MaxRange; if (overrite || MaxHeight == float.NegativeInfinity) MaxHeight = data_cache.MaxHeight; - if (overrite || IgnoreLayerMask == -1) - IgnoreLayerMask = data_cache.IgnoreLayerMask; + if (overrite || LayerHitMask == -1) + LayerHitMask = data_cache.LayerHitMask; if (overrite || SecondaryLayerMask == -1) SecondaryLayerMask = data_cache.SecondaryLayerMask; if (overrite || ButtonIndx < 0) - ButtonIndx = + ButtonIndx = data_cache.ButtonIndx < GadgetBehaviour.ButtonSprites.Length && data_cache.ButtonIndx >= 0 ? data_cache.ButtonIndx : 0; if (overrite || MaterialIndx < 0) - MaterialIndx = - data_cache.MaterialIndx < GadgetBehaviour.Materials.Length + MaterialIndx = + data_cache.MaterialIndx < GadgetBehaviour.Materials.Length && data_cache.MaterialIndx >= 0 ? data_cache.MaterialIndx : 0; @@ -167,7 +166,7 @@ public void Awake() public void Enable() { - GadgetBehaviour.Cursor.setLayerMask(~IgnoreLayerMask.value); + GadgetBehaviour.Cursor.setLayerMask(LayerHitMask.value); _Update_Range(); ResetGadget(); _Enable(); @@ -188,11 +187,11 @@ public void Update() UpdateLineDrawing(); _Update(); - -} + + } public void Hit(RaycastHit[] hit) - { + { if (!CommunicationEvents.GadgetCanBeUsed //TODO: We should probably check all hits and sort out the "bad" ones || hit[0].transform.position.y > MaxHeight) @@ -253,7 +252,17 @@ public void ResetGadget() protected virtual void _ResetGadget() { } - protected virtual void _Update_Range() { NewMaxRange = MaxRange; GadgetBehaviour.Cursor.MaxRange = NewMaxRange; } + protected virtual void _Update_Range() + { + GadgetBehaviour.Cursor.MaxRange = UIconfig.interactingRangeMode switch + { + UIconfig.InteractingRangeMode.fromObserverView => + UIconfig.cursorMaxRange_fromObeserverView, + UIconfig.InteractingRangeMode.fromCharacterView or _ => + MaxRange, + }; + } + public class UndefinedGadget : Gadget { } } diff --git a/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs b/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs index cf5b11dae9c9a6bb581b2771e6c6b839eb843def..327c53cf469af26e5a011c329cdabb61a491b502 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using TMPro; using UnityEngine; using UnityEngine.Events; diff --git a/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs index 9a4c748f6a8e0b8cfc572dd9579dc6c543b3a07e..01419014934dbead6ab882e94b4ca68cc6d7c4ff 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/LineTool.cs @@ -1,8 +1,5 @@ using Newtonsoft.Json; -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using static CommunicationEvents; public class LineTool : Gadget { @@ -12,13 +9,10 @@ public class LineTool : Gadget //Cache for drawing Line private readonly Vector3[] LineOrigin = new Vector3[1]; - + public override void _Hit(RaycastHit[] hit) { - if (hit[0].transform.gameObject.layer != LayerMask.NameToLayer("Point")) - return; - string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) Workflow.Add(tempFactId); @@ -37,7 +31,6 @@ public override void _Hit(RaycastHit[] hit) } } - protected override void _ActivateLineDrawing() { GadgetBehaviour.LineRenderer.enabled = true; diff --git a/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs index 8622940d9a4101b8c340810e8f0b654e5f7118d4..7c3d2ed130b3a5c08215b26228c5dd144464ce2e 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs @@ -18,7 +18,6 @@ public class LotTool : Gadget private Vector3 BaseLineHit; - public override void _Hit(RaycastHit[] hit) { void CreateRayAndAngles(string IntersectionId, string LotPointId, bool samestep) @@ -31,14 +30,12 @@ void CreateRayAndAngles(string IntersectionId, string LotPointId, bool samestep) , IntersectionId, LotPointId, samestep: true, gadget: this); } - - string tempFactId = null; - if (!((LayerMask) hit[0].transform.gameObject.layer).IsAnyByName(new string[] { "Default", "Tree" }) - && (!hit[0].transform.TryGetComponent(out FactObject obj) - || Workflow.Contains(tempFactId = obj.URI))) + string tempFactId; + if (!hit[0].transform.TryGetComponent(out FactObject obj) + || Workflow.Contains(tempFactId = obj.URI)) return; - Fact tempFact = tempFactId == null ? null : FactOrganizer.AllFacts[tempFactId]; + Fact tempFact = FactOrganizer.AllFacts[tempFactId]; switch (Workflow.Count) { case 0: // select basline @@ -96,7 +93,6 @@ protected override void _ActivateLineDrawing() GadgetBehaviour.LineRenderer.startWidth = 0.095f; GadgetBehaviour.LineRenderer.endWidth = 0.095f; - //SetPositions(new Vector3[] { GadgetBehaviour.Cursor.transform.position, LotPoints[0], LotPoints[0] }); //start at curser SetPosition(0, GadgetBehaviour.Cursor.transform.position); //Project curser perpendicular on Line for intersection-point diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs b/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs index 8980cc4e9a17dd52acf0c761b054287472fd523e..41409c46af255f010be8d17c381a2656dff6a143 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Pendulum.cs @@ -1,7 +1,4 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using static CommunicationEvents; +using UnityEngine; public class Pendulum : Gadget //Acts as a Pendulum starting at a Point @@ -15,13 +12,8 @@ public override void _Enable() ActivateLineDrawing(); } - - public override void _Hit(RaycastHit[] hit) { - if (hit[0].transform.gameObject.layer != LayerMask.NameToLayer("Point")) - return; - //Raycast downwoard if (Physics.Raycast(hit[0].transform.position, Vector3.down, out RaycastHit ground, Mathf.Infinity, this.SecondaryLayerMask.value)) { @@ -29,7 +21,6 @@ public override void _Hit(RaycastHit[] hit) Workflow.Add(tempFactId); FactManager.AddPointFact(ground, gadget: this); ResetGadget(); - } } diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs b/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs index 09785d868d8ee3f9793f6dea163cc2f0bcb0fe29..e0b033f815985a464336f7f340d729f0b848729b 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Pointer.cs @@ -1,7 +1,4 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using static CommunicationEvents; +using UnityEngine; public class Pointer : Gadget { @@ -13,9 +10,10 @@ public class Pointer : Gadget public override void _Hit(RaycastHit[] hit) { string pid = FactManager.AddPointFact(hit[0], gadget: this).Id; + for (int i = 0; i < hit.Length; i++) { - if (Mathf.Abs(hit[i].distance - hit[0].distance) > 0.03) + if (!Mathf.Approximately(hit[0].distance, hit[i].distance)) break; if (hit[i].transform.gameObject.layer == LayerMask.NameToLayer("Ray")) @@ -23,7 +21,7 @@ public override void _Hit(RaycastHit[] hit) Workflow.Add(hit[i].transform.GetComponent<FactObject>().URI); FactManager.AddOnLineFact (pid - , Workflow[0] + , Workflow[i] , samestep: true , gadget: this , is_certain: false); diff --git a/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs index 0b66a4f9ca2c8af2292a3afed8b44232876faae1..c3ff161c9d9c03dc068ab1eec699bae600e545ef 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/PoleTool.cs @@ -1,7 +1,4 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using static CommunicationEvents; +using UnityEngine; public class PoleTool : Gadget //Acts as a Pendulum starting at a Point @@ -12,18 +9,18 @@ public class PoleTool : Gadget public float poleHeight = 1f; + public override void _Enable() { ActivateLineDrawing(); } - public override void _Hit(RaycastHit[] hit) { if (!Physics.Raycast( GadgetBehaviour.Cursor.transform.position + Vector3.up * (float)Math3d.vectorPrecission , Vector3.down, MaxHeight + (float)Math3d.vectorPrecission - , LayerMask.GetMask(new string[]{"Default", "Tree"}))) + , this.SecondaryLayerMask)) return; UpdateLineDrawing(); @@ -31,8 +28,8 @@ public override void _Hit(RaycastHit[] hit) if (hit[0].transform.gameObject.layer == LayerMask.NameToLayer("Point")) { Workflow.Add(hit[0].transform.gameObject.GetComponent<FactObject>().URI); - - var pid2 = FactManager.AddPointFact(GetPosition(1), Vector3.up, gadget: this).Id; + + string pid2 = FactManager.AddPointFact(GetPosition(1), Vector3.up, gadget: this).Id; FactManager.AddLineFact(Workflow[0], pid2, true, gadget: this); } else @@ -55,13 +52,10 @@ protected override void _ActivateLineDrawing() //Updates the points of the Lines when baseLine was selected in LineMode protected override void _UpdateLineDrawing() { - - //TODO check whether this works else - // this.linePositions[0] = this.Cursor.transform.position; SetPosition(0, GadgetBehaviour.Cursor.transform.position); //Raycast upwoard - if (Physics.Raycast(GetPosition(0), Vector3.up, out RaycastHit ceiling, poleHeight, this.SecondaryLayerMask.value)) + if (Physics.Raycast(GetPosition(0), Vector3.up, out RaycastHit ceiling, poleHeight, this.SecondaryLayerMask)) SetPosition(1, ceiling.point); else SetPosition(1, GetPosition(0) + Vector3.up * poleHeight); diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs b/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs index d512a1e785089f0136b1b393531f2415c08ffc65..f249084ce9aa20ff835c933bd7549ee1a83000e0 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Tape.cs @@ -15,9 +15,6 @@ public class Tape : Gadget public override void _Hit(RaycastHit[] hit) { - if (hit[0].transform.gameObject.layer != LayerMask.NameToLayer("Point")) - return; - string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) Workflow.Add(tempFactId); @@ -54,17 +51,4 @@ protected override void _UpdateLineDrawing() { SetPosition(1, GadgetBehaviour.Cursor.transform.position); } - - protected override void _Update_Range() - { - float NewMaxRange = UIconfig.interactingRangeMode switch - { - UIconfig.InteractingRangeMode.fromObserverView => - UIconfig.cursorMaxRange_fromObeserverView, - UIconfig.InteractingRangeMode.fromCharacterView or _ => - MaxRange, - }; - GadgetBehaviour.Cursor.MaxRange = NewMaxRange; - //Debug.Log("MaxRange :" + NewMaxRange); - } } \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs b/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs index 00bc83ca137157d75102165d14519e61a3cbb5ea..3c250bc7387cf0016706b8a9a71fa4644cac607b 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/TestMiddlePoint.cs @@ -1,6 +1,4 @@ using Newtonsoft.Json; -using System.Collections; -using System.Collections.Generic; using UnityEngine; public class TestMiddlePoint : Gadget @@ -14,10 +12,7 @@ public class TestMiddlePoint : Gadget public override void _Hit(RaycastHit[] hit) { - if(hit[0].transform.gameObject.layer != LayerMask.NameToLayer("Point")) - return; - - string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; //clicked point point is added to Workflow + string tempFactId = hit[0].transform.GetComponent<FactObject>().URI; if (!Workflow.Contains(tempFactId)) Workflow.Add(tempFactId); @@ -28,9 +23,7 @@ public override void _Hit(RaycastHit[] hit) ActivateLineDrawing(); break; - case 2: - - //Insert point in the middle + case 2: //Insert point in the middle PointFact p1 = (PointFact)FactOrganizer.AllFacts[Workflow[0]]; PointFact p2 = (PointFact)FactOrganizer.AllFacts[Workflow[1]]; diff --git a/Assets/Scripts/InteractionEngine/ShinyThings.cs b/Assets/Scripts/InteractionEngine/ShinyThings.cs index 2cd58e330ac3396bcc2e6a3f58c01c812a666c8f..f9082be1d896f940339bdd7f8414350ab6c00880 100644 --- a/Assets/Scripts/InteractionEngine/ShinyThings.cs +++ b/Assets/Scripts/InteractionEngine/ShinyThings.cs @@ -47,7 +47,6 @@ public void Start() light_colour = directionalLight.color; } - // Update is called once per frame public void Update() { HighlightCurserHit(Cursor.Hit); diff --git a/Assets/Scripts/InteractionEngine/WorldCursor.cs b/Assets/Scripts/InteractionEngine/WorldCursor.cs index 53b7b88396119741bdb85045869313d7018a0d9e..a53f0a76d72fd9776e14b2fb1d562b271caee64a 100644 --- a/Assets/Scripts/InteractionEngine/WorldCursor.cs +++ b/Assets/Scripts/InteractionEngine/WorldCursor.cs @@ -7,6 +7,8 @@ using UnityEngine.EventSystems; using static GadgetBehaviour; using UnityEngine.InputSystem; +using MoreLinq; +using System.Linq; //TODO check whether this can be deleted //using System.Linq; //using static GadgetManager; @@ -15,16 +17,14 @@ public class WorldCursor : MonoBehaviour { public RaycastHit Hit; // TODO experimentell for multiple hits - public RaycastHit[] MultipleHits; + public RaycastHit[] Hits; public string deactivateSnapKey; private Camera Cam; private int layerMask; public float MaxRange = 10f; - private float MaxRange_ = 10f; public bool useCamCurser = false; - private int whichCheckMouseButton = 1; private void Awake() { @@ -35,9 +35,6 @@ private void Awake() void Start() { Cam = Camera.main; - //Set MarkPointMode as the default ActiveToolMode - // ActiveToolMode = ToolMode.ExtraMode;//ToolMode.MarkPointMode; - // CommunicationEvents.ToolModeChangedEvent.Invoke(activeGadget.id); CultureInfo.CurrentCulture = new CultureInfo("en-US"); } @@ -46,8 +43,6 @@ public void setLayerMask(int layerMask) this.layerMask = layerMask; } - - // working currently to include multiple hits // TODO @@ -62,8 +57,9 @@ void Update() _ => Vector3.zero }; - //Ray ray = useCamCurser ? new Ray(Cam.transform.position, Cam.transform.forward) : Cam.ScreenPointToRay(Input.mousePosition); - Ray ray = useCamCurser ? new Ray(Cam.transform.position, Cam.transform.forward) : Cam.ScreenPointToRay(mousePos); + Ray ray = useCamCurser + ? new Ray(Cam.transform.position, Cam.transform.forward) + : Cam.ScreenPointToRay(mousePos); transform.up = Cam.transform.forward; transform.position = ray.GetPoint(GlobalBehaviour.GadgetPhysicalDistance); @@ -75,153 +71,95 @@ void Update() && UIconfig.InputManagerVersion <= 3; //************************************************ - - // in case we dont hit anything, just return - if (!(Physics.Raycast(ray, out Hit, MaxRange, layerMask) - || (MaxRange <= GlobalBehaviour.GadgetPhysicalDistance - && Physics.Raycast(transform.position, Vector3.down, out Hit, GlobalBehaviour.GadgetPhysicalDistance, layerMask)))) - return; - - if (UIconfig.InputManagerVersion == 1) - Input.GetButton(this.deactivateSnapKey); - - RaycastHit[] multipleHits = Physics.RaycastAll(ray, MaxRange, layerMask); - if (multipleHits.Length == 0) - multipleHits = Physics.RaycastAll(transform.position, Vector3.down, GlobalBehaviour.GadgetPhysicalDistance, layerMask); - - - - // sort multipleHits, so the first hit is still the closest - for (int i = 0; i < multipleHits.Length; i++) + Hits = Physics.RaycastAll(ray, MaxRange, layerMask); + if (Hits.Length == 0) { - int minIdx = i; - float minValue = multipleHits[i].distance; - - for (int j = i; j < multipleHits.Length; j++) - { - if (multipleHits[j].distance < minValue) - { - minIdx = j; - minValue = multipleHits[j].distance; - } - - } - - (multipleHits[i], multipleHits[minIdx]) = (multipleHits[minIdx], multipleHits[i]); + Hits = Physics.RaycastAll(transform.position, Vector3.down, GlobalBehaviour.GadgetPhysicalDistance, layerMask); + if (Hits.Length == 0) + return; // in case we dont hit anything, just return } + Hits = Hits.OrderBy(h => h.distance).ToArray(); + Fact[] facts = Hits + .Select(h => + h.transform.TryGetComponent(out FactObject factObj) + ? FactOrganizer.AllFacts[factObj.URI] + : null) + .ToArray(); - for (int i = 0; i < multipleHits.Length; i++) + int i = 0; + for (; i < Hits.Length; i++) { - // check whether we actually hit something - if (!((multipleHits[i].collider.transform.CompareTag("SnapZone") || multipleHits[i].collider.transform.CompareTag("Selectable")) - && (!deactSnapKey))) + if (deactSnapKey || + (!Hits[i].collider.transform.CompareTag("SnapZone") + && !Hits[i].collider.transform.CompareTag("Selectable"))) continue; - //TODO see whether the conditions needs to be adjusted - //if (Hit.transform.TryGetComponent<FactObject>(out var obj) - // && FactOrganizer.AllFacts[obj.URI] is AbstractLineFact lineFact) - if (multipleHits[i].collider.gameObject.layer == LayerMask.NameToLayer("Ray") - || multipleHits[i].collider.gameObject.layer == LayerMask.NameToLayer("Line")) + if (facts[i] is AbstractLineFact lineFact) { - var id = multipleHits[i].collider.gameObject.GetComponent<FactObject>().URI; - AbstractLineFact lineFact = FactOrganizer.AllFacts[id] as AbstractLineFact; - PointFact p1 = lineFact.Point1; - - multipleHits[i].point = Math3d.ProjectPointOnLine(p1.Point, lineFact.Dir, multipleHits[i].point); - } - else if (multipleHits[i].collider.gameObject.layer == LayerMask.NameToLayer("Ring")) - { - #region Ring - var id = multipleHits[i].transform.GetComponent<FactObject>().URI; - CircleFact circleFact = FactOrganizer.AllFacts[id] as CircleFact; - Vector3 middlePoint = circleFact.Point1.Point; - - // project p on circlePlane - var pPlane = - Math3d.ProjectPointOnPlane(circleFact.normal, circleFact.Point1.Point, multipleHits[i].point); - - // check if projectedPoint and circleCenter are identical - if (pPlane == middlePoint) - pPlane = circleFact.Point2.Point; - - multipleHits[i].point = middlePoint + (pPlane - middlePoint).normalized * circleFact.radius; - - // cursor orientation should match circle orientation; dont face downwards - multipleHits[i].normal = circleFact.normal.y < 0 - ? -circleFact.normal - : circleFact.normal; - #endregion Ring + Hits[i].point = + Math3d.ProjectPointOnLine(lineFact.Point1.Point, lineFact.Dir, Hits[i].point); } - else if (multipleHits[i].collider.gameObject.layer == LayerMask.NameToLayer("Circle")) + else if (facts[i] is CircleFact circleFact) { - #region Circle - var id = multipleHits[i].transform.parent.GetComponent<FactObject>().URI; - CircleFact circleFact = FactOrganizer.AllFacts[id] as CircleFact; - - multipleHits[i].point = - Math3d.ProjectPointOnPlane(circleFact.normal, circleFact.Point1.Point, multipleHits[i].point); - - // cursor orientation should match circle orientation; dont face downwards - multipleHits[i].normal = circleFact.normal.y < 0 - ? -circleFact.normal - : circleFact.normal; - #endregion Circle + var projPlane = + Math3d.ProjectPointOnPlane(circleFact.normal, circleFact.Point1.Point, Hits[i].point); + + var circleDistance = projPlane - circleFact.Point1.Point; + if (circleDistance.magnitude >= circleFact.radius) + { + projPlane = circleFact.Point1.Point + circleDistance.normalized * circleFact.radius; + Hits[i].normal = circleDistance.normalized; + } + + Hits[i].point = projPlane; } else { - multipleHits[i].point = multipleHits[i].collider.transform.position; - multipleHits[i].normal = Vector3.up; + Hits[i].point = Hits[i].collider.transform.position; + Hits[i].normal = Vector3.up; } // checking for 2 lines intersection point - if (!((Mathf.Abs(multipleHits[i].distance - multipleHits[0].distance) < 0.03) - && (multipleHits.Length > 1) - && (Mathf.Abs(multipleHits[1].distance - multipleHits[0].distance) < 0.03))) - continue; - // we probably have two objects intersecting + if (Hits.Length <= i + 1 + || Mathf.Abs(Hits[i + 0].distance - Hits[i + 1].distance) > 0.1) + break; // we had at least 1 succesfull case + // we probably have two objects intersecting - // check for line x line intersection and if they actually intersect adjust the points coordinates :) - if (multipleHits[i].collider.gameObject.layer == LayerMask.NameToLayer("Ray") - && multipleHits[0].collider.gameObject.layer == LayerMask.NameToLayer("Ray")) + if (facts[i + 0] is RayFact rayFact1 + && facts[i + 1] is RayFact rayFact2) { - - // case for two intersecting rays - var idLine0 = multipleHits[0].collider.gameObject.GetComponent<FactObject>().URI; - var id = multipleHits[i].collider.gameObject.GetComponent<FactObject>().URI; - - // get the two corresponding line facts - AbstractLineFact lineFactLine0 = FactOrganizer.AllFacts[idLine0] as AbstractLineFact; - AbstractLineFact lineFact = FactOrganizer.AllFacts[id] as AbstractLineFact; - - // get a point on the line - PointFact p1Line0 = lineFactLine0.Point1; - PointFact p1 = lineFact.Point1; - - // get the intersection point and if it actually intersects set it - if (Math3d.LineLineIntersection(out Vector3 intersectionPoint, p1Line0.Point, lineFactLine0.Dir, p1.Point, lineFact.Dir)) - multipleHits[i].point = intersectionPoint; + if (Math3d.LineLineIntersection(out Vector3 intersectionPoint + , rayFact2.Point1.Point, rayFact2.Dir + , rayFact1.Point1.Point, rayFact1.Dir)) + { + Hits[i].point = intersectionPoint; + break; + } } - //TODO: check for other types of intersection. Future Work - } - transform.up = multipleHits[0].normal; - //TODO check whether this is needed - //if (!((multipleHits[0].collider.transform.CompareTag("SnapZone") || multipleHits[0].collider.transform.CompareTag("Selectable")) - // && !Input.GetButton(this.deactivateSnapKey))) - // transform.position += .01f * multipleHits[0].normal; + //TODO: check for other types of intersection. Future Work - transform.position = multipleHits[0].point + .01f * multipleHits[0].normal; - this.MultipleHits = multipleHits; + break; // we had at least 1 succesfull case + } + int nr_hits = Hits.Length - i; + if (i == Hits.Length) + { + i = 0; + nr_hits = 1; + } + Hits = Hits.Slice(i, nr_hits).ToArray(); + Hit = Hits[0]; - //Link to CheckMouseButtonHandler - if (whichCheckMouseButton == 0) { CheckMouseButtons(); } - if (whichCheckMouseButton == 1) { CheckMouseButtons1(); } + transform.up = Hit.normal; + transform.position = Hit.point + .01f * Hit.normal; + if (Input.GetMouseButtonDown(0)) + ClickHandler(); } void updateMaxRange() @@ -231,6 +169,7 @@ void updateMaxRange() case 2: UIconfig.interactingRangeMode = UIconfig.InteractingRangeMode.fromObserverView; break; + case 5: case 6: UIconfig.interactingRangeMode = UIconfig.InteractingRangeMode.fromCharacterView; @@ -239,85 +178,38 @@ void updateMaxRange() default: break; } - - - MaxRange_ = UIconfig.interactingRangeMode switch - { - UIconfig.InteractingRangeMode.fromObserverView => - UIconfig.cursorMaxRange_fromObeserverView, - UIconfig.InteractingRangeMode.fromCharacterView or _ => - MaxRange, - }; - - //Debug.Log("WorldCursorMaxRange :" + MaxRange_); - - } - - //Check if left Mouse-Button was pressed and handle it - void CheckMouseButtons() - { - if (Input.GetMouseButtonDown(0) - && !EventSystem.current.IsPointerOverGameObject() //this prevents rays from shooting through ui - && Hit.transform.gameObject.layer != LayerMask.NameToLayer("Water")) // not allowed to meassure on water - CommunicationEvents.TriggerEvent.Invoke(MultipleHits); } //Check if left Mouse-Button was pressed and handle it - //Alternative Version - void CheckMouseButtons1(bool OnSnap = false, bool onLine = false) + void ClickHandler() { //TODO edit for the multiple hits. Right now it only checks the first hit - if (Input.GetMouseButtonDown(0) && checkClickPermission()) - { + if (Hit.collider.transform.CompareTag("NPC1_text") + && UIconfig.nextDialogPlease < 2) + UIconfig.nextDialogPlease++; - //other Things todo first? - if (Hit.collider.transform.CompareTag("NPC1_text") && UIconfig.nextDialogPlease < 2) - { - UIconfig.nextDialogPlease++; - } + if (IsPointerOverUIObject() //Needed for Android. NOT JUST: EventSystem.current.IsPointerOverGameObject() + || Hit.transform.gameObject.layer == LayerMask.NameToLayer("Water") // not allowed to meassure on water + || Hit.collider.transform.CompareTag("NPC1_text")) // not allowed to meassure on textfields + return; + //if (Hit.transform.gameObject.layer == LayerMask.NameToLayer("TransparentFX")) return; // not allowed to meassure on TransparentFX + CommunicationEvents.TriggerEvent.Invoke(Hits); + return; - //if (EventSystem.current.IsPointerOverGameObject()) return; //this prevents rays from shooting through ui - if (IsPointerOverUIObject()) return; //Needed for Android - if (!checkLayerAndTags()) return; // not allowed to meassure on water - //if (Hit.transform.gameObject.layer == LayerMask.NameToLayer("TransparentFX")) return; // not allowed to meassure on TransparentFX - if (!OnSnap) - { - CommunicationEvents.TriggerEvent.Invoke(MultipleHits); - } - else if (GadgetBehaviour.ActiveGadget is Pointer) + static bool IsPointerOverUIObject() + { + PointerEventData eventDataCurrentPosition = new(EventSystem.current) { - if (!onLine) Hit.collider.enabled = false; - CommunicationEvents.TriggerEvent.Invoke(MultipleHits); - // CommunicationEvents.SnapEvent.Invoke(Hit); - } - - } - } + position = new Vector2(Input.mousePosition.x, Input.mousePosition.y) + }; - private bool checkLayerAndTags() - => Hit.transform.gameObject.layer != LayerMask.NameToLayer("Water") // not allowed to meassure on water - && !Hit.collider.transform.CompareTag("NPC1_text"); // not allowed to meassure on textfields + List<RaycastResult> results = new(); + EventSystem.current.RaycastAll(eventDataCurrentPosition, results); - private bool IsPointerOverUIObject() - { - PointerEventData eventDataCurrentPosition = new(EventSystem.current) - { - position = new Vector2(Input.mousePosition.x, Input.mousePosition.y) - }; - List<RaycastResult> results = new(); - EventSystem.current.RaycastAll(eventDataCurrentPosition, results); - return results.Count > 0; + return results.Count > 0; + } } - - public bool checkClickPermission() => true; - //{ - // if (UIconfig.CanvasOnOff_Array[14] > 0) - // return true; - - // //return false; //todo - // return true; - //} -} +} \ No newline at end of file diff --git a/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs b/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs index 9835baad87bf47c166f172237aef230f3cc6a441..6026ae5efe92b5f4c50132066b6027a3a2082d10 100644 --- a/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs +++ b/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs @@ -48,12 +48,9 @@ private void UpdateDisplay() } FactObject factObj = hit.transform.gameObject.GetComponentInChildren<FactObject>(); - if (factObj == null) - hit.transform.gameObject.GetComponentInParent<FactObject>(); if (factObj == null) - { - // should never happen, if the layerMask is set up correctly + { // should never happen, if the layerMask is set up correctly Debug.LogError("WorldFactInteraction Raycast collided with object in factLayerMask, that did not contain a FactObject script: " + hit.transform.gameObject.name); lastHit = null; Destroy(currentDisplay); @@ -102,5 +99,4 @@ private bool WasOtherUIHit() return false; } #endregion Helper -} - +} \ No newline at end of file diff --git a/Assets/Scripts/UI/HideUI_mobile.cs b/Assets/Scripts/UI/HideUI_mobile.cs index ee3d1814385310b165ca72c3ca3f082e29d8bc98..e5979574ae7515eb3b1dcb480391354b7483e76a 100644 --- a/Assets/Scripts/UI/HideUI_mobile.cs +++ b/Assets/Scripts/UI/HideUI_mobile.cs @@ -1,4 +1,4 @@ - using UnityEngine; +using UnityEngine; using UnityEngine.SceneManagement; using static CommunicationEvents; using static UIconfig; @@ -21,7 +21,7 @@ public string modsave, modload, modfire; - + public string toolMode_keyBind; public string MathMode_keyBind; public string cancel_keyBind; @@ -29,10 +29,10 @@ public string public UnityStandardAssets.Characters.FirstPerson.FirstPersonController CamControl_StdAsset; public Characters.FirstPerson.FirstPersonController1 CamControl_ScriptChar; - + public bool LockOnly = true; public MeshRenderer CursorRenderer; - private double numinputtrigger=0; + private double numinputtrigger = 0; internal Canvas UICanvas; private ControlMapping input_ControlMapping; @@ -65,14 +65,14 @@ private void Awake() //New InputSystem input_ControlMapping = new ControlMapping(); input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.Enable(); - input_ControlMapping.Actionmap1.ToolMode.Enable(); - input_ControlMapping.Actionmap1.MathMode.Enable(); - input_ControlMapping.Actionmap1.Modifier.Enable(); - input_ControlMapping.Actionmap1.Load.Enable(); - input_ControlMapping.Actionmap1.Save.Enable(); - input_ControlMapping.Actionmap1.Reset.Enable(); - input_ControlMapping.Actionmap1.Undo.Enable(); - input_ControlMapping.Actionmap1.Redo.Enable(); + input_ControlMapping.Actionmap1.ToolMode.Enable(); + input_ControlMapping.Actionmap1.MathMode.Enable(); + input_ControlMapping.Actionmap1.Modifier.Enable(); + input_ControlMapping.Actionmap1.Load.Enable(); + input_ControlMapping.Actionmap1.Save.Enable(); + input_ControlMapping.Actionmap1.Reset.Enable(); + input_ControlMapping.Actionmap1.Undo.Enable(); + input_ControlMapping.Actionmap1.Redo.Enable(); playerInput = GetComponent<PlayerInput>(); action_MathM = playerInput.actions["MathMode"]; @@ -88,27 +88,27 @@ private void Awake() private void OnEnable() { input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.Enable(); - input_ControlMapping.Actionmap1.ToolMode.Enable(); - input_ControlMapping.Actionmap1.MathMode.Enable(); - input_ControlMapping.Actionmap1.Modifier.Enable(); - input_ControlMapping.Actionmap1.Load.Enable(); - input_ControlMapping.Actionmap1.Save.Enable(); - input_ControlMapping.Actionmap1.Reset.Enable(); - input_ControlMapping.Actionmap1.Undo.Enable(); - input_ControlMapping.Actionmap1.Redo.Enable(); + input_ControlMapping.Actionmap1.ToolMode.Enable(); + input_ControlMapping.Actionmap1.MathMode.Enable(); + input_ControlMapping.Actionmap1.Modifier.Enable(); + input_ControlMapping.Actionmap1.Load.Enable(); + input_ControlMapping.Actionmap1.Save.Enable(); + input_ControlMapping.Actionmap1.Reset.Enable(); + input_ControlMapping.Actionmap1.Undo.Enable(); + input_ControlMapping.Actionmap1.Redo.Enable(); } private void OnDisable() { input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.Disable(); - input_ControlMapping.Actionmap1.ToolMode.Disable(); - input_ControlMapping.Actionmap1.MathMode.Disable(); - input_ControlMapping.Actionmap1.Modifier.Enable(); - input_ControlMapping.Actionmap1.Load.Disable(); - input_ControlMapping.Actionmap1.Save.Disable(); - input_ControlMapping.Actionmap1.Reset.Disable(); - input_ControlMapping.Actionmap1.Undo.Disable(); - input_ControlMapping.Actionmap1.Redo.Disable(); + input_ControlMapping.Actionmap1.ToolMode.Disable(); + input_ControlMapping.Actionmap1.MathMode.Disable(); + input_ControlMapping.Actionmap1.Modifier.Enable(); + input_ControlMapping.Actionmap1.Load.Disable(); + input_ControlMapping.Actionmap1.Save.Disable(); + input_ControlMapping.Actionmap1.Reset.Disable(); + input_ControlMapping.Actionmap1.Undo.Disable(); + input_ControlMapping.Actionmap1.Redo.Disable(); } @@ -125,7 +125,7 @@ void Start() { UICanvas = GetComponentInChildren<Canvas>(); } - UICanvas.enabled = false; + UICanvas.enabled = false; } } @@ -168,23 +168,23 @@ void Start3() UIconfig.CanvasOnOff_Array[14] = 0; UIconfig.CanvasOnOff_Array[20] = 1; UIconfig.CanvasOnOff_Array[10] = 1; - + UIconfig.CanvasOnOff_Array[3] = 1; SetCamControl123(false); - + } // Update is called once per frame void Update() { - + if (UIconfig.FrameITUIversion == 2) { Update3(); } - + //print("dada" + UIconfig.CanvasOnOff_Array[4]); } @@ -200,35 +200,30 @@ void Update3() CheckUI_Vis_walk(); CheckIf(); - + Update2(); - + CheckUI_Vis(); - + } void CheckUI_Vis_walk() { - - int uiccm=0; - switch (UIconfig.controlMode) + var uiccm = UIconfig.controlMode switch { - case ControlMode.Keyboard: - uiccm = 0; - break; - case ControlMode.Mobile: - uiccm = 1; - break; - default: - uiccm = 0; - break; - } + ControlMode.Mobile + => 1, + ControlMode.Keyboard or _ + => 0, + }; - switch(GameplayMode){ + switch (GameplayMode) + { case 2: UIconfig.CanvasOnOff_Array[11] = 0; UIconfig.CanvasOnOff_Array[19] = 1; break; + default: UIconfig.CanvasOnOff_Array[11] = uiccm; UIconfig.CanvasOnOff_Array[12] = uiccm; @@ -237,13 +232,10 @@ void CheckUI_Vis_walk() UIconfig.CanvasOnOff_Array[17] = uiccm; UIconfig.CanvasOnOff_Array[19] = 0; UIconfig.CanvasOnOff_Array[18] = uiccm; - break; - - } - } + void setUI_Vis_walk(int a) { int uiccm = a; @@ -265,18 +257,18 @@ IEnumerator slowInput() yield return new WaitForSecondsRealtime(waitingBetweenInputs); numinputtrigger = 0; - action_MathM_int = 0; - action_ToolM_int = 0; - action_Cancel_PM_int = 0; - action_modifier_int = 0; - action_load_int = 0; - action_save_int = 0; - action_reset_int = 0; - action_undo_int = 0; - action_redo_int = 0; + action_MathM_int = 0; + action_ToolM_int = 0; + action_Cancel_PM_int = 0; + action_modifier_int = 0; + action_load_int = 0; + action_save_int = 0; + action_reset_int = 0; + action_undo_int = 0; + action_redo_int = 0; - yield return null; + yield return null; } void CheckIf() @@ -315,18 +307,18 @@ void CheckIf() } return; } - if (UIconfig.InputManagerVersion == 2 && numinputtrigger==0) + if (UIconfig.InputManagerVersion == 2 && numinputtrigger == 0) { - if (action_ToolM.ReadValue<float>()!=0 || action_ToolM_int!=0)//input_ControlMapping.Actionmap1.ToolMode.ReadValue<float>() != 0) + if (action_ToolM.ReadValue<float>() != 0 || action_ToolM_int != 0)//input_ControlMapping.Actionmap1.ToolMode.ReadValue<float>() != 0) { UIconfig.CanvasOnOff_Array[14] = 1; UIconfig.CanvasOnOff_Array[20] = 0; numinputtrigger++; - action_ToolM_int = 0; + action_ToolM_int = 0; StartCoroutine(slowInput()); return; } - if (action_MathM.ReadValue<float>() != 0 || action_MathM_int!=0)//input_ControlMapping.Actionmap1.MathMode.ReadValue<float>() != 0) + if (action_MathM.ReadValue<float>() != 0 || action_MathM_int != 0)//input_ControlMapping.Actionmap1.MathMode.ReadValue<float>() != 0) { UIconfig.CanvasOnOff_Array[16] = 1; @@ -337,13 +329,13 @@ void CheckIf() return; } - if (action_Cancel_PM.ReadValue<float>() != 0 || action_Cancel_PM_int!=0)//input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.ReadValue<float>() != 0) - { + if (action_Cancel_PM.ReadValue<float>() != 0 || action_Cancel_PM_int != 0)//input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.ReadValue<float>() != 0) + { UIconfig.CanvasOnOff_Array[02] = 1; UIconfig.CanvasOnOff_Array[10] = 0; numinputtrigger++; - action_Cancel_PM_int = 0; - StartCoroutine(slowInput()); + action_Cancel_PM_int = 0; + StartCoroutine(slowInput()); return; } return; @@ -380,7 +372,7 @@ void CheckIf() } if (UIconfig.InputManagerVersion == 2 && numinputtrigger == 0) { - if (action_ToolM.ReadValue<float>() != 0 || action_ToolM_int!=0)//input_ControlMapping.Actionmap1.ToolMode.ReadValue<float>() != 0) + if (action_ToolM.ReadValue<float>() != 0 || action_ToolM_int != 0)//input_ControlMapping.Actionmap1.ToolMode.ReadValue<float>() != 0) { UIconfig.CanvasOnOff_Array[14] = 0; UIconfig.CanvasOnOff_Array[20] = 1; @@ -389,7 +381,7 @@ void CheckIf() StartCoroutine(slowInput()); return; } - if (action_MathM.ReadValue<float>() != 0 || action_MathM_int!=0)//input_ControlMapping.Actionmap1.MathMode.ReadValue<float>() != 0) + if (action_MathM.ReadValue<float>() != 0 || action_MathM_int != 0)//input_ControlMapping.Actionmap1.MathMode.ReadValue<float>() != 0) { UIconfig.CanvasOnOff_Array[14] = 0; @@ -400,7 +392,7 @@ void CheckIf() return; } - if (action_Cancel_PM.ReadValue<float>() != 0 || action_Cancel_PM_int!=0)//input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.ReadValue<float>() != 0) + if (action_Cancel_PM.ReadValue<float>() != 0 || action_Cancel_PM_int != 0)//input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.ReadValue<float>() != 0) { UIconfig.CanvasOnOff_Array[02] = 1; UIconfig.CanvasOnOff_Array[10] = 0; @@ -417,46 +409,46 @@ void CheckIf() //MathMenue if (UIconfig.InputManagerVersion == 1) { - if (Input.GetButtonDown(MathMode_keyBind)) - { + if (Input.GetButtonDown(MathMode_keyBind)) + { - UIconfig.CanvasOnOff_Array[16] = 0; - UIconfig.CanvasOnOff_Array[20] = 1; - return; - } - if (Input.GetButtonDown(cancel_keyBind)) - { + UIconfig.CanvasOnOff_Array[16] = 0; + UIconfig.CanvasOnOff_Array[20] = 1; + return; + } + if (Input.GetButtonDown(cancel_keyBind)) + { - UIconfig.CanvasOnOff_Array[02] = 1; - UIconfig.CanvasOnOff_Array[10] = 0; - return; - } + UIconfig.CanvasOnOff_Array[02] = 1; + UIconfig.CanvasOnOff_Array[10] = 0; return; + } + return; } if (UIconfig.InputManagerVersion == 2 && numinputtrigger == 0) { - if (action_MathM.ReadValue<float>() != 0f || action_MathM_int!=0)//input_ControlMapping.Actionmap1.MathMode.ReadValue<float>() != 0) - { + if (action_MathM.ReadValue<float>() != 0f || action_MathM_int != 0)//input_ControlMapping.Actionmap1.MathMode.ReadValue<float>() != 0) + { - UIconfig.CanvasOnOff_Array[16] = 0; - UIconfig.CanvasOnOff_Array[20] = 1; - numinputtrigger++; - action_MathM_int = 0; - StartCoroutine(slowInput()); - return; - } + UIconfig.CanvasOnOff_Array[16] = 0; + UIconfig.CanvasOnOff_Array[20] = 1; + numinputtrigger++; + action_MathM_int = 0; + StartCoroutine(slowInput()); + return; + } - if (action_Cancel_PM.ReadValue<float>() != 0f || action_Cancel_PM_int!=0)//input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.ReadValue<float>() != 0) - { - UIconfig.CanvasOnOff_Array[02] = 1; - UIconfig.CanvasOnOff_Array[10] = 0; - numinputtrigger++; - action_Cancel_PM_int = 0; - StartCoroutine(slowInput()); - return; - } + if (action_Cancel_PM.ReadValue<float>() != 0f || action_Cancel_PM_int != 0)//input_ControlMapping.Actionmap1.Cancel_or_PauseMenue.ReadValue<float>() != 0) + { + UIconfig.CanvasOnOff_Array[02] = 1; + UIconfig.CanvasOnOff_Array[10] = 0; + numinputtrigger++; + action_Cancel_PM_int = 0; + StartCoroutine(slowInput()); return; - + } + return; + } } @@ -467,7 +459,7 @@ void CheckIf() - void CheckUI_Vis() + void CheckUI_Vis() { //Toolmode if (UIconfig.CanvasOnOff_Array[14] == 1 && UIconfig.CanvasOnOff_Array[10] == 1) @@ -524,7 +516,7 @@ void CheckUI_Vis() } else { - + Cursor.visible = true; SetCursorRenderer123(false); SetCamControl123(false); @@ -546,7 +538,7 @@ void CheckUI_Vis() } else { - + Cursor.visible = true; SetCursorRenderer123(false); SetCamControl123(false); @@ -581,7 +573,7 @@ void CheckUI_Vis() if (UIconfig.CanvasOnOff_Array[20] != 1 && UIconfig.CanvasOnOff_Array[14] != 1 && UIconfig.CanvasOnOff_Array[16] != 1) { //print("CheckHideUI_mobile"); - + if (LockOnly) { CamControl_StdAsset.enabled = !CamControl_StdAsset.enabled; @@ -591,8 +583,8 @@ void CheckUI_Vis() else { UICanvas.enabled = false; - - + + CursorRenderer.enabled = false; Cursor.visible = true; SetCamControl123(false); @@ -606,7 +598,7 @@ void CheckUI_Vis() } - + void Update2() { if (UIconfig.InputManagerVersion == 1) @@ -676,12 +668,12 @@ void Update2() } } } - /* - //Todo before capturing: Make directories "UFrameIT-Screenshots/Unity_ScreenCapture" in project folder - else if (Input.GetKeyDown(ScreenshotKey)) { - ScreenCapture.CaptureScreenshot("UFrameIT-Screenshots\\Unity_ScreenCapture\\Capture.png"); - } - */ + /* + //Todo before capturing: Make directories "UFrameIT-Screenshots/Unity_ScreenCapture" in project folder + else if (Input.GetKeyDown(ScreenshotKey)) { + ScreenCapture.CaptureScreenshot("UFrameIT-Screenshots\\Unity_ScreenCapture\\Capture.png"); + } + */ } diff --git a/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs b/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs index 4c5fa2561237c4c923ca8908dc2d4574f8fe6af2..5a1847fe90128be4d17418780934d8da248fbdc1 100644 --- a/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs +++ b/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs @@ -1,15 +1,4 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -using static CommunicationEvents; -using static UIconfig; -using static StreamingAssetLoader; - public class BackToButton_withConfChange : MonoBehaviour { @@ -17,59 +6,15 @@ public class BackToButton_withConfChange : MonoBehaviour public GameObject parentM_GObj; public int GameplayMode; - - //public GameObject back_GObj; - - void Start() - { - - } - - private void Update() - { - - } public void goBackButtonOPTM() { - //NetworkJSON_Save(); - ClearUIC(); - + parentM_GObj.SetActiveAllChildren(false); + backTo_GObj.SetActive(true); ; UIconfig.GameplayMode = GameplayMode; - - - - - - } - - - - - - - - - /// <summary> - /// Deactivates all Pages. - /// </summary> - private void ClearUIC() - { - if (parentM_GObj == null) { return; } - - for (int i = 0; i < parentM_GObj.transform.childCount; i++) - { - parentM_GObj.transform.GetChild(i).gameObject.SetActive(false); - } } - - - - - - -} +} \ No newline at end of file diff --git a/Assets/Scripts/UI/InGame/EventsystemMode_Ctrl.cs b/Assets/Scripts/UI/InGame/EventsystemMode_Ctrl.cs index d6f6a1e1b9cbab6d4dc5ad602b4dddb8121dce75..32870efdb794b1c3ac9c91fffb21d0f445b70506 100644 --- a/Assets/Scripts/UI/InGame/EventsystemMode_Ctrl.cs +++ b/Assets/Scripts/UI/InGame/EventsystemMode_Ctrl.cs @@ -1,38 +1,22 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; -using UnityEngine.SceneManagement; -using System.IO; -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -//using static StreamingAssetLoader; -//using static CheckServer; -//using static CommunicationEvents; -using static UIconfig; using UnityEngine.EventSystems; using UnityEngine.InputSystem.UI; +using static UIconfig; public class EventsystemMode_Ctrl : MonoBehaviour { - //public GameObject myself_GObj; //public GameObject StandaloneInputModule_GObj; //public GameObject InputSystem_GObj; public StandaloneInputModule StandaloneInputModule_script; public InputSystemUIInputModule InputSystem_script; - private int GpMode_before=-99; - - + private int GpMode_before = -99; void Start() { - - Update2(); - - + Update2(); } private void Update() @@ -41,77 +25,44 @@ private void Update() Update3(); */ } + private void Update3() { + Update2(); + if (GpMode_before != UIconfig.InputManagerVersion) - { - Update2(); EventSystemModule = InputManagerVersion; - } - if (GpMode_before != UIconfig.EventSystemModule) - { - Update2(); - - } + //if (GpMode_before != UIconfig.EventSystemModule) } - private void Update2(){ - - + private void Update2() + { //Todo Eventbased - //ClearUIC(); switch (UIconfig.EventSystemModule) { case 0: break; - case 1: + case 1: //StandaloneInputModule_script.ActivateModule(); //InputSystem_script.DeactivateModule(); - gameObject.GetComponent<StandaloneInputModule>().enabled=true; + gameObject.GetComponent<StandaloneInputModule>().enabled = true; gameObject.GetComponent<InputSystemUIInputModule>().enabled = false; - - break; + case 2: //InputSystem_script.ActivateModule(); //StandaloneInputModule_script.DeactivateModule(); - - gameObject.GetComponent<StandaloneInputModule>().enabled = false; - gameObject.GetComponent<InputSystemUIInputModule>().enabled = true; - break; case 3: - - gameObject.GetComponent<StandaloneInputModule>().enabled = false; - gameObject.GetComponent<InputSystemUIInputModule>().enabled = true; - break; - default: gameObject.GetComponent<StandaloneInputModule>().enabled = false; gameObject.GetComponent<InputSystemUIInputModule>().enabled = true; break; } - GpMode_before = UIconfig.GameplayMode; - - } - - /* - /// <summary> - /// Deactivates all Pages. - /// </summary> - private void ClearUIC() - { - - for (int i = 0; i < myself_GObj.transform.childCount; i++) - { - myself_GObj.transform.GetChild(i).gameObject.SetActive(false); - } + GpMode_before = UIconfig.GameplayMode; } - */ - - - } \ No newline at end of file +} \ No newline at end of file diff --git a/Assets/Scripts/UI/InGame/ScalingCollider.cs b/Assets/Scripts/UI/InGame/ScalingCollider.cs index 4da5d6acedbcba091fc37226ef0eb83909f03758..b314aee92b3aa75d68292c0a6d200bc49d13d6a4 100644 --- a/Assets/Scripts/UI/InGame/ScalingCollider.cs +++ b/Assets/Scripts/UI/InGame/ScalingCollider.cs @@ -1,24 +1,10 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -//using static StreamingAssetLoader; -//using static CheckServer; using static CommunicationEvents; using static UIconfig; -using UnityEngine.EventSystems; -using static Restart; -using static SceneSwitcher; using System; -public class ScalingCollider: MonoBehaviour +public class ScalingCollider : MonoBehaviour { - - private double scale; public double ColliderRadius; public int Collidersize_ID; @@ -26,79 +12,36 @@ public class ScalingCollider: MonoBehaviour public SphereCollider myCollider; - - - - void Start() { scalingCollider(); } - private void Update() - { - - } - - private void scalingCollider() { switch (Opsys) { case OperationSystem.Android: - scale=colliderScale_all* UIconfig.colliderScale_Mobile_default; ; + scale = colliderScale_all * UIconfig.colliderScale_Mobile_default; break; - case OperationSystem.Windows: - + case OperationSystem.Windows: scale = colliderScale_all * UIconfig.colliderScale_PC_default; break; + default: scale = colliderScale_all * UIconfig.colliderScale_PC_default; break; - - - - } - - if (use_ColliderRadius) - { - scale=scale * ColliderRadius; } - else - { - if (CheckArray()) - { - scale = scale * colliderScale_Obj_array[Collidersize_ID]; - } - } - myCollider.radius = Convert.ToSingle(scale); - //print("Scale "+scale); + if (use_ColliderRadius) + scale *= ColliderRadius; + else if (Collidersize_ID >= 0 + && Collidersize_ID < UIconfig.colliderScale_Obj_array.Length) + scale *= colliderScale_Obj_array[Collidersize_ID]; + myCollider.radius = (float)scale; } - - private bool CheckArray() - { - if (Collidersize_ID >= 0 && Collidersize_ID < UIconfig.colliderScale_Obj_array.Length) - { - return true; - } - return false; - } - //public static double colliderScale_ = 1; //Script - //public static double colliderScale_PC_default = 1; - //public static double colliderScale_Mobile_default = 5; - //public static double colliderScale_Tree = 0.5; - - - - - - - - - } \ No newline at end of file diff --git a/Assets/Scripts/Utility/Math3d.cs b/Assets/Scripts/Utility/Math3d.cs index 290e301e9af827c6f9d3fc823973c96892a0f145..e701a8c2666ffafc038ce5ebc73363cfcbb864e2 100644 --- a/Assets/Scripts/Utility/Math3d.cs +++ b/Assets/Scripts/Utility/Math3d.cs @@ -543,7 +543,7 @@ public static bool IsPointApproximatelyOnLine(Vector3 linePoint, Vector3 lineVec double t = Math.Abs(Vector3.Dot(linePointToPoint.normalized, lineVec)); // expected to be ~1 - return Math.Cos(precission) < t; + return 1-precission < t; } //This function returns true if two Vector3s are approximately parallel diff --git a/ProjectSettings/Packages/com.unity.probuilder/Settings.json b/ProjectSettings/Packages/com.unity.probuilder/Settings.json index d6f0f0269d0890350cef416253636c63aff47193..c41b40ceb3b7d3dc86b35bd985c9723170ae5503 100644 --- a/ProjectSettings/Packages/com.unity.probuilder/Settings.json +++ b/ProjectSettings/Packages/com.unity.probuilder/Settings.json @@ -47,6 +47,66 @@ "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "key": "editor.stripProBuilderScriptsOnBuild", "value": "{\"m_Value\":true}" + }, + { + "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "editor.showEditorNotifications", + "value": "{\"m_Value\":false}" + }, + { + "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "editor.showSceneInfo", + "value": "{\"m_Value\":false}" + }, + { + "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "mesh.meshColliderIsConvex", + "value": "{\"m_Value\":false}" + }, + { + "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "mesh.newShapesSnapToGrid", + "value": "{\"m_Value\":true}" + }, + { + "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "editor.toolbarIconGUI", + "value": "{\"m_Value\":false}" + }, + { + "type": "UnityEngine.ProBuilder.UnwrapParameters, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "lightmapping.defaultLightmapUnwrapParameters", + "value": "{\"m_Value\":{\"m_HardAngle\":88.0,\"m_PackMargin\":20.0,\"m_AngleError\":8.0,\"m_AreaError\":15.0}}" + }, + { + "type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "uv.uvEditorGridSnapIncrement", + "value": "{\"m_Value\":0.125}" + }, + { + "type": "UnityEngine.Material, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "mesh.userMaterial", + "value": "{\"m_Value\":{\"instanceID\":0}}" + }, + { + "type": "UnityEditor.StaticEditorFlags, UnityEditor.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "mesh.defaultStaticEditorFlags", + "value": "{\"m_Value\":0}" + }, + { + "type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "mesh.newShapePivotLocation", + "value": "{\"m_Value\":1}" + }, + { + "type": "UnityEngine.Rendering.ShadowCastingMode, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "mesh.shadowCastingMode", + "value": "{\"m_Value\":1}" + }, + { + "type": "UnityEngine.ProBuilder.ColliderType, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", + "key": "mesh.newShapeColliderType", + "value": "{\"m_Value\":2}" } ] } diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 5cd965bfde5684c5dafba995513101adb8c62178..dc93d9123a6d75673f0833bc7e502b6f7fe387cf 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -12,28 +12,28 @@ EditorUserSettings: value: 5b5200520604510a5b5b587642270744124e4e7a7e7f2764742f1b61b0e6613a flags: 0 RecentlyUsedSceneGuid-2: - value: 0709560454055c0d0c5e5c2444740b4413154a72792d22627c714963e0b6373d + value: 5354015500565a0f5458597740265c4441164c2e7b7072637f7e4e35b5b5643d flags: 0 RecentlyUsedSceneGuid-3: - value: 57505505560608585a56557116730644404e4d7b7c7b7562787e4f66e4b1313e + value: 01550655000d5008580a5e7412710e44464e4129787125667a7a1f37e0e66d39 flags: 0 RecentlyUsedSceneGuid-4: - value: 5354015500565a0f5458597740265c4441164c2e7b7072637f7e4e35b5b5643d + value: 5a530c5653060c0a0c0b5f2140770f4443154979297a76347c2a1e30b5b33068 flags: 0 RecentlyUsedSceneGuid-5: - value: 01550655000d5008580a5e7412710e44464e4129787125667a7a1f37e0e66d39 + value: 530055020302595d550a0e7447220b4415161a7c2f782432282a4f31e6b93068 flags: 0 RecentlyUsedSceneGuid-6: - value: 5a530c5653060c0a0c0b5f2140770f4443154979297a76347c2a1e30b5b33068 + value: 0702005254070d5d5d5a5d7145210f444116487c282d7f357e7a1e66b6b0313a flags: 0 RecentlyUsedSceneGuid-7: - value: 530055020302595d550a0e7447220b4415161a7c2f782432282a4f31e6b93068 + value: 00540c020302515f0b0f5f2711265c44171519797e7c7463787d4d63e1b8303c flags: 0 RecentlyUsedSceneGuid-8: - value: 0702005254070d5d5d5a5d7145210f444116487c282d7f357e7a1e66b6b0313a + value: 0709560454055c0d0c5e5c2444740b4413154a72792d22627c714963e0b6373d flags: 0 RecentlyUsedSceneGuid-9: - value: 00540c020302515f0b0f5f2711265c44171519797e7c7463787d4d63e1b8303c + value: 57505505560608585a56557116730644404e4d7b7c7b7562787e4f66e4b1313e flags: 0 RecentlyUsedScenePath-0: value: 22424703114646680e0b0227036c681f041b1c39631c3435281e1221eee47a2decee22f0