public void LoadHouse(HouseData data) { _FloorList = new List <FloorComponent>(); _FloorLookup = new FloorComponent[2, data.Size, data.Size]; foreach (var floor in data.World.Floors) { var floorComponent = new FloorComponent() { Position = new Microsoft.Xna.Framework.Point(floor.X, floor.Y), Level = floor.Level, FloorStyle = floor.Value }; _FloorLookup[floor.Level, floor.X, floor.Y] = floorComponent; _FloorList.Add(floorComponent); } _WallList = new List <WallComponent>(); _WallLookup = new WallComponent[2, data.Size, data.Size]; foreach (var wall in data.World.Walls) { var wallComponent = new WallComponent(wall) { Position = new Microsoft.Xna.Framework.Point(wall.X, wall.Y), Level = wall.Level }; _WallList.Add(wallComponent); _WallLookup[wall.Level, wall.X, wall.Y] = wallComponent; } }
public void LoadHouse(HouseData data) { _FloorList = new List<FloorComponent>(); _FloorLookup = new FloorComponent[2, data.Size, data.Size]; foreach (var floor in data.World.Floors){ var floorComponent = new FloorComponent() { Position = new Microsoft.Xna.Framework.Point(floor.X, floor.Y), Level = floor.Level, FloorStyle = floor.Value }; _FloorLookup[floor.Level, floor.X, floor.Y] = floorComponent; _FloorList.Add(floorComponent); } _WallList = new List<WallComponent>(); _WallLookup = new WallComponent[2, data.Size, data.Size]; foreach (var wall in data.World.Walls) { var wallComponent = new WallComponent(wall) { Position = new Microsoft.Xna.Framework.Point(wall.X, wall.Y), Level = wall.Level }; _WallList.Add(wallComponent); _WallLookup[wall.Level, wall.X, wall.Y] = wallComponent; } }
public void SetModel(HouseData house) { this.House = house; StaticLayer = new List<House2DComponent>(); //StaticLayer.Add(new TerrainComponent()); foreach (var floor in house.World.Floors.Where(x => x.Level == 0)) { StaticLayer.Add(new FloorComponent { Position = new Microsoft.Xna.Framework.Point(floor.X, floor.Y) }); } foreach (var wall in house.World.Walls.Where(x => x.Level == 0)) { StaticLayer.Add(new WallComponent (wall){ Position = new Microsoft.Xna.Framework.Point(wall.X, wall.Y) }); } RenderState = new HouseRenderState(); RenderState.Rotation = HouseRotation.Angle360; RenderState.Size = 64; //RenderState.ScrollOffset = new Microsoft.Xna.Framework.Vector2(32, 32); RenderState.Zoom = HouseZoom.FarZoom; RenderState.Device = GameFacade.GraphicsDevice; /*this.Layers = new LotLevel[2]; for (var i = 0; i < 2; i++) { var layer = new LotLevel(i); layer.Process(house); layer.ProcessGeometry(); Layers[i] = layer; }*/ }
/// <summary> /// Load a house from its definition /// </summary> /// <param name="house"></param> public void LoadHouse(HouseData house) { RenderState.Size = house.Size; /** * Camera should be at the edge of the screen looking onto the * center point of the lot at a 30 degree angle */ /** Size is how many tiles, the last tile has a size too so the actual vertex position is +1) **/ var worldEdge = house.Size + 1.0f; var radius = RenderState.TileToWorld((worldEdge / 2.0f)); var opposite = (float)Math.Cos(MathHelper.ToRadians(30.0f)) * radius; Camera.Position = new Vector3(radius * 2, opposite, radius * 2); Camera.Target = new Vector3(radius, 0.0f, radius); //Camera.Translation = new Vector3(-radius, 0.0f, -radius); Camera.Zoom = 178; /** * Setup the 2D space */ Model = new HouseModel(); Model.LoadHouse(house); Scene2D.LoadHouse(Model); Scene3D.LoadHouse(Model); //Center point of the center most tile ViewCenter = new Vector2((RenderState.Size / 2.0f)+30, (RenderState.Size / 2.0f)+30); }