Esempio n. 1
0
        public void ParseFile()
        {
            const string filename = @"MarkTeksten.txt";

            string[] lines = File.ReadAllLines(filename);

            MessageHolder lastMessage = null;

            foreach (string line in lines)
            {
                if (line == "")
                {
                    continue;
                }
                if (line.StartsWith("+"))
                {
                    tutorial    = new MessageHolder(line.Remove(0, 1));
                    lastMessage = tutorial;
                }
                else if (line.StartsWith("-"))
                {
                    lastMessage = lastMessage.AddChild(line.Remove(0, 1));
                }
                else
                {
                    lastMessage = new MessageHolder(line);
                    messages.Add(lastMessage);
                }
            }
        }
        public MessageHolder AddChild(string message)
        {
            MessageHolder m = new MessageHolder(message);

            child = m;
            return(m);
        }
Esempio n. 3
0
        private void SpawnNewCard(bool tutorial = false)
        {
            GameObject go = Instantiate(TaskPrefab);
            Task       t  = go.GetComponent <Task>();

            if (lastSpawned == null && !tutorial)
            {
                MessageHolder[] possible = messages.Where(x => !currentTasks.Any(a => a.Message == x.Message)).ToArray();
                lastSpawned = possible[rand.Next(0, possible.Length)];
            }
            else if (tutorial)
            {
                lastSpawned = this.tutorial;
            }

            t.Create(lastSpawned.Message);

            lastSpawned = lastSpawned.Child;

            currentTasks.Add(t);
            GUIManager.instance.PlaceCard(go, t.State, GetCardCount(t.State));
        }