标签:配置 enter c# rri efi horizon 找对象 需要 val
skyline的粒子效果是有一堆复杂的xml配置而成,代码创建的时候需要根据xml来生成对象,鉴于xml格式官方并没详细提供,可以先用terraexplorer手动创建一个粒子效果对象,再用代码去找到这个对象,获取对象中的xml文件信息,具体的代码如下(C#版本)://查找对象 string _itemid = _sgworld.ProjectTree.FindItem(@"粒子效果\效果"); if (!string.IsNullOrEmpty(_itemid)) { //找到转换对象 var _teObj = _sgworld.ProjectTree.GetObject(_itemid); ITerrainEffect70 _teffect = _teObj as ITerrainEffect70; //获取对象中的xml信息 ITerrainLabel70 _label = _teObj as ITerrainLabel70; string _effectXml = _teffect.EffectXML; //根据文本信息,设置xml中的属性 string _effnew = "$$PARTICLE$$UserDefine: <?xml version='1.0' encoding='UTF-8'?><Particle ID='Custom'><ParticleEmitter ID='ring' NumParticles='355' Texture='smoke.png'><Emitter Rate='157' Shape='One' SpeedShape='One' Scale='0,0,0' Speed='0.04,-0.01,-0.04' /><Cycle Value='1' /><Sort Value='1' /><Render Value='Horizontal' /><Gravity Value='2, 0, 0' /><Force Value='0' OverrideRotation='0' /><Position Value='0, 0, 0' /><Life Value='3.75' /><Speed Value='0.31' /><Color Value='20,255,255,255' /><Size Value='1.2,1.2' /><Drag Value='0' /><Blend Type='' /><Fade FadeIn='0.69' FadeOut='0.78' MaxFade='0.2' /></ParticleEmitter></Particle>"; //创建动态效果 var _pos = _sgworld.Window.CenterPixelToWorld(WorldPointType.WPT_TERRAIN).Position; var _teff1 = _sgworld.Creator.CreateEffect(_sgworld.Creator.CreatePosition(_pos.X, _pos.Y, 100, AltitudeTypeCode.ATC_TERRAIN_RELATIVE), _effnew); }
标签:配置 enter c# rri efi horizon 找对象 需要 val
原文地址:http://blog.51cto.com/speciallst/2069925