Example #1
0
 public static void ExplodeOctahedrons(Vector3 ball, OctahedronHelper octahedronHelper, FractionHelper fractionHelper)
 {
     var octahedrons = octahedronHelper.GetOctahedronsOnZeroZ();
     foreach (var octahedron in octahedrons)
     {
         if (Math.Abs((decimal)(ball.X - octahedron.GetRealPosition().X)) +
             Math.Abs((decimal)(ball.Z - octahedron.GetRealPosition().Z)) < (decimal)(octahedron.Size * Sqrt2))
         {
             octahedron.Explode(fractionHelper);
             octahedronHelper.Remove(octahedron);
         }
     }
 }
Example #2
0
        public void Explode(FractionHelper fractionHelper)
        {
            Game1.Counter += 2;

            var count = 4 + new Random().Next(5);
            var pos = _position + new Vector3(0, 0.5f, 0);

            for (int i = 0; i < count; i++)
            {
                fractionHelper.CreateRandomFracion(pos);
            //                var fraction = Fraction.GenerateRandom(pos, _world, _view, _projection);

            }
        }
Example #3
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _startBlock = Content.Load<Model>("Models/start_block");
            _block = Content.Load<Model>("Models/block");
            _ball = Content.Load<Model>("Models/ball4");
            _octahedron = Content.Load<Model>("Models/octahedron4");
            _fraction = Content.Load<Model>("Models/explode1");
            _counterFont = Content.Load<SpriteFont>("TopRightCornerCounter");
            _titleFont = Content.Load<SpriteFont>("TitleFont");

            Matrix world = Matrix.CreateScale(0.01f);
            Matrix view = Matrix.CreateLookAt(new Vector3(0, 16f, 20f), Vector3.Zero, Vector3.Up);
            Matrix projection = /*Matrix.CreatePerspectiveFieldOfView(
              MathHelper.PiOver4,
              GraphicsDevice.Viewport.AspectRatio, 0.1f, 100f);*/
                Matrix.CreateOrthographic(12, 24, 0.1f, 100);

            _fractionHelper = new FractionHelper(_fraction, world, view, projection);
            _fractionHelper.InitBeginState();

            _octahedronHelper = new OctahedronHelper(_octahedron, world, view, projection);
            _octahedronHelper.InitBeginState();

            _blockHelper = new BlockHelper(world, view, projection, _octahedronHelper);
            _blockHelper.InitBeginState(_block, _startBlock);

            _ballHelper = new BallHelper(world, view, projection);
            _ballHelper.InitBeginState(_ball, new Vector3(0, 2.333f, 0));

            ReadBestResult();
        }