public void CreatePartition(int X, int Y, MapInstance Map, TerrainMaterialManager MatManager) { TerrainTileSet tile_set = MatManager.GetTerrainSet(Map.map.terrainName); // Create terrain partition terrainPartition = new ja2.TerrainPartition(); Mesh mesh = terrainPartition.Create(X, Y, Map.map, tile_set); // Add needed components GetComponent<MeshFilter>().mesh = mesh; GetComponent<MeshCollider>().sharedMesh = mesh; var mesh_renderer = gameObject.GetComponent<MeshRenderer>(); // Set map material mesh_renderer.sharedMaterial = Resources.LoadAssetAtPath("Assets/Materials/" + tile_set.materialName + ".mat", typeof(Material)) as Material; // Don't cast shadows mesh_renderer.castShadows = false; }
public void CreatePartition(int X, int Y, MapInstance Map, TerrainMaterialManager MatManager) { TerrainTileSet tile_set = MatManager.GetTerrainSet(Map.map.terrainName); // Create terrain partition terrainPartition = new ja2.TerrainPartition(); Mesh mesh = terrainPartition.Create(X, Y, Map.map, tile_set); // Add needed components GetComponent <MeshFilter>().mesh = mesh; GetComponent <MeshCollider>().sharedMesh = mesh; var mesh_renderer = gameObject.GetComponent <MeshRenderer>(); // Set map material mesh_renderer.sharedMaterial = Resources.LoadAssetAtPath("Assets/Materials/" + tile_set.materialName + ".mat", typeof(Material)) as Material; // Don't cast shadows mesh_renderer.castShadows = false; }