コード例 #1
0
ファイル: Label.cs プロジェクト: cvaneseltine/NaNoGenMo2015
 public Label(Section thisSection)
 {
     id = maxID;
     maxID++;
     text = ("label_" + id);
     section = thisSection;
 }
コード例 #2
0
        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 ();
                }
            }
        }
コード例 #3
0
        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");
            }
        }
コード例 #4
0
ファイル: Option.cs プロジェクト: cvaneseltine/NaNoGenMo2015
 public Section BuildSection()
 {
     nextSection = new Section (builder);
     //Console.WriteLine (nextSection.Report () + " created for architect #" + builder.ID + ".");
     return nextSection;
 }