private void LoadTech()
        {
            try
            {
                using (StreamReader reader = new StreamReader(@"Content/Techs/Tech.txt"))
                {
                    int      index       = 0;
                    string   name        = "";
                    string   description = "";
                    int      cost        = 0;
                    TechEnum type        = 0;
                    float    amount      = 0;

                    while (!reader.EndOfStream)
                    {
                        string line = reader.ReadLine();

                        switch (index)
                        {
                        case 0:
                            name = line;
                            index++;
                            break;

                        case 1:
                            description = line;
                            index++;
                            break;

                        case 2:
                            cost = int.Parse(line);
                            index++;
                            break;

                        case 3:
                            type = (TechEnum)Enum.Parse(typeof(TechEnum), line);
                            index++;
                            break;

                        case 4:
                            amount = float.Parse(line);
                            techs.Add(new Tech(name, description, cost, type, amount));
                            index++;
                            break;

                        case 5:
                            index = 0;
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #2
0
        public Tech(string n, string d, int c, TechEnum t, float m)
        {
            name        = n;
            description = d;
            cost        = c;
            type        = t;
            modifier    = m;

            numResearch = 0;
            complete    = false;
            researching = false;
        }