1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using Microsoft.Xna.Framework; |
---|
5 | using Microsoft.Xna.Framework.Audio; |
---|
6 | using Microsoft.Xna.Framework.Content; |
---|
7 | using Microsoft.Xna.Framework.GamerServices; |
---|
8 | using Microsoft.Xna.Framework.Graphics; |
---|
9 | using Microsoft.Xna.Framework.Input; |
---|
10 | using Microsoft.Xna.Framework.Media; |
---|
11 | |
---|
12 | namespace WindowsGame1 |
---|
13 | { |
---|
14 | public class Map |
---|
15 | { |
---|
16 | //Lataa pelimapin sisäänsä |
---|
17 | public Vector2 Size; |
---|
18 | public Tile[,] Tiles; |
---|
19 | public List<MapObject> Objects = new List<MapObject>(); |
---|
20 | Texture2D texture; |
---|
21 | uint[] colorMap; |
---|
22 | Dictionary<uint, int> levelBuildDict = new Dictionary<uint, int>(); |
---|
23 | public Map(Texture2D texture/*DEBUG DEBUG*/, int w, int h) |
---|
24 | { |
---|
25 | this.Size = new Vector2(w, h); |
---|
26 | this.colorMap = new uint[texture.Width * texture.Height]; |
---|
27 | |
---|
28 | this.texture = texture;//DEBUG |
---|
29 | |
---|
30 | this.Tiles = new Tile[w,h]; |
---|
31 | |
---|
32 | texture.GetData(colorMap); |
---|
33 | buildMap(); |
---|
34 | } |
---|
35 | void buildMap() |
---|
36 | { |
---|
37 | for (var x = 0; x < Size.X; x++) { |
---|
38 | for (var y = 0; y < Size.Y; y++) { |
---|
39 | Tiles[x,y] = new Tile("testitile");//jotain shittiä myöhemmin |
---|
40 | if (Pikseli.Instance.random.NextDouble()<0.1) |
---|
41 | Objects.Add(new MapObject("testipuu", x, y)); |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | } |
---|
47 | } |
---|
48 | } |
---|