Newer
Older
# <u><b>Create Fact</b></u>
### <u>Dependency: MMT-Fact already implemented</u>
1. In Assets\InteractionEngine\FactHandling\Facts create your own fact
<u>Your fact should include</u>:
(<i>use the already existing Facts as examples</i>)
<br>
1. A constructor that calls base(). Constructor can have SomDoc, which is the MMT URI as OMS.
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 URIs of your facts.
5. define: GetHashCode()
6. define: EquivalentWrapped(YOUR_FACTCLASS, YOUR_FACTCLASS), which is a Method that
returns true if the two facts are (approximately) equal
7. define: _ReInitializeMe(Dictionary<string, string> old_to_new), that gets called when the Fact
gets reinstantiated
8. define: MakeMMTDecalaration(), which gives back a new MMTFact.
9. define: Defines(), which gives back a SOMDoc(MMTObject) of your class
2. Add the MMT-fact you Implemented into Assets\Scripts\MMTServer\CommunicationProtocol\MMTConstants.cs
3. Then, in Assets\Scripts\InteractionEngine\FactHandling\Facts\Fact.cs
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))]
4. In Assets\Scripts\InteractionEngine\FactHandling\FactSpawner.cs
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
5. In the Unity Editor in Assets\Ressources\Prefabs\Facts create the prefab for your Fact.
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".
4. In Hirarchy select WorldCursor and add your Fact Prefab into the Inspector.
5. Alternative to 6.2 & 6.3: in hirarchy search: "ref:Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs"