示例#1
0
        public void InstantiateGenerators()
        {
            //Changed to Max Level of 2
            Generator generator1 = new CircleGenerator();

            generator1.SetPowerLevel(2);

            //Changed to 2
            Generator generator2 = new TriangleGenerator();

            generator2.SetPowerLevel(2);

            Generator generator3 = new TriangleGenerator();

            generator3.SetPowerLevel(2);

            Generator generator4 = new RectangleGenerator();

            generator4.SetPowerLevel(2);

            Generator generator5 = new RectangleGenerator();

            generator5.SetPowerLevel(0);

            generators = new List <Generator>()
            {
                generator1,
                generator2,
                generator3,
                generator4,
                generator5,
            };
        }
示例#2
0
        public void InstantiateGenerators()
        {
            //Velociraptor has 12 stock threshold
            //Total Power / Perimeter = Stock Threshold
            //Total Power = 12 * 4500 = 54000
            //This one uses the neat Floor(Total Power / Perimeter) to reach threshold.

            Generator generator1 = new RectangleGenerator();

            generator1.SetPowerLevel(1); // 10000 * 2 * 1 = 20000

            Generator generator2 = new RectangleGenerator();

            generator2.SetPowerLevel(1); // 10000 * 2 * 1 = 20000

            Generator generator3 = new OctagonGenerator();

            generator3.SetPowerLevel(4); // 2000 * 2 * 4 = 16000

            generators = new List <Generator>()
            {
                generator1,
                generator2,
                generator3
            };
        }
示例#3
0
        public void InstantiateGenerators()
        {
            Generator generator1 = new CircleGenerator();

            generator1.SetPowerLevel(4);

            Generator generator2 = new TriangleGenerator();

            generator2.SetPowerLevel(5);

            Generator generator3 = new TriangleGenerator();

            generator3.SetPowerLevel(2);

            Generator generator4 = new RectangleGenerator();

            generator4.SetPowerLevel(2);

            Generator generator5 = new RectangleGenerator();

            generator5.SetPowerLevel(5);

            generators = new List <Generator>()
            {
                generator1,
                generator2,
                generator3,
                generator4,
                generator5,
            };
        }
示例#4
0
        public void InstantiateGenerators()
        {
            Generator generator1 = new CircleGenerator();

            generator1.SetPowerLevel(5);

            Generator generator2 = new CircleGenerator();

            generator2.SetPowerLevel(1);

            Generator generator3 = new TriangleGenerator();

            generator3.SetPowerLevel(0);

            // Changed to 0 to meet power threshold

            Generator generator4 = new TriangleGenerator();

            generator4.SetPowerLevel(4);

            Generator generator5 = new TriangleGenerator();

            generator5.SetPowerLevel(1);

            Generator generator6 = new RectangleGenerator();

            generator6.SetPowerLevel(1);

            Generator generator7 = new RectangleGenerator();

            generator7.SetPowerLevel(5);

            Generator generator8 = new OctagonGenerator();

            generator8.SetPowerLevel(8);

            Generator generator9 = new OctagonGenerator();

            generator9.SetPowerLevel(1);

            Generator generator10 = new OctagonGenerator();

            generator10.SetPowerLevel(1);


            generators = new List <Generator>
            {
                generator1,
                generator2,
                generator3,
                generator4,
                generator5,
                generator6,
                generator7,
                generator8,
                generator9,
                generator10
            };
        }
示例#5
0
 private void AddOneRectOfBody()
 {
     SnakeObj.SnakeBody.Add(new SnakeBodyPart()
     {
         BasicRectangle = RectangleGenerator.Generate(RectangleTypes.SnakeBody),
         Index          = ++SnakeObj.MaxIndex,
         Location       = GetLocationForNewPart(SnakeObj.Direction)
     });
 }
示例#6
0
 public void AddOneRectOfBody(SnakeDirection snakeDirection)
 {
     SnakeBodyParts.Add(new SnakeBodyPart()
     {
         BasicRectangle = RectangleGenerator.Generate(RectangleTypes.SnakeBody),
         Index          = ++MaxIndex,
         Location       = GetLocationForNewPart(snakeDirection)
     });
 }
