Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Content;
- using Microsoft.Xna.Framework.Graphics;
- namespace multi.GameUtility.Map.Elements
- {
- class SpawnPoint : IMapElement
- {
- public Vector2 Position { get; set; }
- private Texture2D texture { get; set; }
- private VertexPositionNormalTexture[] vertexCollection {get;set;}
- public SpawnPoint(Vector2 position)
- {
- Position = position;
- }
- public void Draw(GraphicsDevice graphicsDevice, BasicEffect ef)
- {
- ef.TextureEnabled = true;
- ef.Texture = texture;
- ef.EnableDefaultLighting();
- ef.World = Matrix.CreateTranslation(new Vector3(Position.X, 0, Position.Y));
- graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertexCollection, 0, vertexCollection.Count() / 3, VertexPositionNormalTexture.VertexDeclaration);
- ef.World = Matrix.Identity;
- }
- public void Load(ContentManager content)
- {
- texture = content.Load<Texture2D>("MapElements\\SpawnPoint");
- vertexCollection = new VertexPositionNormalTexture[6];
- VertexPositionNormalTexture singleVertex = new VertexPositionNormalTexture();
- singleVertex.Normal = Vector3.Up;
- singleVertex.Position = new Vector3(-1, 0, -1);
- singleVertex.TextureCoordinate = new Vector2(0, 0);
- vertexCollection[0] = singleVertex;
- singleVertex = new VertexPositionNormalTexture();
- singleVertex.Normal = Vector3.Up;
- singleVertex.Position = new Vector3(-1, 0, 1);
- singleVertex.TextureCoordinate = new Vector2(0, 1);
- vertexCollection[1] = singleVertex;
- singleVertex = new VertexPositionNormalTexture();
- singleVertex.Normal = Vector3.Up;
- singleVertex.Position = new Vector3(1, 0, -1);
- singleVertex.TextureCoordinate = new Vector2(1, 0);
- vertexCollection[2] = singleVertex;
- singleVertex = new VertexPositionNormalTexture();
- singleVertex.Normal = Vector3.Up;
- singleVertex.Position = new Vector3(-1, 0, 1);
- singleVertex.TextureCoordinate = new Vector2(0,1);
- vertexCollection[3] = singleVertex;
- singleVertex = new VertexPositionNormalTexture();
- singleVertex.Normal = Vector3.Up;
- singleVertex.Position = new Vector3(1, 0, 1);
- singleVertex.TextureCoordinate = new Vector2(1, 1);
- vertexCollection[4] = singleVertex;
- singleVertex = new VertexPositionNormalTexture();
- singleVertex.Normal = Vector3.Up;
- singleVertex.Position = new Vector3(1, 0, -1);
- singleVertex.TextureCoordinate = new Vector2(1, 0);
- vertexCollection[5] = singleVertex;
- }
- public void Update()
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement