Esempio n. 1
0
 private void Destroy(int Index)
 {
     if (ChunkCount > 1)
     {
         FlamingChunk temp = Chunks[Index];
         Chunks[Index]          = Chunks[ChunkCount - 1];
         Chunks[ChunkCount - 1] = temp;
     }
     ChunkCount--;
 }
Esempio n. 2
0
        public override void Update(GameTime gameTime)
        {
            Timer += gameTime.ElapsedGameTime.Milliseconds;

            for (int i = 0; i < ChunkCount; i++)
            {
                FlamingChunk c = Chunks[i];
                if (Timer < c.StartTime + FlamingChunk.LifeTime)
                {
                    ParticleManager.CreateParticle(c.GlowPosition, Vector3.Zero,
                                                   new Color(Logic.RLerp(c.MinColor, c.MaxColor)),
                                                   c.Size * c.GlowSizeMult * (1 - (Timer - c.StartTime) / (float)FlamingChunk.LifeTime), 1);
                }
            }

            AlternatingControll = !AlternatingControll;
            if (!AlternatingControll)
            {
                return;
            }

            while (ChunkCount > 0 && Timer > Chunks[0].StartTime + FlamingChunk.LifeTime)
            {
                Destroy(0);
            }

            if (Timer > 300000)
            {
                Timer         = 0;
                PreviousTimer = 0;
                ChunkCount    = 0;
            }
            else
            {
                if (ChunkCount > 0)
                {
                    for (int i = 0; i < ChunkCount; i++)
                    {
                        Chunks[i].Update(Timer, PreviousTimer);
                    }

                    PreviousTimer = Timer;
                }
                else
                {
                    Timer         = 0;
                    PreviousTimer = 0;
                }
            }
        }
Esempio n. 3
0
        public FlamingChunkSystem(int MaxChunks)
        {
            self           = this;
            this.MaxChunks = MaxChunks;

            Chunks = new FlamingChunk[MaxChunks];
            for (int i = 0; i < MaxChunks; i++)
            {
                Chunks[i] = new FlamingChunk();
            }

            ChunkModel = AssetManager.Load <Model>("Models/ShipGame/World/Chunk");

            ChunkEffect               = AssetManager.LoadEffect("Effects/Tex");
            WorldParam                = ChunkEffect.Parameters["World"];
            ViewParam                 = ChunkEffect.Parameters["View"];
            ProjectionParam           = ChunkEffect.Parameters["Projection"];
            ForwardInstancedTechnique = ChunkEffect.Techniques["ForwardInstancedTechnique"];

            ChunkTexture = AssetManager.Load <Texture2D>("Textures/ShipGame/World/ChunkSurface_Color");
        }