예제 #1
0
파일: Terrain.cs 프로젝트: Trigve/ja2_unity
 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;
 }
예제 #2
0
파일: Terrain.cs 프로젝트: Trigve/ja2_unity
    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;
    }