/// <summary> /// Loads the saveable global variables and all saveable variables from /// the dialogue behaviours from the scene from the PlayerPrefs. /// </summary> public static void LoadFromPlayerPrefs() { DialogueSystem.LoadFromPlayerPrefs(); foreach (var b in GameObject.FindObjectsOfType <DialogueBehaviour>()) { b.Graph.Variables.LoadFromPlayerPrefs(); } }
/// <summary> /// Saves the saveable global variables and all saveable variables from /// the dialogue behaviours from the scene into a string. /// </summary> public static string SerializeToString() { string s = DialogueSystem.SaveToString() + "\n"; foreach (var b in GameObject.FindObjectsOfType <DialogueBehaviour>()) { if (b.Graph != null) { s += b.ID + "|" + b.Graph.Variables.SaveToString() + "\n"; } } return(s); }
/// <summary> /// Loads the saveable global variables and all saveable variables from /// the dialogue behaviours from the scene from a string. /// </summary> public static void DeserializeFromString(string s) { string[] vars = s.Split('\n'); DialogueSystem.LoadFromString(vars[0]); var behaviours = GameObject.FindObjectsOfType <DialogueBehaviour>().ToList(); foreach (var v in vars) { string[] variable = v.Split('|'); var b = behaviours.Find(x => x.Graph != null && x.ID == variable[0]); if (b != null) { b.Graph.Variables.LoadFromString(variable[1]); } } }
string ReplaceText(string text) { string result = text; result = result.Replace("{actor}", dialogueBehaviour.GetActorName(ActorName)); if (dialogueBehaviour.Player != null) { result = result.Replace("{player}", dialogueBehaviour.Player.name); } foreach (var v in Root.LocalVariables.GetAll()) { result = result.Replace("{local:" + v.Name + "}", v.Value.ToString()); } foreach (var v in DialogueSystem.GetGlobalVariables()) { result = result.Replace("{global:" + v.Name + "}", v.Value.ToString()); } return(result); }
//function called by EncounterSystem once encounter is calculated public void DeclareTheWinner(bool wins) { DialogueSystem.SetGlobalVariable <bool>("playerWins", wins); }
public void IdentifyBot(int botNumber) { DialogueSystem.SetGlobalVariable <int>("botIdentity", botNumber); }
public void Update() { DialogueSystem.SetGlobalVariable("PlayerPower", combatPower); DialogueSystem.SetGlobalVariable("HasEnoughParts", HasEnoughParts); }
public void Update() { DialogueSystem.SetGlobalVariable("playerPower", combatPower); }