Exemple #1
0
 /// <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();
     }
 }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
        /// <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]);
                }
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 //function called by EncounterSystem once encounter is calculated
 public void DeclareTheWinner(bool wins)
 {
     DialogueSystem.SetGlobalVariable <bool>("playerWins", wins);
 }
Exemple #6
0
 public void IdentifyBot(int botNumber)
 {
     DialogueSystem.SetGlobalVariable <int>("botIdentity", botNumber);
 }
Exemple #7
0
 public void Update()
 {
     DialogueSystem.SetGlobalVariable("PlayerPower", combatPower);
     DialogueSystem.SetGlobalVariable("HasEnoughParts", HasEnoughParts);
 }
Exemple #8
0
 public void Update()
 {
     DialogueSystem.SetGlobalVariable("playerPower", combatPower);
 }