Пример #1
0
        public override void LoadData()
        {
            base.LoadData();

            if (MyDefinitionManager.Static.EnvironmentDefinition == null)
            {
                return;
            }

            var typeList = MyDefinitionManager.Static.EnvironmentDefinition.EnvironmentalParticles;

            foreach (var typeDefinition in typeList)
            {
                MyObjectBuilder_EnvironmentalParticleLogic objectBuilder = MyObjectBuilderSerializer.CreateNewObject(typeDefinition.Id) as MyObjectBuilder_EnvironmentalParticleLogic;
                Debug.Assert(objectBuilder != null);
                if (objectBuilder == null)
                {
                    continue;
                }

                objectBuilder.Density          = typeDefinition.Density;
                objectBuilder.DespawnDistance  = typeDefinition.DespawnDistance;
                objectBuilder.ParticleColor    = typeDefinition.Color;
                objectBuilder.MaxSpawnDistance = typeDefinition.MaxSpawnDistance;
                objectBuilder.Material         = typeDefinition.Material;
                objectBuilder.MaxLifeTime      = typeDefinition.MaxLifeTime;
                objectBuilder.MaxParticles     = typeDefinition.MaxParticles;

                var logic = MyEnvironmentalParticleLogicFactory.CreateEnvironmentalParticleLogic(objectBuilder);
                logic.Init(objectBuilder);
                m_particleHandlers.Add(logic);
            }
        }
Пример #2
0
        public override void Init(MyObjectBuilder_EnvironmentalParticleLogic builder)
        {
            base.Init(builder);

            var objectBuilder = builder as MyObjectBuilder_EnvironmentalParticleLogicSpace;

            if (objectBuilder == null)
            {
                return;
            }
        }
        public virtual void Init(MyObjectBuilder_EnvironmentalParticleLogic builder)
        {
            m_particleDensity         = builder.Density;
            m_particleSpawnDistance   = builder.MaxSpawnDistance;
            m_particleDespawnDistance = builder.DespawnDistance;

            for (int index = 0; index < m_maxParticles; ++index)
            {
                m_nonActiveParticles.Add(new MyEnvironmentalParticle(builder.Material, builder.ParticleColor));
            }
        }
Пример #4
0
        public static MyEnvironmentalParticleLogic CreateEnvironmentalParticleLogic(MyObjectBuilder_EnvironmentalParticleLogic builder)
        {
            var obj = m_objectFactory.CreateInstance(builder.TypeId) as MyEnvironmentalParticleLogic;

            return(obj);
        }