コード例 #1
0
        public void MSM_Next_Test()
        {
            MSM  target = new MSM();
            uint max    = 10;

            target.Srand(2);
            uint result = target.Next(max);

            Assert.IsTrue(result >= 0, "Wartosc losowa MSM jest mniejsza od 0!");
            Assert.IsTrue(result <= max, "Wartosc losowa MSM jest większa niż podana wartość maksymalna!");
        }
コード例 #2
0
    onPreUpdate()
    {
        if (InputManager.XButton())
        {
            MSM.pushState(GetComponent <fsmMarioMachine>().s_Pause);
        }

        else if (InputManager.BButton())
        {
            MSM.setState(GetComponent <fsmMarioMachine>().s_Jump);
        }

        else if (InputManager.AButton())
        {
            if (GetComponent <fsmMarioMachine>().arrGO_Contacts.Length < 0)
            {
                for (int i = 0; i < GetComponent <fsmMarioMachine>().arrGO_Contacts.Length; ++i)
                {
                    if (GetComponent <fsmMarioMachine>().arrGO_Contacts[i].GetComponent <cCharacter>().interact(MSM as fsmMarioMachine))
                    {
                        MSM.setState(GetComponent <fsmMarioMachine>().s_Dialog_CutScene);
                    }
                }
            }
        }

        /**
         * ************************
         * *  Check run button
         * ************************
         * */
        if (InputManager.YButton())
        {
            GetComponent <cCharacter>().m_Stats.m_running = true;
        }
        else
        {
            GetComponent <cCharacter>().m_Stats.m_running = false;
        }

        /**
         * ************************
         * *  Check stick input
         * ************************
         * */
        if (InputManager.Joystick() != Vector3.zero)
        {
            MSM.pushState(GetComponent <fsmMarioMachine>().s_WalkRun);
        }
    }
コード例 #3
0
        static void Main(string[] args)
        {
            AbstractRandom rand = new MSM();

            rand.Srand(156654);

            for (int i = 0; i < 25; i++)
            {
                Console.WriteLine("Nastepna wartosc ciagu: " + rand.Next(5));;
            }
            rand.PrintValues();


            Console.ReadKey();
        }
コード例 #4
0
        public static void StaticMethod()
        {
            //Initializes MSM
            MSM.SettingsDirectory = Environment.CurrentDirectory;

            while (true)
            {
                string consoleRead = Console.ReadLine();

                string[] consoleArgs = consoleRead.Split(' ');
                consoleArgs[0] = consoleArgs[0].ToUpper();

                if (consoleArgs[0] == "SAVESETTINGS")
                {
                    MSM.SaveSettings();
                }
                if (consoleArgs[0] == "EDITSETTING")
                {
                    MSM.EditSetting(consoleArgs[1], consoleArgs[2]);
                }
                if (consoleArgs[0] == "DELETESETTING")
                {
                    MSM.DeleteSetting(consoleArgs[1]);
                }
                if (consoleArgs[0] == "READSETTING")
                {
                    Console.WriteLine("Returned value : " + MSM.ReadSetting(consoleArgs[1]));
                }
                if (consoleArgs[0] == "CHECKSETTING")
                {
                    Console.WriteLine("Returned Value : " + MSM.CheckSetting(consoleArgs[1]));
                }
                if (consoleArgs[0] == "HELP")
                {
                    Console.WriteLine("Showing help - Help displays all of the public methods in MSM");
                    Console.WriteLine("There are currently 5 commands. All of these commands you can use in your project code");
                    Console.WriteLine(" ");
                    Console.WriteLine("EditSetting [SettingTitle] [SettingValue] - Edits a setting in the settings array.");
                    Console.WriteLine("ReadSetting [SettingTitle] - Returns the value in that setting.");
                    Console.WriteLine("CheckSetting [SettingTitle] - Returns a bool value if the setting exists or not.");
                    Console.WriteLine("DeleteSetting [SettingTitle] - Deletes that setting from the settings array.");
                    Console.WriteLine("SaveSettings [SettingTitle] - Saves the settings array to a file.");
                }
            }
        }
コード例 #5
0
 onPreUpdate()
 {
     if (gameObject.transform.position.z <= 0)
     {
         Vector3 pos = gameObject.transform.position;
         pos.z = 0;
         gameObject.transform.position = pos;
         MSM.pushState(GetComponent <fsmMarioMachine>().s_Idle);
     }
     if (InputManager.YButton())
     {
         GetComponent <cCharacter>().m_Stats.m_running = true;
     }
     else
     {
         GetComponent <cCharacter>().m_Stats.m_running = false;
     }
 }
コード例 #6
0
        public void RandomToFile(int seed, int range, int numberOfPRNGs)
        {
            String         file           = "";
            StringBuilder  stringBuilder  = new StringBuilder();
            String         content        = "";
            AbstractRandom randomAbstract = new LCG();
            Random         random         = new Random(seed);

            TimerManager.ClearMessage();

            for (int i = 0; i < 3; i++)
            {
                stringBuilder.Clear();
                if (i == 0)
                {
                    randomAbstract = new LCG();
                    randomAbstract.Srand((uint)seed);
                    file = "Pseudo Random Numbers LCG.csv";
                }
                else if (i == 1)
                {
                    randomAbstract = new LFG();
                    randomAbstract.Srand((uint)seed);
                    file = "Pseudo Random Numbers LFG.csv";
                }
                else if (i == 2)
                {
                    randomAbstract = new MSM();
                    randomAbstract.Srand((uint)seed);
                    file = "Pseudo Random Numbers MSM.csv";
                }

                TimerManager.TimerStart(file);

                for (int j = 0; j < numberOfPRNGs; j++)
                {
                    stringBuilder.Append(randomAbstract.Next((uint)range));
                    stringBuilder.Append(Environment.NewLine);
                }

                TimerManager.TimrStop();

                content = stringBuilder.ToString();
                WriteToFile(file, content);
            }

            file = "Pseudo Random Numbers Random C#.csv";
            stringBuilder.Clear();

            TimerManager.TimerStart(file);

            for (int j = 0; j < numberOfPRNGs; j++)
            {
                stringBuilder.Append(random.Next(range));
                stringBuilder.Append(Environment.NewLine);
            }

            TimerManager.TimrStop();

            MessageBox.Show("Pliki zostały wygenerowane.", "Generowanie plików");

            content = stringBuilder.ToString();
            WriteToFile(file, content);
        }