public BlockHelper(Matrix world, Matrix view, Matrix projection, OctahedronHelper octahedronHelper) { _world = world; _view = view; _projection = projection; _octahedronHelper = octahedronHelper; }
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); } } }
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(); }