public TSKNeuronet(int n, Dictionary <double, List <double[]> > xSet, int m) { M = m; N = n; firstLayer = new FirstLayer(n, xSet); secondLayer = new SecondLayer(m, n); thirdLayer = new ThirdLayer(m, n); fourthLayer = new FourthLayer(); }
//esto puede ser optimizado con el SetTileRotation //Esta verga no furula void PhysicalMap(List <MapTile> MapData) { //Change this so it goes organized by the order of the map because the order is probably not being respected for (int x = 0; x < MapData.Count; x++) { if (MapData[x] != null) { Tile ActualTile = null; Tile OcupyTile = null; bool North = false, East = false, South = false, West = false; bool NorthWest = false, NorthEast = false, SouthEast = false, SouthWest = false; int GrassCloseN = 0, GrassFarN = 0; //The floor switch (MapData[x].Type) { case TileType.Ground: ActualTile = grass_Tiles.Basic[0]; break; case TileType.Water: // Debug.Log("agua"); //select the one that is actually acurate North = false; East = false; South = false; West = false; NorthWest = false; NorthEast = false; SouthEast = false; SouthWest = false; for (int nn = 0; nn < MapData[x].Neighbours.Length; nn++) //foreach (MapTile N in AllMapTiles[x].Neighbours) { if (MapData[x].Neighbours[nn] != null && MapData[x].Neighbours[nn].Type == TileType.Ground) { GrassCloseN++; if (nn == 0) //North { North = true; } if (nn == 2) //South { South = true; } if (nn == 1) //East { East = true; } if (nn == 3) //West { West = true; } } } switch (GrassCloseN) { case 4: ActualTile = water_Tiles.Grass[3]; break; case 3: ActualTile = water_Tiles.Grass[2]; break; case 2: if ((North && South) || (East && West)) { ActualTile = water_Tiles.Grass[4]; } else { ActualTile = water_Tiles.Grass[1]; } break; case 1: // Debug.Log("should"); ActualTile = water_Tiles.Grass[0]; break; default: //Algo esta mal aqui for (int fn = 0; fn < MapData[x].FarNeighbours.Length; fn++) //foreach (MapTile FN in AllMapTiles[x].FarNeighbours) { if (MapData[x].FarNeighbours[fn] != null && MapData[x].FarNeighbours[fn].Type == TileType.Ground) { GrassFarN++; if (fn == 0) // NorthWest { NorthWest = true; } if (fn == 1) // NorthEast { NorthEast = true; } if (fn == 2) // SouthEast { SouthEast = true; } if (fn == 3) // SouthWest { SouthWest = true; } } } break; } if (GrassCloseN == 0) { switch (GrassFarN) { case 4: ActualTile = water_Tiles.Grass[8]; break; case 3: ActualTile = water_Tiles.Grass[7]; break; case 2: if ((NorthWest && SouthEast) || (NorthEast && SouthWest)) { ActualTile = water_Tiles.Grass[9]; } else { ActualTile = water_Tiles.Grass[6]; } break; case 1: ActualTile = water_Tiles.Grass[5]; break; default: ActualTile = water_Tiles.Basic[0]; //basic water always break; } } // ActualTile = water_Tiles.Basic[0]; break; } //Whats on Layer 2 switch (MapData[x].OcupedByMat) { case MaterialTile.None: OcupyTile = null; break; case MaterialTile.Tree: int R = UnityEngine.Random.Range(0, materials.Trees.Length); OcupyTile = materials.Trees[R]; break; case MaterialTile.Wall: OcupyTile = materials.Mountains[0]; break; } // I changed the X and Y and it worked, not sure why tho Map.SetTile(new Vector3Int(MapData[x].X, MapData[x].Y, 0), ActualTile); SetTileRotation(MapData[x].X, MapData[x].Y, GrassCloseN, GrassFarN, North, East, South, West, NorthWest, NorthEast, SouthEast, SouthWest); if (OcupyTile != null) { SecondLayer.SetTile(new Vector3Int(AllMapTiles[x].X, AllMapTiles[x].Y, 0), OcupyTile); } GrassCloseN = 0; GrassFarN = 0; } else { Debug.Log("Ay mama"); MapData.RemoveAt(x); } //create the Grid show thing (I think we dont need this FirstLayer.SetTile(new Vector3Int(MapData[x].X, MapData[x].Y, 0), GridTileShowThing); // Debug.Log("X:" + MapData[0].X + " |Y:" + MapData[0].Y + " / Type:" + MapData[0].Type); } }