Exemple #1
0
        public void Update(GameTime gameTime, Camera camera)
        {
            billboardEngine.Begin(camera.ViewMatrix);
            billboardEngine.AddBillboard(new Vector3(0.0f, 1.0f, 0.0f), Color.Honeydew, 0.01f);

            particleEffect.Update((float)gameTime.ElapsedGameTime.TotalSeconds, camera.ViewMatrix, Position, Vector3.Zero);
        }
Exemple #2
0
        public void Update(float time, Matrix cameraMatrix, Vector3 position)
        {
            emitParticles(position);

            billboardEngine.Begin(cameraMatrix);

            for (int i = 0; i <= numParticles; i++)
            {
                particles[i].remLifetime -= time;
                if (particles[i].remLifetime < 0.0f)
                {
                    numParticles--;
                    particles[i] = particles[numParticles];
                    i--;
                    continue;
                }

                float interpolation = particles[i].remLifetime / particles[i].totLifetime;
                particles[i].position += (previousPosition == Vector3.Zero? Vector3.Zero:(position - previousPosition)) + particles[i].velocity * time;
                Color color = Color.Lerp(particles[i].endColor, particles[i].startColor, interpolation);
                float size  = MathHelper.Lerp(particles[i].endsize, particles[i].startsize, interpolation);
                billboardEngine.AddBillboard(particles[i].position, color, size);
            }

            previousPosition = position;
        }
Exemple #3
0
        public void update(GameTime gameTime, BulletCollection bullets, Camera camera, Player p, Mission m)
        {
            //TODO

            clearMoveData();

            //Initialize BillboardEngine
            billboardEngine.Begin(camera.ViewMatrix);
            billboardEngine.AddBillboard(new Vector3(0.0f, 1.0f, 0.0f), Color.Transparent, 0.01f);

            for (int i = 0; i < Constants.CAP_NPCS; ++i)
            {
                NPC n = _content[i];

                if (!n.active)
                {
                    continue;
                }

                try
                {
                    bool k = n.update(gameTime, bullets, camera, p, m);
                    if (k)
                    {
                        float nx = n.position.X;
                        float nz = n.position.Z;
                        float tx = n.target.X;
                        float tz = n.target.Z;
                        int   TX = (int)Math.Round((-1 * tx + world.size - 1));
                        int   TZ = (int)Math.Round((-1 * tz + world.size - 1));
                        moveData[TX][TZ] = 255;

                        int X = (int)Math.Round((-1 * nx + world.size - 1));
                        int Z = (int)Math.Round((-1 * nz + world.size - 1));

                        if (n.kind == Constants.NPC_BOSS)
                        {
                            moveData[X][Z] = (byte)(i + 1);
                            for (int j = -1; j < 2; ++j)
                            {
                                for (int l = -1; l < 2; ++l)
                                {
                                    if (moveData[X + j][Z + l] == 0)
                                    {
                                        moveData[X + j][Z + l] = (byte)(i + 1);
                                    }
                                }
                            }
                        }
                        else
                        {
                            moveData[X][Z] = (byte)(i + 1);
                        }
                    }
                }
                catch (IndexOutOfRangeException)
                {
                    n.active = false;
                }
            }
        }