Пример #1
0
        public override void FTSUpdate(GameTime timeSpent)
        {
            if (_instance == null)
            {
                return;
            }

            if (_instance.ParticuleLastEmit == null)
            {
                _instance.ParticuleLastEmit = new List <DateTime>(_instance.State.PartsStates.Count);
            }

            for (int i = 0; i < _instance.State.PartsStates.Count; i++)
            {
                var partState = _instance.State.PartsStates[i];

                if (partState.Particlules != null && (DateTime.Now - _instance.ParticuleLastEmit[i]).TotalSeconds > partState.Particlules.EmittedParticuleRate)
                {
                    _staticEntityEmitter.EmitParticule(
                        partState.Particlules,
                        new Vector3D(_instance.World.TranslationVector)
                        );
                    _instance.ParticuleLastEmit[i] = DateTime.Now;
                }
            }

            base.FTSUpdate(timeSpent);
        }
Пример #2
0
        //Look inside all Surrending chunks for statis entities that are emitting particules
        private void StaticEntityEmiters()
        {
            if (_worldChunks.Chunks == null)
            {
                return;
            }
            foreach (VisualChunk chunk in _worldChunks.Chunks.Where(x => x.Graphics.IsFrustumCulled == false && x.DistanceFromPlayer < _worldChunks.StaticEntityViewRange && x.State == ChunkState.DisplayInSyncWithMeshes && x.ThreadStatus == S33M3DXEngine.Threading.ThreadsManager.ThreadStatus.Idle))
            {
                foreach (var entityWithMeta in chunk.EmitterStaticEntities)
                {
                    switch (entityWithMeta.Particule.ParticuleType)
                    {
                    case EntityParticuleType.Billboard:
                        if ((DateTime.Now - entityWithMeta.EntityLastEmitTime).TotalSeconds > entityWithMeta.Particule.EmittedParticuleRate)
                        {
                            _staticEntityEmitter.EmitParticule(
                                entityWithMeta.Particule,
                                entityWithMeta.Entity.Position
                                );
                            entityWithMeta.EntityLastEmitTime = DateTime.Now;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
        }