I have a Json file holding data for my LineData type i created.
[Serializable]
public class LineData
{
public string lineID;
public string lineDialog;
public float lineDuration;
public string condition;
}
Note the last one, 'condition', that is what I hope to use to hold a name of a specific bool in my code, so that the line can only be spoken when that bool is true.
Is this a decent way to achieve this? Or is it even possible? I've read about making 'custom markup' on my Json things like (!!) and (->) built in the text to mean stuff in my code, but I don't know where to start with it and cannot find any tutorials (I've only seen it on some Youtube GDC lecture style videos from professional game developers working for companies)
But failing the custom markup thing, if I can somehow use the string of the name of the bool, and use that to check the state of it's corresponding bool in the code, that would be enough for me so far.
Any ideas or help is fantastic and very welcome. Many thanks!!!
(PS. The json looks like this (Im sure you don't need it, but just in case)):
{ "lineDatas":
[
{
"lineID": "BEDROOM_DAVE_0001",
"lineDialog": "Yaawwn, up i get for another fun packed day.",
"lineDuration": 3,
"condition": ""
},
{
"lineID": "BEDROOM_DAVE_0002",
"lineDialog": "Well I think I need a cigarette before I get to work!",
"lineDuration": 3,
"condition1": "notSmokedCig"
}
]
}
Set<String>
for your Conditions at runtime? A Set is similar to an Array or a Dictionary, except it only contains unique values. While your Game is running, you obviously fulfill some conditions. Your conditions are represented in the Set and putting them in the Set implicitly means the condition is met. \$\endgroup\$