当前位置: 首页>>代码示例>>C#>>正文


C# Random.NextQuaternion方法代码示例

本文整理汇总了C#中System.Random.NextQuaternion方法的典型用法代码示例。如果您正苦于以下问题:C# Random.NextQuaternion方法的具体用法?C# Random.NextQuaternion怎么用?C# Random.NextQuaternion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Random的用法示例。


在下文中一共展示了Random.NextQuaternion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateLevel

        public static void GenerateLevel(string LoadPath)
        {
            N8Level Level = new N8Level(LoadPath);

            N8Block ControlPoint = Level.blocks.GenerateBlock("letter.period", "Moon Control Point");
            ControlPoint.position.Z = 2000;
            //Load it as chibi, if available
            ControlPoint.Special = 2;
            Random rand = new Random();

            for (int i = 0; i < 50; i++)
            {
                N8Block moonblock = Level.blocks.GenerateBlock("simple.white.land.mega", "Moon");
                moonblock.position.Z = 1000;
                moonblock.rotation = rand.NextQuaternion();
                ControlPoint.AttachToMe(moonblock);
            }

            string SavePath = Path.GetDirectoryName(LoadPath) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(LoadPath) + "_moon.ncd";
            MinorModifiers.OrderLoading(Level, new Vector3D(0,0,1));
            Utilities.Save(SavePath, Level);
        }
开发者ID:rnoronha,项目名称:Neverdaunt-8Bit-Level-Tools,代码行数:22,代码来源:AddMoon.cs

示例2: GetCrossroads

        public static N8Level GetCrossroads()
        {
            N8Level Level = new N8Level(); //MaxProtectTest.GetProxyBubble();
            MinorModifiers.AddCrossroads(Level);
            Random rand = new Random();

            int NumBlocks = 349 - (Level.blocks.Tronics.Count + Level.blocks.Blocks.Count);
            Console.WriteLine(NumBlocks);
            Console.ReadLine();
            for (int i = 0; i < NumBlocks; i++)
            {
                string color = colors[i % colors.Length];
                //string color = "black";
                N8Block CurrentBlock = Level.blocks.GenerateBlock("simple." + color + ".block", names[rand.Next(names.Length)]);
                //Keep it out of the crossroads
                CurrentBlock.position = rand.NextVector(new Vector3D(2000, 2000, -1000), new Vector3D(300, 300, 2000));

                //And flop it around the quadrants randomly
                if (rand.Next(0, 2) == 0)
                {
                    CurrentBlock.position.X *= -1;
                }
                if (rand.Next(0, 2) == 0)
                {
                    CurrentBlock.position.Y *= -1;
                }

                CurrentBlock.rotation = rand.NextQuaternion();
            }
            MinorModifiers.OrderLoadingCylindrical(Level);
            return Level;
        }
开发者ID:rnoronha,项目名称:Neverdaunt-8Bit-Level-Tools,代码行数:32,代码来源:Crazy.cs

示例3: GetBlockOctopus

        public static N8Level GetBlockOctopus()
        {
            N8Level Level = new N8Level();
            Random rand = new Random();
            int NumBlocks = 349;
            Vector3D diag1 = new Vector3D(1, 1, 0);
            diag1.Normalize();
            Vector3D diag2 = new Vector3D(1, -1, 0);
            diag2.Normalize();
            Vector3D plusX = new Vector3D(1, 0, 0);
            Vector3D plusY = new Vector3D(0, 1, 0);
            //Max distance for a diagonal is Sqrt(4000^2 + 4000^2) ~= 5656, and add an extra two just to make sure it reaches the edges
            int DiagMin = -5658 / 2;
            int DiagMax = 5658 / 2;
            int StraightMin = -2000;
            int StraightMax = 2000;
            for (int i = 0; i < NumBlocks; i++)
            {

                string color = colors[i % colors.Length];
                N8Block CurrentBlock = Level.blocks.GenerateBlock("simple." + color + ".block", names[rand.Next(names.Length)]);

                if (rand.Next(0, 2) == 0)
                {
                    int dmag = rand.Next(DiagMin, DiagMax);
                    if (rand.Next(0, 2) == 0)
                    {

                        CurrentBlock.position = diag1 * dmag;
                    }
                    else
                    {
                        CurrentBlock.position = diag2 * dmag;
                    }
                }
                else
                {
                    int smag = rand.Next(StraightMin, StraightMax);
                    if (rand.Next(0, 2) == 0)
                    {

                        CurrentBlock.position = plusX * smag;
                    }
                    else
                    {
                        CurrentBlock.position = plusY * smag;
                    }
                }

                CurrentBlock.rotation = rand.NextQuaternion();
            }

            //And now make it come up in the center - blocks closer to 0,0,0 get more of a boost.
            int MaxHeight = 300;
            foreach (N8Block b in Level.blocks.Blocks)
            {
                b.position.Z = Math.Round(Math.Min(100 / b.position.Length * MaxHeight, 600));
            }

            MinorModifiers.OrderLoadingCylindrical(Level);

            return Level;
        }
开发者ID:rnoronha,项目名称:Neverdaunt-8Bit-Level-Tools,代码行数:63,代码来源:Crazy.cs

示例4: GetBlockRoad

        public static N8Level GetBlockRoad(bool diagonal = false)
        {
            N8Level Level = new N8Level();
            Random rand = new Random();
            int NumBlocks = 349;
            if (diagonal)
            {
                Vector3D diag1 = new Vector3D(1, 1, 0);
                diag1.Normalize();
                Vector3D diag2 = new Vector3D(1, -1, 0);
                diag2.Normalize();
                //Max distance for a diagonal is Sqrt(4000^2 + 4000^2) ~= 5656, and add an extra two just to make sure it reaches the edges
                int Min = -5658 / 2;
                int Max = 5658 / 2;
                for (int i = 0; i < NumBlocks; i++)
                {
                    int mag = rand.Next(Min, Max);
                    string color = colors[i % colors.Length];
                    N8Block CurrentBlock = Level.blocks.GenerateBlock("simple." + color + ".block", names[rand.Next(names.Length)]);

                    if (rand.Next(0, 2) == 0)
                    {
                        CurrentBlock.position = diag1 * mag;
                    }
                    else
                    {
                        CurrentBlock.position = diag2 * mag;
                    }

                    CurrentBlock.rotation = rand.NextQuaternion();
                }
            }
            else
            {
                for (int i = 0; i < NumBlocks; i++)
                {
                    string color = colors[i % colors.Length];
                    N8Block CurrentBlock = Level.blocks.GenerateBlock("simple." + color + ".block", names[rand.Next(names.Length)]);
                    //Either put them in the x-coord area or the y-coord area (yes this means the center will be better covered)
                    if (rand.Next(0, 2) == 0)
                    {
                        CurrentBlock.position = rand.NextVector(new Vector3D(-100, 2000, 0), new Vector3D(100, -2000, 0));
                    }
                    else
                    {
                        CurrentBlock.position = rand.NextVector(new Vector3D(2000, -100, 0), new Vector3D(-2000, 100, 0));
                    }
                    CurrentBlock.rotation = rand.NextQuaternion();
                }
            }

            MinorModifiers.OrderLoading(Level, new Vector3D(1, 1, 0));

            return Level;
        }
开发者ID:rnoronha,项目名称:Neverdaunt-8Bit-Level-Tools,代码行数:55,代码来源:Crazy.cs


注:本文中的System.Random.NextQuaternion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。