From f1dceaba861f97c5abc0e2bc2a27492f0580e2c3 Mon Sep 17 00:00:00 2001 From: "https://gl.mathhub.info/SESch93" <john.schihada@hotmail.com> Date: Fri, 9 Jul 2021 09:17:50 +0200 Subject: [PATCH] Added some comments to better understand forward completions --- Assets/Scripts/InventoryStuff/ScrollDetails.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs index 6d45e106..ea4a0946 100644 --- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs +++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs @@ -216,6 +216,9 @@ public List<string> processRenderedScroll(Scroll rendered, List<string> hintUris //If ScrollFact is assigned -> No Hint if (obj.transform.GetChild(0).GetComponent<DropHandling>().currentFact == null) { Fact currentFact = ParsingDictionary.parseFactDictionary[rendered.requiredFacts[i].getType()].Invoke(rendered.requiredFacts[i]); + //If currentFact could be parsed: this fact maybe not yet exists in the global fact-list but there must be a fact + // of the same type and the same dependent facts in the fact-list, otherwise currentFact could not have been parsed + //If the fact could not be parsed -> Therefore not all dependent Facts exist -> No Hint //AND if fact has no dependent facts -> No Hint if (currentFact != null && currentFact.hasDependentFacts()) @@ -243,14 +246,16 @@ public void animateHint(GameObject scrollParameter, string scrollParameterUri) { scrollParameter.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); //Animate Fact in FactPanel AnimateExistingFactEvent.Invoke(fact); - //Animate factRepresentation in game - fact.Representation.GetComponentInChildren<MeshRendererHintAnimation>().AnimationTrigger(); + //Animate factRepresentation in game, if fact has a Representation (e.g. OnLineFact has no Representation) + if(fact.Representation != null) + fact.Representation.GetComponentInChildren<MeshRendererHintAnimation>().AnimationTrigger(); } } else if (LatestRenderedHints.Exists(x => x.backendURI.Equals(scrollParameterUri))) { fact = LatestRenderedHints.Find(x => x.backendURI.Equals(scrollParameterUri)); //If there is an equal existing fact -> Animate that fact AND ScrollParameter + //Equal is true, if there exists a fact of the same type and with the same dependent facts if (Facts.Exists(x => x.Equals(fact))) { Fact existingFact = Facts.Find(x => x.Equals(fact)); @@ -259,8 +264,8 @@ public void animateHint(GameObject scrollParameter, string scrollParameterUri) { scrollParameter.GetComponentInChildren<ImageHintAnimation>().AnimationTrigger(); //Animate Fact in FactPanel AnimateExistingFactEvent.Invoke(existingFact); - //Animate factRepresentation in game if Fact has a Representation - if(existingFact.Representation != null) + //Animate factRepresentation in game if Fact has a Representation (e.g. OnLineFact has no Representation) + if (existingFact.Representation != null) existingFact.Representation.GetComponentInChildren<MeshRendererHintAnimation>().AnimationTrigger(); } //If not -> Generate a Fact-Representation with such dependent facts -- GitLab