From 76fb8398e5968d3a852da120c9895b0227573ca3 Mon Sep 17 00:00:00 2001 From: "Marco Zimmer (MaZiFAU)" <marco.alexander.zimmer@fau.de> Date: Sun, 8 Aug 2021 21:18:34 +0200 Subject: [PATCH] Bug Fixes: wandering NPC, Fact Label cleanup, Zombie Fact --- Assets/Scenes/RiverWorld.unity | 16 ++++++++-------- Assets/Scripts/InteractionEngine/Fact.cs | 6 ++++++ .../Scripts/InteractionEngine/FactOrganizer.cs | 10 ++++++++-- Assets/Scripts/Level.cs | 5 ++--- Assets/Scripts/Restart.cs | 2 ++ 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Assets/Scenes/RiverWorld.unity b/Assets/Scenes/RiverWorld.unity index fb99d299..69dd97e6 100644 --- a/Assets/Scenes/RiverWorld.unity +++ b/Assets/Scenes/RiverWorld.unity @@ -18018,6 +18018,12 @@ Transform: type: 3} m_PrefabInstance: {fileID: 800121727} m_PrefabAsset: {fileID: 0} +--- !u!1 &802019337 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 4661435515762455780, guid: e289bf5debb17f6459818c207d781953, + type: 3} + m_PrefabInstance: {fileID: 224606875} + m_PrefabAsset: {fileID: 0} --- !u!1 &804378691 GameObject: m_ObjectHideFlags: 0 @@ -23482,7 +23488,7 @@ PrefabInstance: - target: {fileID: 2222111361404534124, guid: 88f2fd29f58b9734683512546acec310, type: 3} propertyPath: m_Name - value: WalkAroundTree + value: DonTWalkAroundThisTree objectReference: {fileID: 0} - target: {fileID: 2222111361405018444, guid: 88f2fd29f58b9734683512546acec310, type: 3} @@ -37123,12 +37129,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1738591202} m_PrefabAsset: {fileID: 0} ---- !u!1 &1747050947 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 2222111361404534124, guid: 88f2fd29f58b9734683512546acec310, - type: 3} - m_PrefabInstance: {fileID: 1038096501} - m_PrefabAsset: {fileID: 0} --- !u!1001 &1749781951 PrefabInstance: m_ObjectHideFlags: 0 @@ -61544,7 +61544,7 @@ PrefabInstance: type: 3} propertyPath: walkAroundObject value: - objectReference: {fileID: 1747050947} + objectReference: {fileID: 802019337} - target: {fileID: 6999573641170124239, guid: 8590393c51194934a95cdc2075fc4dec, type: 3} propertyPath: radiusAroundObject diff --git a/Assets/Scripts/InteractionEngine/Fact.cs b/Assets/Scripts/InteractionEngine/Fact.cs index d279dd9a..f27033ab 100644 --- a/Assets/Scripts/InteractionEngine/Fact.cs +++ b/Assets/Scripts/InteractionEngine/Fact.cs @@ -122,6 +122,12 @@ public void rename(string newLabel) public abstract GameObject instantiateDisplay(GameObject prefab, Transform transform); + public static void Clear() + { + MaxLabelId = 0; + UnusedLabelIds.Clear(); + } + public virtual void delete(bool keep_clean = true) { //TODO: MMT: delete over there diff --git a/Assets/Scripts/InteractionEngine/FactOrganizer.cs b/Assets/Scripts/InteractionEngine/FactOrganizer.cs index e627e936..ea1a0322 100644 --- a/Assets/Scripts/InteractionEngine/FactOrganizer.cs +++ b/Assets/Scripts/InteractionEngine/FactOrganizer.cs @@ -165,7 +165,8 @@ private void PruneWorkflow() { stepnote last = Workflow[i]; - if (MetaInf[last.Id].workflow_id == i) + if (last.creation // may be zombie + && MetaInf[last.Id].workflow_id == i) // remove for good, if original creation gets pruned { this[last.Id].delete(); @@ -193,9 +194,14 @@ public string Add(Fact value, out bool exists, bool samestep = false) if (MetaInf[key].workflow_id >= marker) // check for zombie-status + { // protect zombie from beeing pruned + var zombie = Workflow[MetaInf[key].workflow_id]; + zombie.creation = false; + Workflow[MetaInf[key].workflow_id] = zombie; + // set new init location MetaInf[key] = new meta(marker, true); - + } // zombies are undead! else if (MetaInf[key].active) // desired outcome already achieved diff --git a/Assets/Scripts/Level.cs b/Assets/Scripts/Level.cs index 4dcd7500..49eadeef 100644 --- a/Assets/Scripts/Level.cs +++ b/Assets/Scripts/Level.cs @@ -9,8 +9,6 @@ public class Level : MonoBehaviour //Solving game parameters public int minimalSolutionHight; - public static bool solved = false; - void Start() // Start is called before the first frame update @@ -25,11 +23,12 @@ void Start() LineFact target = new LineFact(buttom.Id, top.Id, SolutionManager); Solution.Add(SolutionManager[SolutionManager.Add(target, out _, true)]); + Fact.Clear(); } public static bool gameSolved() { - solved = + bool solved = LevelFacts.DynamiclySolved(Solution, out _, out List<Fact> hits, FactComparer: new LineFactHightDirectionComparer()); if (solved) diff --git a/Assets/Scripts/Restart.cs b/Assets/Scripts/Restart.cs index 613be963..eea90546 100644 --- a/Assets/Scripts/Restart.cs +++ b/Assets/Scripts/Restart.cs @@ -12,6 +12,8 @@ public void LevelReset() // only when generated! (in Level.cs) CommunicationEvents.SolutionManager.hardreset(false); + Fact.Clear(); + SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex); } -- GitLab