Beispiel #1
0
        public override void Update()
        {
            for (int i = 0; i < dots.Count; ++i)
            {
                if (!dots[i].alive)
                {
                    dots.Remove(dots[i]);
                }
            }

            while (prevLength > dots.Count)
            {
                TankGame.RemoveMeshFromRenderStack(meshes[meshes.Count - 1]);
                meshes.Remove(meshes[meshes.Count - 1]);
                prevLength--;
            }


            if (prevLength == 0)
            {
                Destroy();
                return;
            }

            for (int i = 0; i < dots.Count; ++i)
            {
                dots[i].Update(Time.deltatime);

                meshes[i].offset = dots[i].position;
                meshes[i].RotateVertices(i % 2 == 0 ? -dots[i].velocity.Length * 0.01f : dots[i].velocity.Length * 0.01f, ExtensionMethods.GetPolyCenter(meshes[i].vertices));

                //Move current color towards 0
                meshes[i].color = ExtensionMethods.Lerp(Vector3.Zero, startColor, (dots[i].killTime - Time.time) / dots[i].lifeTime).ToColor();
                meshes[i].Scale(2 * Time.deltatime);
            }
        }