From 25263a7acf719fc2b278c9bd54158adb7c7a3e56 Mon Sep 17 00:00:00 2001 From: Paul-Walcher <ethicalmonk@proton.me> Date: Sat, 4 May 2024 13:14:36 +0000 Subject: [PATCH] Update create_fact.md --- DOC/create_fact.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/DOC/create_fact.md b/DOC/create_fact.md index 80fb3cd..7f78967 100644 --- a/DOC/create_fact.md +++ b/DOC/create_fact.md @@ -12,14 +12,14 @@ 1. A constructor that calls base(). Constructor can have SomDoc, which is the MMT URI as OMS. - 2. define: A method parseFact(List<Fact>, MMTFact fact). - MMTFact is the fact you received from the server. - Then, in this method, you will try to add your fact to the ParsingDictionary in Assets\InteractionEngine\FactHandling\Facts, - then add it to the first argument (the list). + 2. define: A method parseFact(List<Fact> ret, MMTFact fact). + convert MMTFact fact to Unity Fact and add it to the List<Fact> ret + + hint: use FactRecorder.AllFacts[<uri>] to get the Unity Fact belonging to the <uri> 3. define: public override bool HasDependentFact => [true/false] - 4. define: GetDeendentFactIds(), which gives back a string array of the dependent Ids of your facts. + 4. define: GetDeendentFactIds(), which gives back a string array of the dependent URIs of your facts. 5. define: GetHashCode() @@ -32,24 +32,26 @@ 8. define: MakeMMTDecalaration(), which gives back a new MMTFact. 9. define: Defines(), which gives back a SOMDoc(MMTObject) of your class -<br> + 2. Add the MMT-fact you Implemented into Assets\Scripts\MMTServer\CommunicationProtocol\MMTConstants.cs -<br> + 3. Then, in Assets\Scripts\InteractionEngine\FactHandling\Facts\Fact.cs -<br> + 1. add an entry into ParsingDictionary.parseFactDictionary with your MMTConstant as key and the parseFact Method of the Fact class you implemented. - 2. Then add a line to the lines that look like [JsonSubtypes,.KnownSubType(typeof(YOUR_FACTCLASS), nameof(YOUR_FACTCLASS))] -<br> + + 2. Then add a line to the lines that look like + [JsonSubtypes,.KnownSubType(typeof(YOUR_FACTCLASS), nameof(YOUR_FACTCLASS))] + 4. In Assets\Scripts\InteractionEngine\FactHandling\FactSpawner.cs -<br> + 1. Add a variable of type GameObject for your fact. 2. Create a spawn method for your fact. 3. In SpawnFactRepresentation add your Fact to the switch-case statement -<br> + 5. In the Unity Editor in Assets\Ressources\Prefabs\Facts create the prefab for your Fact. -<br> + 6. Connect your Prefab to the FactSpawner class -<br> + 1. Open Assets\Scenes\Worlds\RiverWorld. 2. In the Unity Project Tab goto folder Assets\Scripts\InteractionEngine\FactHandling 3. Rightclick FactSpawner.cs and select "Find References In Scene". -- GitLab