Пример #1
0
 public void AddSibling(CActor actor)
 {
     m_siblings.Add(actor);
 }
Пример #2
0
 public void AddParent(CActor actor)
 {
     m_parents.Add(actor);
 }
Пример #3
0
 public void AddEnemy(CActor actor)
 {
     m_enemies.Add(actor);
 }
Пример #4
0
 public void AddFriend(CActor actor)
 {
     m_friends.Add(actor);
 }
        public CLifePath Generate()
        {
            CLifePath path = new CLifePath();
            StringDictionary currentTable = m_tables["[Parents]"];
            String result = getResult(currentTable);
            String next = "";
            currentTable = m_tables["[" + result.Replace("@", "") + "]"];
            if(result.ToLower().Contains("other"))
            {
                // how many surviving parents?
                result = getResult(currentTable);
                next = getNextTable(currentTable);
                currentTable = m_tables["[" + next.Replace("@", "") + "]"];

                int living = m_rand.Next(100);
                if (living < 25)
                    path.ParentStatus = "Both are dead";
                else
                {
                    path.ParentStatus = "One is dead";
                    CActor parent = new CActor();
                    parent.Age = m_rand.Next(36, 60).ToString();
                    parent.Status = getResult(currentTable);
                    path.Parents.Add(parent);
                }
            }
            else
            {
                // generate both parents
                result = getResult(currentTable);
                next = getNextTable(currentTable);
                currentTable = m_tables["[" + next.Replace("@", "") + "]"];

                path.ParentStatus = "Both are living";
                CActor parent = new CActor();
                parent.Age = m_rand.Next(36, 60).ToString();
                CActor parent2 = new CActor();
                parent2.Age = m_rand.Next(36, 60).ToString();
                switch (result)
                {
                    case "You get along well with both parents":
                        parent.Attitude = "Good";
                        parent2.Attitude = "Good";
                        break;
                    case "You get along well with one but not the other":
                        int coin = m_rand.Next(1);
                        if(coin == 0)
                        {
                            parent.Attitude = "Bad";
                            parent2.Attitude = "Good";
                        }
                        else
                        {
                            parent.Attitude = "Good";
                            parent2.Attitude = "Bad";
                        }
                        break;
                    default:
                        parent.Attitude = "Bad";
                        parent2.Attitude = "Bad";
                        break;
                }

                path.Parents.Add(parent);
                path.Parents.Add(parent2);
            }
            result = getResult(currentTable);
            next = getNextTable(currentTable);
            currentTable = m_tables["[" + next.Replace("@", "") + "]"];

            return path;
        }