Exemplo n.º 1
0
        public static void ShrinkMesh(Mesh m, float multiplier)
        {
            Vector2 center = ExtensionMethods.GetPolyCenter(m.vertices);

            for (int i = 0; i < m.vertices.Length; i++)
            {
                m.vertices[i] = ExtensionMethods.Lerp(m.vertices[i], center, multiplier);
            }
        }
Exemplo n.º 2
0
        public override void Update()
        {
            if (Time.time >= killTime)
            {
                Destroy();
            }

            meshes[0].color = ExtensionMethods.Lerp(Vector3.Zero, startColor, (killTime - Time.time) / lifeTime).ToColor();
        }
Exemplo n.º 3
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);
            }
        }