示例#7
0
        public void InstantiateGenerators()
        {
            Generator generator1 = new CircleGenerator();

            generator1.SetPowerLevel(2);

            Generator generator2 = new CircleGenerator();

            generator2.SetPowerLevel(2);

            Generator generator3 = new TriangleGenerator();

            generator3.SetPowerLevel(2);

            Generator generator4 = new TriangleGenerator();

            generator4.SetPowerLevel(3);

            Generator generator5 = new TriangleGenerator();

            generator5.SetPowerLevel(1);

            Generator generator6 = new RectangleGenerator();

            generator6.SetPowerLevel(5);

            Generator generator7 = new RectangleGenerator();

            generator7.SetPowerLevel(5);

            Generator generator8 = new OctagonGenerator();

            generator8.SetPowerLevel(7);

            Generator generator9 = new OctagonGenerator();

            generator9.SetPowerLevel(2);

            Generator generator10 = new OctagonGenerator();

            generator10.SetPowerLevel(1);


            generators = new List <Generator>
            {
                generator1,
                generator2,
                generator3,
                generator4,
                generator5,
                generator6,
                generator7,
                generator8,
                generator9,
                generator10
            };
        }
示例#8
0
        private void rectangleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var ph = new RectangleGenerator()
            {
                Changed = changed
            };

            dataModel.AddItem(ph);
            UpdateList();
        }
示例#9
0
        public static SnakeBodyPart GetDefaultBodyPart()
        {
            var bodyPart = new SnakeBodyPart()
            {
                BasicRectangle = RectangleGenerator.Generate(RectangleTypes.SnakeBody),
                Index          = 0,
                Location       = new PositionOnBoard(200, 200)
            };

            return(bodyPart);
        }
    protected void Rectangle(RectangleGenerator rectangle)
    {
        var kernel = compute.FindKernel("Rectangle");

        compute.SetMatrix("_Transform", transform.localToWorldMatrix);
        compute.SetFloat("_DT", Time.deltaTime);
        compute.SetFloat("_RectangleWidth", rectangle.Width);
        compute.SetFloat("_RectangleHeight", rectangle.transform.position.y);
        compute.SetFloat("_RectangleDepth", rectangle.Depth);

        KernelGrids(kernel);
    }
示例#11
0
        public void GenerateRandomRectangles_GivenCount_ShouldGenerateCountNonEmptyRectangles()
        {
            // Arrange
            var generator = new RectangleGenerator(1, 20, 1, 20);
            int count     = _fixture.Create <int>();

            // Act
            IList <Rectangle> rectangles = generator.GenerateRandomRectangles(count);

            // Assert
            rectangles.Count.Should().Be(count);
            foreach (Rectangle rect in rectangles)
            {
                rect.Width.Should().BeGreaterThan(0);
                rect.Height.Should().BeGreaterThan(0);
            }
        }
示例#12
0
        public void InstantiateGenerators()
        {
            Generator generator1 = new RectangleGenerator();

            generator1.SetPowerLevel(5);

            Generator generator2 = new RectangleGenerator();

            generator2.SetPowerLevel(5);

            Generator generator3 = new OctagonGenerator();

            generator3.SetPowerLevel(10);

            generators = new List <Generator>()
            {
                generator1,
                generator2,
                generator3
            };
        }
示例#13
0
        public void InstantiateGenerators()
        {
            //Triceratops has 16 stock threshold
            //Total Power / Perimeter = Stock Threshold
            //Total Power = 16 * 12000 = 192000
            //Oh look, 192000 is pretty close to 200000... I wonder how I can reach that easily.
            //This one uses the neat Floor(Total Power / Perimeter) to reach threshold.


            Generator generator1 = new CircleGenerator();

            generator1.SetPowerLevel(2); // 50000 * 2 = 100000

            Generator generator2 = new TriangleGenerator();

            generator2.SetPowerLevel(2); // 15000 * 2 = 30000

            Generator generator3 = new TriangleGenerator();

            generator3.SetPowerLevel(2); // 15000 * 2 = 30000

            Generator generator4 = new RectangleGenerator();

            generator4.SetPowerLevel(1); // 10000 * 2 * 1 = 20000

            Generator generator5 = new RectangleGenerator();

            generator5.SetPowerLevel(1); // 10000 * 2 * 1 = 20000

            generators = new List <Generator>()
            {
                generator1,
                generator2,
                generator3,
                generator4,
                generator5,
            };
        }
