コード例 #1
0
 public static void AddSparksEffect(
     Vector2 location,
     Vector2 impactVelocity)
 {
     int particleCount = rand.Next(10, 20);
     for (int x = 0; x < particleCount; x++)
     {
         Particle particle = new Particle(
             location - (impactVelocity / 60),
             Texture,
             ParticleFrame,
             randomDirection((float)rand.Next(10, 20)),
             Vector2.Zero,
             60,
             20,
             Color.Yellow,
             Color.Orange);
         Effects.Add(particle);
     }
 }
コード例 #2
0
        private static void AddShot(
            Vector2 location,
            Vector2 velocity,
            int frame)
        {
            Particle shot = new Particle(
                location,
                Texture,
                shotRectangle,
                velocity,
                Vector2.Zero,
                400f,
                120,
                Color.White,
                Color.White);

            shot.AddFrame(new Rectangle(
                shotRectangle.X + shotRectangle.Width,
                shotRectangle.Y,
                shotRectangle.Width,
                shotRectangle.Height));

            shot.Animate = false;
            shot.Frame = frame;
            shot.RotateTo(velocity);
            Shots.Add(shot);
        }