本文整理汇总了C#中IEditor.InstantiatePrefab方法的典型用法代码示例。如果您正苦于以下问题:C# IEditor.InstantiatePrefab方法的具体用法?C# IEditor.InstantiatePrefab怎么用?C# IEditor.InstantiatePrefab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditor
的用法示例。
在下文中一共展示了IEditor.InstantiatePrefab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadXml
//! Load xml.
public void LoadXml(XmlReader Reader, IEditor AssetDatabase)
{
m_PositionX = int.Parse(Reader.GetAttribute("position_x"));
m_PositionY = int.Parse(Reader.GetAttribute("position_y"));
m_Tiles = new TerrainTile[PARTITION_WIDTH * PARTITION_HEIGHT];
int i = 0;
Reader.ReadToDescendant("tile");
do
{
byte[] v_types = new byte[]
{
byte.Parse(Reader.GetAttribute("type_0")),
byte.Parse(Reader.GetAttribute("type_1")),
byte.Parse(Reader.GetAttribute("type_2")),
byte.Parse(Reader.GetAttribute("type_3"))
};
var tile = new TerrainTile(int.Parse(Reader.GetAttribute("x")), int.Parse(Reader.GetAttribute("y")), (TerrainTile.Type)int.Parse(Reader.GetAttribute("type")), byte.Parse(Reader.GetAttribute("variant")));
tile.SetTerrainType(TerrainTile.Vertex.NORTH, v_types[0]);
tile.SetTerrainType(TerrainTile.Vertex.WEST, v_types[1]);
tile.SetTerrainType(TerrainTile.Vertex.SOUTH, v_types[2]);
tile.SetTerrainType(TerrainTile.Vertex.EAST, v_types[3]);
m_Tiles[i++] = tile;
} while (Reader.ReadToNextSibling("tile"));
var mesh_renderer = GetComponent<MeshRenderer>();
m_Properties = new Dictionary<ushort, he.TerrainTileProperty>();
Reader.ReadToFollowing("property_list");
if (Reader.ReadToDescendant("item"))
{
do
{
var tile_property = new TerrainTileProperty();
tile_property.nonMoveable = new NonMoveableObjectHandle(Reader.GetAttribute("nonmoveable"));
m_Properties[ushort.Parse(Reader.GetAttribute("index"))] = tile_property;
} while (Reader.ReadToNextSibling("item"));
}
Reader.ReadToFollowing("nonmoveable_list");
if (Reader.ReadToDescendant("item"))
{
do
{
ushort tile_index = ushort.Parse(Reader.GetAttribute("tile"));
GameObject non_moveable_go = AssetDatabase.InstantiatePrefab(Resources.LoadAssetAtPath(Reader.GetAttribute("prefab"), typeof(GameObject))) as GameObject;
var comp = non_moveable_go.GetComponent<NonMoveableObjectComponent>();
comp.LoadXml(Reader, AssetDatabase);
TerrainTile tile = m_Tiles[tile_index];
AssociateNonMoveable(tile.x, tile.y, comp);
} while (Reader.ReadToNextSibling("item"));
}
}