public bool GetItem3D(string name, out Mesh Mesh, out Material[] Materials) { Mesh = new Mesh(); Materials = new Material[0]; if (!isReady) { return(false); } byte[] data; if (!name.Contains("ITEMS3D")) { data = dataFileReader.GetFile(Path.Combine("ITEMS3D", name)); } else { data = dataFileReader.GetFile(name); } if (data.Length == 0) { Wizardry8Unity.LogMessage(string.Format("Unknown Item '{0}'.", name), true); } var file = new ItemsFile(data, System.IO.Path.GetFileNameWithoutExtension(name)); Mesh = file.ItemMesh; Materials = file.ItemMaterials; return(true); }
// Use this for initialization void Start() { var slf = new SLFFile(@"W8\Data\DATA.SLF"); var itemstr = @"ITEMS3D\BOOKFOUR.ITM"; var data = slf.GetFile(itemstr); // var file2 = new ItemsFile(@"W8\Data\ITEMS3D\JACKHAMMER.ITM"); var file = new ItemsFile(data, System.IO.Path.GetFileNameWithoutExtension(itemstr)); var go = new GameObject(); go.name = file.Name; var meshfilter = go.AddComponent <MeshFilter>(); meshfilter.sharedMesh = file.ItemMesh; var meshRend = go.AddComponent <MeshRenderer>(); meshRend.sharedMaterial = file.ItemMaterials[0]; meshRend.materials = file.ItemMaterials; }