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