public PastureView(HexaModel model, int x, int y) : base(model, x, y) { translateM = new Matrix[MAX_SHEEP]; scaleM = new Matrix[MAX_SHEEP]; objectMatrix = new Matrix[MAX_SHEEP]; colorT = new Vector3[MAX_SHEEP]; if (rnd == null) rnd = new Random(); for (int loop1 = 0; loop1 < 6; loop1++) { for (int loop2 = 0; loop2 < 4; loop2++) { float shade = (float)rnd.NextDouble() / 10.0f; colorT[loop2 + 4 * loop1] = new Vector3(shade, shade, shade); scaleM[loop2 + 4 * loop1] = Matrix.CreateScale((float)(0.00065 - 0.00002 + 0.00004 * rnd.NextDouble())); objectMatrix[loop2 + 4 * loop1] = scaleM[loop2 + 4 * loop1] * Matrix.CreateTranslation(new Vector3((float)(rnd.NextDouble() - 0.5) / 8.0f + 0.05f, 0, (float)(rnd.NextDouble() - 0.5) / 8.0f + 0.05f)) * Matrix.CreateRotationY((float)(Math.PI / 3.0 * ((6 - loop1) + 0.5 + 2) + Math.PI / 3.0 * rnd.NextDouble())); } } }
public ForestView(HexaModel model, int x, int y) : base(model, x, y) { translateM = new Matrix[MAX_TREE]; scaleM = new Matrix[MAX_TREE]; objectMatrix = new Matrix[MAX_TREE]; colorT = new Vector3[MAX_TREE]; if(rnd == null) rnd = new Random(); for (int loop1 = 0; loop1 < 6; loop1++) { for (int loop2 = 0; loop2 < 8; loop2++) { colorT[loop2 + 8 * loop1] = new Vector3(0.0f, (float)rnd.NextDouble() / 2.0f, 0.0f); //translateM[loop1] = Matrix.CreateTranslation(new Vector3((float) (rnd.NextDouble() - 0.5) / 2.0f, 0, (float) (rnd.NextDouble() - 0.5) / 2.0f)); scaleM[loop2 + 8 * loop1] = Matrix.CreateScale((float)(0.001 - 0.0002 + 0.0004 * rnd.NextDouble())); //objectMatrix[loop1] = scaleM[loop1] * translateM[loop1]; objectMatrix[loop2 + 8 * loop1] = scaleM[loop2 + 8 * loop1] * Matrix.CreateTranslation(new Vector3((float)(rnd.NextDouble() - 0.5) / 6.0f + 0.17f, 0, 0)) * Matrix.CreateRotationY((float)(Math.PI / 3.0 * ((6 - loop1) + 0.5 + 2) + Math.PI / 3.0 * rnd.NextDouble())); } } }
public DesertView(HexaModel model, int x, int y) : base(model, x, y) { }
public CornfieldView(HexaModel model, int x, int y) : base(model, x, y) { }
public StoneView(HexaModel model, int x, int y) : base(model, x, y) { }
public WaterView(HexaModel model, Texture2D waterTexture, Matrix rotation, int x, int y) : base(model, x, y) { this.waterTexture = waterTexture; this.rotation = rotation; }
private void CreateTownsAndRoads() { HexaModel[] neighboursModel = new HexaModel[6]; HexaView[] neighboursView = new HexaView[6]; HexaView[][] hexaMapView = mapView.GetHexaMapView(); for (int i = 0; i < hexaMapModel.Length; ++i) { for (int j = 0; j < hexaMapModel[i].Length; ++j) { if (hexaMapModel[i][j] == null) continue; hexaMapModel[i][j].SetCoord(i, j); // UP LEFT if (i >= 1 && hexaMapModel[i - 1].Length > j) { neighboursModel[(int)RoadPos.UpLeft] = hexaMapModel[i - 1][j]; neighboursView[(int)RoadPos.UpLeft] = hexaMapView[i - 1][j]; } else { neighboursModel[(int)RoadPos.UpLeft] = null; neighboursView[(int)RoadPos.UpLeft] = null; } // UP RIGHT if (i >= 1 && j > 0 && hexaMapModel[i - 1].Length > j - 1) { neighboursModel[(int)RoadPos.UpRight] = hexaMapModel[i - 1][j - 1]; neighboursView[(int)RoadPos.UpRight] = hexaMapView[i - 1][j - 1]; } else { neighboursModel[(int)RoadPos.UpRight] = null; neighboursView[(int)RoadPos.UpRight] = null; } // LEFT if (hexaMapModel[i].Length > j + 1) { neighboursModel[(int)RoadPos.MiddleLeft] = hexaMapModel[i][j + 1]; neighboursView[(int)RoadPos.MiddleLeft] = hexaMapView[i][j + 1]; } else { neighboursModel[(int)RoadPos.MiddleLeft] = null; neighboursView[(int)RoadPos.MiddleLeft] = null; } // RIGHT if (j - 1 >= 0) { neighboursModel[(int)RoadPos.MiddleRight] = hexaMapModel[i][j - 1]; neighboursView[(int)RoadPos.MiddleRight] = hexaMapView[i][j - 1]; } else { neighboursModel[(int)RoadPos.MiddleRight] = null; neighboursView[(int)RoadPos.MiddleRight] = null; } // BOTTOM LEFT if (i + 1 < hexaMapModel.Length && hexaMapModel[i + 1].Length > j + 1) { neighboursModel[(int)RoadPos.BottomLeft] = hexaMapModel[i + 1][j + 1]; neighboursView[(int)RoadPos.BottomLeft] = hexaMapView[i + 1][j + 1]; } else { neighboursModel[(int)RoadPos.BottomLeft] = null; neighboursView[(int)RoadPos.BottomLeft] = null; } // BOTTOM RIGHT if (i + 1 < hexaMapModel.Length && hexaMapModel[i + 1].Length > j) { neighboursModel[(int)RoadPos.BottomRight] = hexaMapModel[i + 1][j]; neighboursView[(int)RoadPos.BottomRight] = hexaMapView[i + 1][j]; } else { neighboursModel[(int)RoadPos.BottomRight] = null; neighboursView[(int)RoadPos.BottomRight] = null; } hexaMapModel[i][j].CreateTownsAndRoads(neighboursModel, hexaMapView[i][j], neighboursView); mapView.GetHexaMapView()[i][j].SetHexaNeighbours(neighboursView); } } }
public MountainsView(HexaModel model, int x, int y) : base(model, x, y) { }