Exemple #1
0
 public Label(Section thisSection)
 {
     id = maxID;
     maxID++;
     text = ("label_" + id);
     section = thisSection;
 }
        void SpawnMany(Section thisSection)
        {
            if (thisSection.MyEnd.MyOptions == null) {
                Console.WriteLine ("Architects.SpawnMany has been called with a null list of options. This is all wrong.");
            }
            if (thisSection.MyEnd is Ending) {
                Console.WriteLine ("SpawnMany called from an Ending.");
            }
            current = null;
            foreach (Option option in thisSection.MyEnd.MyOptions) {
                if (current == null) {
                    AdjustStats (option);
                    current = option.BuildSection ();
                    sections.Add (current);
                    Console.WriteLine ("Architect #" + ID + " following " + thisSection.Report () + " " + option.Report () + " to " + current.Report () + ".");
                }
                else {
                    Architect nextArchitect;

                    nextArchitect = Spawn ();
                    nextArchitect.AdjustStats (option);
                    nextArchitect.current = option.BuildSection ();
                    nextArchitect.sections.Add (current);
                    Console.WriteLine ("Created architect #" + nextArchitect.ID + " to follow " + thisSection.Report () + " " + option.Report () + " to " + nextArchitect.current.Report () + ".");
                    nextArchitect.Build ();
                }
            }
        }
        public void Build()
        {
            while (Depth < PlannedSections) {
                if (current == null) {
                    current = new Section (this);
                    sections.Add (current);
                }
                if (!(current.MyEnd is Ending)) {
                    SpawnMany (current);
                }
            }
            if (current == null) {
                Console.WriteLine ("Current is null.");
            }

            myChapter.PassBackSections (sections);
            myChapter.PassBackStats (currentStats);
            Console.Write ("Architect #" + id + " build complete, turning in " + sections.Count + " sections (");
            foreach (Section section in sections) {
                Console.Write (section.MyLabel + " ");
            }
            Console.Write (") Final: " + sections[sections.Count - 1].MyLabel);
            if (current.MyEnd is Choice) {
                Console.WriteLine (" - Choice");
            }
            else if (current.MyEnd is StatCheck) {
                Console.WriteLine (" - StatCheck");
            }
            else if (current.MyEnd is Ending) {
                Console.WriteLine (" - Ending");
            }
            else {
                Console.WriteLine (" - but it isn't a valid ending kind");
            }
        }
Exemple #4
0
 public Section BuildSection()
 {
     nextSection = new Section (builder);
     //Console.WriteLine (nextSection.Report () + " created for architect #" + builder.ID + ".");
     return nextSection;
 }