本文整理汇总了C#中SceneObject.Instantiate方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObject.Instantiate方法的具体用法?C# SceneObject.Instantiate怎么用?C# SceneObject.Instantiate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SceneObject
的用法示例。
在下文中一共展示了SceneObject.Instantiate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: create
//.........这里部分代码省略.........
pos.y = float.Parse(gameobjectpos.SelectSingleNode("y").InnerText);
pos.z = float.Parse(gameobjectpos.SelectSingleNode("z").InnerText);
rot.x = float.Parse(gameobjectrot.SelectSingleNode("x").InnerText);
rot.y = float.Parse(gameobjectrot.SelectSingleNode("y").InnerText);
rot.z = float.Parse(gameobjectrot.SelectSingleNode("z").InnerText);
sca.x = float.Parse(gameobjectsca.SelectSingleNode("x").InnerText);
sca.y = float.Parse(gameobjectsca.SelectSingleNode("y").InnerText);
sca.z = float.Parse(gameobjectsca.SelectSingleNode("z").InnerText);
Asset newasset = findAsset(assetsource, true, layer);
SceneObject obj = new SceneObject();
newasset.loadPri = loadPri;
if(layer != "")
newasset.layerName = layer;
switch(loadLevel)
{
case 1:
newasset.loadLevel = Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE;
break;
case 2:
newasset.loadLevel = Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER;
break;
case 3:
newasset.loadLevel = Asset.LOAD_LEVEL.LEVEL_SCRIPT_DYNAMIC;
break;
default:
newasset.loadLevel = Asset.LOAD_LEVEL.LEVEL_IDLE;
break;
};
switch(unloadLevel)
{
case 1:
newasset.unloadLevel = Asset.UNLOAD_LEVEL.LEVEL_FORBID;
break;
case 2:
newasset.unloadLevel = Asset.UNLOAD_LEVEL.LEVEL_FORBID_GAMEOBJECT;
break;
default:
newasset.unloadLevel = Asset.UNLOAD_LEVEL.LEVEL_NORMAL;
break;
};
obj.name = objname;
obj.position = pos;
obj.eulerAngles = rot;
obj.scale = sca;
obj.idkey = key;
obj.asset = newasset;
newasset.refs.Add(key);
if(newasset.bundle != null)
{
obj.Instantiate();
newasset.refs.Remove(key);
}
objs.Add(key, obj);
}
for(int i=0; i<arrkeys.Count; i++)
{
Asset asset = assetsCache[arrkeys[i]];
if(asset.unloadLevel == Asset.UNLOAD_LEVEL.LEVEL_FORBID ||
asset.unloadLevel == Asset.UNLOAD_LEVEL.LEVEL_FORBID_GAMEOBJECT)
{
Common.DEBUG_MSG("assetBundle(" + asset.source + ") is persisted!");
continue;
}
if(asset.createAtScene == name)
continue;
if(asset.bundle != null)
{
asset.bundle.Unload(true);
Common.DEBUG_MSG("unload assetBundle(" + asset.source + ") successfully!");
}
else
{
Common.DEBUG_MSG("remove assetBundle(" + asset.source + ") successfully!");
}
assetsCache.Remove(arrkeys[i]);
}
Common.DEBUG_MSG("create scene(" + name + ") successfully, start loading...");
foreach(KeyValuePair<string, Asset> e in Scene.assetsCache)
{
loader_.loadPool.addLoad(e.Value);
}
loader_.loadPool.start();
return true;
}