public void Initialize(int vNum, Vector3[] points, Vector2[] texCords) { pointOnEdge = Vector3.Zero; center = Vector3.Zero; foreach (Vector3 vec in points) center += vec; center /= vNum; int iCount = (vNum - 3) * 3 + 3; vertNum = vNum; vertices = new VertexPositionNormalTexture[vNum]; oldLineList = new List<VertexPositionNormalTexture>(); oldLineindices = new List<short>(); lineList = new VertexPositionColor[2]; lineList[0].Color = Color.Orange; lineList[1].Color = Color.Orange; lineIndices = new List<short>(); camera = Game1.camera; device = Game1.device; input = Game1.input; worldMatrix = Matrix.Identity; state = BoardState.chooseEdge1; indices = new short[iCount]; invertIndices = new short[iCount]; for (int i = 0; i < vNum; i++) { vertices[i].Position = points[i]; vertices[i].TextureCoordinate = texCords[i]; vertices[i].Normal = Vector3.Up; } //create the indices. every 2 consecutive points makes an outer edge (x,y,z) -> xy , yz (not xz) short j = 0; for (short i = 0; i < iCount; i += 3) { invertIndices[iCount - (i + 1)] = indices[i] = (short)(j % vNum); invertIndices[iCount - (i + 1) - 1] = indices[i + 1] = (short)((j + 1) % vNum); invertIndices[iCount - (i + 1) - 2] = indices[i + 2] = (short)(((j != 4 ? j : 5) + 2) % vNum); j += 2; } verOnEdge = new VertexPositionColor[6]; verOnEdge[0].Color = Color.Purple; verOnEdge[1].Color = Color.Purple; verOnEdge[2].Color = Color.Purple; verOnEdge[3].Color = Color.Purple; verOnEdge[4].Color = Color.Purple; verOnEdge[5].Color = Color.Purple; p = new DividingVert[2]; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { device = graphics.GraphicsDevice; // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); SpriteFont font = Content.Load<SpriteFont>(@"font"); SpriteFont scoreFont = Content.Load<SpriteFont>("scoreFont"); HoleManager holeManager = new HoleManager(Content.Load<Texture2D>("hole2"), Content.Load<Effect>("effects")); AcidManager acidManager = new AcidManager(Content.Load<Texture2D>("acid"), Content.Load<Effect>("effects")); PlayerManager playerManager = new PlayerManager(Content.Load<Texture2D>("gum"), Content.Load<Effect>("effects"), Content.Load<Texture2D>("dupGum"), Content.Load<Texture2D>("staticGum")); PowerUpManager powerupManager = new PowerUpManager(Content.Load<Texture2D>("inkspot"), Content.Load<Effect>("effects")); Board board = new Board(Content.Load<Texture2D>("paper"), Content.Load<Effect>("effects")); Table table = new Table(Content.Load<Model>("Table")); camera = new Camera(this); input = new InputHandler(this); ourGame = new GameManager(font, scoreFont, holeManager, acidManager, playerManager, powerupManager, board,table, Content.Load<Texture2D>("startScreen"), Content.Load<Texture2D>("help"), Content.Load<Texture2D>("levelsScreen")); ourGame.loadCurrLevel(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { base.Initialize(); input = Game1.input; InitializeCamera(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { device = graphics.GraphicsDevice; // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); SpriteFont font = Content.Load<SpriteFont>("font"); SpriteFont scoreFont = Content.Load<SpriteFont>("scoreFont"); HoleManager holeManager = new HoleManager(Content.Load<Texture2D>("hole2"), Content.Load<Effect>("effects")); PlayerManager playerManager = new PlayerManager(Content.Load<Texture2D>("gummy2"), Content.Load<Effect>("effects")); PowerUpManager powerupManager = new PowerUpManager(Content.Load<Texture2D>("inkspot"), Content.Load<Effect>("effects")); Board board = new Board(Content.Load<Texture2D>("paper"), Content.Load<Effect>("effects")); camera = new Camera(this); input = new InputHandler(this); ourGame = new GameManager(font, scoreFont, holeManager, playerManager, powerupManager,board); ourGame.loadCurrLevel(); }