コード例 #1
0
        public void RunRoomSession()
        {
            MazeRoom currentroom = mazemap.GetRoomByIteration(player.X, player.Y);
            string   ScriptName  = currentroom.SessionName;

            //Only parse the script if the name isn't blank
            if (currentroom.SessionName != "")
            {
                ScriptRepresentation script = new ScriptRepresentation();
                //Initialize the script
                script.init(ScriptName);
                SpeechScriptInterpreter RoomRunner = new SpeechScriptInterpreter();
                if (FirstRun)
                {
                    RoomRunner.init();
                    FirstRun = false;
                }
                else
                {
                    RoomRunner.Init_Voice(Program.voicename);
                }
                RoomRunner.parse(ScriptName);
                //Console.WriteLine(ScriptName);
            }
            //Move the player again.
            Player_Move();
        }
コード例 #2
0
        //Chains the script to the ScriptChainer List without any logic
        public void chain_script(string ScriptName)
        {
            ScriptRepresentation rep = new ScriptRepresentation();

            //string BaseFilename = Application.StartupPath;
            //BaseFilename += "/Scripts/"+ ScriptName;
            //rep.FileName = "/Scripts/Tags_Test.txt";
            rep.init(ScriptName);
            ScriptList.Add(rep);
        }
コード例 #3
0
        //If a Script Representation with the filename of NoProperty is returned
        //We will omit it and assume we couldn't find an induction
        //And return to randomizing =p
        public ScriptRepresentation FindScriptWithFeature(List <ScriptRepresentation> Ilist, Program.ScriptFeatures TargetFeature)
        {
            ScriptRepresentation I_returner = new ScriptRepresentation();

            I_returner.FileName = "NoProperty";
            foreach (ScriptRepresentation n in Ilist)
            {
                if (n.FeaturesList.Contains(TargetFeature))
                {
                    //We found a script with the target feature -- cancel search.
                    I_returner = n;
                    break;
                }
            }
            return(I_returner);
        }
コード例 #4
0
        public ScriptRepresentation FetchRandom(List <ScriptRepresentation> Ilist)
        {
            ScriptRepresentation Ireturned = new ScriptRepresentation();

            Ilist.Shuffle();
            Random rng        = new Random();
            int    ListAmount = Ilist.Count();
            //grab a random index
            int RandomIndex = rng.Next(ListAmount);

            ScriptRepresentation[] Iarray = Ilist.ToArray();
            if (Iarray.Length > 0)
            {
                Ireturned = Iarray[RandomIndex];
            }
            else
            {
                Ireturned.FileName = "NoProperty";
            }
            return(Ireturned);
        }
コード例 #5
0
        //The amount of segments to include
        public void GenerateGenericSession(int chain_amount)
        {
            string[] Chain_Segments = new string[chain_amount + 1];
            //Fill with blank strings so it doesn't get nulled.
            for (int i = 0; i < chain_amount + 1; i++)
            {
                Chain_Segments[i] = "";
            }

            //we basically want to get all of the types of induction and awakener (anyway)
            Inductions_List = MakeScriptListWithFeature(Base_Pool, Program.ScriptFeatures.IsInduction);
            //And now get a list of all awakeners
            Awakening_List = MakeScriptListWithFeature(Base_Pool, Program.ScriptFeatures.IsAwakener);
            //And now we need a list of only triggering segments to randomize from
            Triggering_List = MakeScriptListWithFeature(Base_Pool, Program.ScriptFeatures.IncludeInTriggerOnWakePool);

            //Now that we made our lists we can remove Awakeners, and Inductions from the base pool.

            RemoveScriptsWithFeature(Base_Pool, Program.ScriptFeatures.IsInduction);
            RemoveScriptsWithFeature(Base_Pool, Program.ScriptFeatures.IsAwakener);

            if (Program.userpreferences.HasFeatureAsString(("IsInduction")))
            {
                Chain_Segments[0] = "Induction";
            }
            else
            {
                Chain_Segments[0] = "Randomize";
            }
            //If there is a wakener, and a triggering segment before wake up then gaurentee a triggering segment before wake up and shift awakener backwards
            //One slot to make room for triggering segment upon awaken.
            if (Program.userpreferences.HasFeatureAsString("IncludeInTriggerOnWakePool") && Program.userpreferences.HasFeatureAsString("IsAwakener"))
            {
                Chain_Segments[chain_amount - 1] = "Awakener";
                Chain_Segments[chain_amount]     = "TriggeringSegment";
            }

            //Same as above except account for there being no awakener.
            if (Program.userpreferences.HasFeatureAsString("IncludeInTriggerOnWakePool") && !Program.userpreferences.HasFeatureAsString("IsAwakener"))
            {
                Chain_Segments[chain_amount] = "TriggeringSegment";
            }


            //This is to be called after all the Non prefs are removed. Unless in chaos mode.

            for (int i = 0; i < chain_amount; i++)
            {
                if (Chain_Segments[i] == "")
                {
                    Chain_Segments[i] = "Randomize";
                }
            }

            GetScrambledMidList(Base_Pool);

            //Finally generate the session
            for (int i = 0; i < chain_amount; i++)
            {
                switch (Chain_Segments[i])
                {
                case "Randomize":
                    ScriptRepresentation Rando_Script = FetchRandom(Base_Pool);
                    if (Rando_Script.FileName != "NoProperty")
                    {
                        Session_List.Add(Rando_Script);
                        //Patched so we remove scripts from the base pool after they have been included.
                        Base_Pool.Remove(Rando_Script);
                    }
                    break;

                case "TriggeringSegment":
                    ScriptRepresentation Trig_Script = FetchRandom(Triggering_List);
                    if (Trig_Script.FileName != "NoProperty")
                    {
                        Session_List.Add(Trig_Script);
                        //Patched so we remove scripts from the base pool after they have been included.
                        Base_Pool.Remove(Trig_Script);
                    }
                    break;

                case "Awakener":
                    ScriptRepresentation Awaken_Script = FetchRandom(Awakening_List);
                    if (Awaken_Script.FileName != "NoProperty")
                    {
                        Session_List.Add(Awaken_Script);
                    }
                    break;

                case "Induction":
                    ScriptRepresentation Induction = FetchRandom(Inductions_List);
                    if (Induction.FileName != "NoProperty")
                    {
                        Session_List.Add(Induction);
                    }
                    break;
                }
            }
        }