From 6ad5caa44dca830fbe3cc867b451a777857c8d91 Mon Sep 17 00:00:00 2001
From: unknown <john.schihada@hotmail.com>
Date: Sun, 7 Mar 2021 19:35:57 +0100
Subject: [PATCH] Fixed bug + Adjusted prefab

---
 Assets/Resources/Prefabs/Ray.prefab           |  5 +---
 Assets/Scripts/InteractionEngine/Fact.cs      | 27 +++++++++++--------
 .../Scripts/InventoryStuff/ScrollDetails.cs   |  5 ++--
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/Assets/Resources/Prefabs/Ray.prefab b/Assets/Resources/Prefabs/Ray.prefab
index b76561a8..91113a8a 100644
--- a/Assets/Resources/Prefabs/Ray.prefab
+++ b/Assets/Resources/Prefabs/Ray.prefab
@@ -125,9 +125,6 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   meshRendererToChange: {fileID: 323004521892560777}
-  animationStartColor: {r: 0.98039216, g: 0.99215686, b: 0.03137255, a: 1}
-  animationEndColor: {r: 1, g: 0.52156866, b: 0.007843138, a: 1}
-  animateDuration: 5
 --- !u!1 &4853696702160906218
 GameObject:
   m_ObjectHideFlags: 0
@@ -186,7 +183,7 @@ MeshRenderer:
   m_RenderingLayerMask: 1
   m_RendererPriority: 0
   m_Materials:
-  - {fileID: 2100000, guid: dc000ff84823e7045bac15e87d6da9b2, type: 2}
+  - {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
   m_StaticBatchInfo:
     firstSubMesh: 0
     subMeshCount: 0
diff --git a/Assets/Scripts/InteractionEngine/Fact.cs b/Assets/Scripts/InteractionEngine/Fact.cs
index 5c381691..76b8e463 100644
--- a/Assets/Scripts/InteractionEngine/Fact.cs
+++ b/Assets/Scripts/InteractionEngine/Fact.cs
@@ -34,7 +34,6 @@ public int Id
     }
     public GameObject Representation;
     public string backendURI;
-    public string backendValueURI; // supposed to be null, for Facts without values eg. Points, OpenLines, OnLineFacts...
 
     public string format(float t)
     {
@@ -325,18 +324,24 @@ public RayFact(int pid1, int pid2, string uri)
     public static RayFact parseFact(Scroll.ScrollFact fact)
     {
         String uri = fact.@ref.uri;
-        String pointAUri = ((OMS)((OMA)((Scroll.ScrollSymbolFact)fact).df).arguments[0]).uri;
-        String pointBUri = ((OMS)((OMA)((Scroll.ScrollSymbolFact)fact).df).arguments[1]).uri;
-        if (CommunicationEvents.Facts.Exists(x => x.backendURI.Equals(pointAUri)) &&
-            CommunicationEvents.Facts.Exists(x => x.backendURI.Equals(pointBUri)))
+        if ((OMA)((Scroll.ScrollSymbolFact)fact).df != null)
         {
-            int pid1 = CommunicationEvents.Facts.Find(x => x.backendURI.Equals(pointAUri)).Id;
-            int pid2 = CommunicationEvents.Facts.Find(x => x.backendURI.Equals(pointBUri)).Id;
-            return new RayFact(pid1, pid2, uri);
+            String pointAUri = ((OMS)((OMA)((Scroll.ScrollSymbolFact)fact).df).arguments[0]).uri;
+            String pointBUri = ((OMS)((OMA)((Scroll.ScrollSymbolFact)fact).df).arguments[1]).uri;
+            if (CommunicationEvents.Facts.Exists(x => x.backendURI.Equals(pointAUri)) &&
+                CommunicationEvents.Facts.Exists(x => x.backendURI.Equals(pointBUri)))
+            {
+                int pid1 = CommunicationEvents.Facts.Find(x => x.backendURI.Equals(pointAUri)).Id;
+                int pid2 = CommunicationEvents.Facts.Find(x => x.backendURI.Equals(pointBUri)).Id;
+                return new RayFact(pid1, pid2, uri);
+            }
+            //If dependent facts do not exist return null
+            else
+            {
+                return null;
+            }
         }
-        //If dependent facts do not exist return null
-        else
-        {
+        else {
             return null;
         }
     }
diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs
index a2569a9c..6d45e106 100644
--- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs
+++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs
@@ -259,8 +259,9 @@ public void animateHint(GameObject scrollParameter, string scrollParameterUri) {
                 scrollParameter.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger();
                 //Animate Fact in FactPanel
                 AnimateExistingFactEvent.Invoke(existingFact);
-                //Animate factRepresentation in game
-                existingFact.Representation.GetComponentInChildren<MeshRendererHintAnimation>().AnimationTrigger();
+                //Animate factRepresentation in game if Fact has a Representation
+                if(existingFact.Representation != null)
+                    existingFact.Representation.GetComponentInChildren<MeshRendererHintAnimation>().AnimationTrigger();
             }
             //If not -> Generate a Fact-Representation with such dependent facts
             else
-- 
GitLab