Example #1
0
        /** Create a new sparkle group */
        public void CreateSparkles(float[] Position, float[] Velocity)
        {
            var factory = new SparkFactory() {
            Source = new float[2] { Position[0], Position[1] },
            Lifespan = 0.5f,
            LifespanVar = 0.1f,
            Count = _realRate,
            CountVar = _realRate / 2,
            Tint = new float[4] { 1.0f, 1.0f, 1.0f, 1.0f }
              };

              factory.VelocityVar [2] = nRand.Float(0f, 50f);

              factory.Velocity [0] = Velocity [0] * 0.5f;
              factory.Velocity [1] = Velocity [1] * 0.5f;
              factory.VelocityVar [0] = Math.Sign(factory.Velocity [0]) * 3f;
              factory.VelocityVar [1] = Math.Sign(factory.Velocity [1]) * 3f;
              factory.Tint = new float[4] { 1.0f, 1.0f, 0.0f, 1.0f };

              var items = factory.Manufacture();
              foreach (var i in items) {
            var m = new nMotion(i, new RainbowSparkAnim());
            Sparkles.Add(m);
              }
        }
Example #2
0
        /** Create a new sparkle group */
        public void CreateSparkles(float[] Position, float[] Velocity, SparkleType type)
        {
            var factory = new SparkFactory() {
            Source = new float[2] { Position[0], Position[1] },
            Velocity = new float[3] { Velocity[0], Math.Sign(Velocity[1]) * 10f, 0f },
            Lifespan = 1.0f,
            LifespanVar = 0.5f,
            Count = 10,
            CountVar = 2,
            Tint = new float[4] { 1.0f, 1.0f, 1.0f, 1.0f }
              };

              /* Custom per type */
              factory.VelocityVar [2] = nRand.Float(0f, 50f);
              if (type == SparkleType.SPARKLE_WALL) {
            factory.Velocity [1] = 0;
            factory.Velocity [0] = Math.Sign(Velocity [0]) * 10f;
            factory.VelocityVar [0] = 20f;
            factory.VelocityVar [1] = 30f;
            factory.Tint = new float[4] { 0.5f, 0.5f, 1.0f, 1.0f };
              } else {
            factory.Velocity [0] = Velocity [0];
            factory.Velocity [1] = Math.Sign(Velocity [1]) * 10f;
            factory.VelocityVar [0] = 20f;
            factory.VelocityVar [1] = 30f;
            factory.Tint = new float[4] { 1.0f, 1.0f, 0.5f, 1.0f };
              }

              var items = factory.Manufacture();
              foreach (var i in items) {
            var m = new nMotion(i, new SparkAnim());
            _sparkles.Add(m);
              }
        }