示例#14
0
        public void InstantiateGenerators()
        {
            Generator generator1 = new RectangleGenerator();

            generator1.SetPowerLevel(2);

            Generator generator2 = new RectangleGenerator();

            generator2.SetPowerLevel(0);

            // Modified above two rectangle generators to meet energy threshold

            Generator generator3 = new OctagonGenerator();

            generator3.SetPowerLevel(10);

            generators = new List <Generator>()
            {
                generator1,
                generator2,
                generator3
            };
        }
示例#15
0
        public void InstantiateGenerators()
        {
            //Changed to Max Level / 2 = 2
            Generator generator1 = new RectangleGenerator();

            generator1.SetPowerLevel(2);

            Generator generator2 = new RectangleGenerator();

            generator2.SetPowerLevel(0);

            //Changed to Max Level / 2 = 4
            Generator generator3 = new OctagonGenerator();

            generator3.SetPowerLevel(4);

            generators = new List <Generator>()
            {
                generator1,
                generator2,
                generator3
            };
        }
示例#16
0
        private void _generateTerrain()
        {
            try
            {
                IGenerator generator = null;

                switch (_configurationManager.Algorithm)
                {
                case GeneratorAlgorithm.PerlinNoise:
                    generator = new PerlinNoiseGenerator(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.Hill:
                    generator = new HillAlgorithmGenerator(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.Random:
                    generator = new RandomGenerator(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.Rectangle:
                    generator = new RectangleGenerator(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.Voronoi:
                    generator = new VoronoiGenerator(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.SimplexNoise:
                    generator = new SimplexNoise(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.DiamondSquare:
                    generator = new DiamondSquareGenerator(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.RandomWalk:
                    generator = new RandomWalkGenerator(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                case GeneratorAlgorithm.DrunkardWalk:
                    generator = new DrunkardWalk(GraphicsDevice, Graphics, _configurationManager.Parameters);
                    break;

                default:
                    throw new NotImplementedException("Unknown algorithm");
                }
                if (generator == null)
                {
                    throw new NullReferenceException("Generator cannot be null");
                }

                var timeStart = System.DateTime.Now;
                Scene.AddObjectToRender(generator.Generate());
                Logger.Log.Info("Generated time = " + (DateTime.Now - timeStart).TotalMilliseconds + " ms for " + _configurationManager.Algorithm.ToString());
            }
            catch (Exception e)
            {
                Logger.Log.Error(e);
                throw;
            }
        }
示例#17
0
 protected override AnimationSet getAnimSet()
 {
     return(RectangleGenerator.getRectangleAnimSet(30, (Constants.groundHeight - Constants.airHeight) + 50));
 }
示例#18
0
        public void InstantiateGenerators()
        {
            //T-Rex has 20 stock threshold
            //Total Power / Perimeter = T-Rex Stock Threshold
            //Total Power = 20 * 15000 = 300000

            //Circle Generator maximum is 2
            Generator generator1 = new CircleGenerator();

            generator1.SetPowerLevel(2); // 50000 * 2 = 100000

            Generator generator2 = new CircleGenerator();

            generator2.SetPowerLevel(2); // 50000 * 2 = 100000

            //Triangle Generator Max level is 3
            Generator generator3 = new TriangleGenerator();

            generator3.SetPowerLevel(2); // 15000 * 2  // These work well.

            Generator generator4 = new TriangleGenerator();

            generator4.SetPowerLevel(2); // 15000 * 2

            Generator generator5 = new TriangleGenerator();

            generator5.SetPowerLevel(0); // 15000 * 0

            Generator generator6 = new RectangleGenerator();

            generator6.SetPowerLevel(1); // 10000 * 2 * 1 = 20000

            Generator generator7 = new RectangleGenerator();

            generator7.SetPowerLevel(1); // 10000 * 2 * 1 = 20000

            //8 Max
            Generator generator8 = new OctagonGenerator();

            generator8.SetPowerLevel(0); // 2000 * 2 * 0 = 0

            Generator generator9 = new OctagonGenerator();

            generator9.SetPowerLevel(0); // 2000 * 0 = 0

            Generator generator10 = new OctagonGenerator();

            generator10.SetPowerLevel(0); // 2000 * 0 = 0


            generators = new List <Generator>
            {
                generator1,
                generator2,
                generator3,
                generator4,
                generator5,
                generator6,
                generator7,
                generator8,
                generator9,
                generator10
            };
        }
 protected override AnimationSet getAnimSet()
 {
     return(RectangleGenerator.getRectangleAnimSet(50, 50));
 }