Ejemplo n.º 1
0
        public override Timeline Copy(AnimationClass.AnimationLayer ActiveLayer)
        {
            ParticleEmitterTimeline NewSpawnAnimatedBitmapEvent = new ParticleEmitterTimeline(ParticleSystem);

            NewSpawnAnimatedBitmapEvent.UpdateFrom(this, ActiveLayer);

            return(NewSpawnAnimatedBitmapEvent);
        }
Ejemplo n.º 2
0
        public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition)
        {
            List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>();

            AnimatedBitmapSpawnerHelper NewSpawner = new AnimatedBitmapSpawnerHelper();

            if (NewSpawner.ShowDialog() == DialogResult.OK)
            {
                string SpriteName = "Animations/Sprites/" + NewSpawner.SpawnViewer.BitmapName;

                Matrix view = Matrix.Identity;

                Matrix Projection      = Matrix.CreateOrthographicOffCenter(0, ActiveLayer.renderTarget.Width, ActiveLayer.renderTarget.Height, 0, 0, 1);
                Matrix HalfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

                Projection = view * (HalfPixelOffset * Projection);

                Particle3DSample.ParticleSettings ParticleSettings = new Particle3DSample.ParticleSettings();
                ParticleSettings.TextureName       = SpriteName;
                ParticleSettings.MaxParticles      = 20000;
                ParticleSettings.MinScale          = new Vector2(1, 1);
                ParticleSettings.DurationInSeconds = 1d;
                ParticleSettings.Gravity           = new Vector2(0, 0);
                ParticleSettings.NumberOfImages    = 1;
                ParticleSettings.BlendState        = BlendState.AlphaBlend;
                ParticleSettings.StartingAlpha     = 0.7f;
                ParticleSettings.EndAlpha          = 0.1f;
                int StripIndex = SpriteName.IndexOf("_strip");
                if (StripIndex > 0)
                {
                    StripIndex += 6;
                    string ImageInformation = SpriteName.Substring(StripIndex);
                    ParticleSettings.NumberOfImages = Convert.ToInt32(ImageInformation);
                }
                ParticleSystem = new Particle3DSample.ParticleSystem(ParticleSettings);
                ParticleSystem.LoadContent(NewSpawner.SpawnViewer.content, GameScreen.GraphicsDevice, Projection);

                ParticleEmitterTimeline NewParticleEmitorTimeline = new ParticleEmitterTimeline(ParticleSystem);

                NewParticleEmitorTimeline.Position   = new Vector2(535, 170);
                NewParticleEmitorTimeline.SpawnFrame = KeyFrame;
                NewParticleEmitorTimeline.DeathFrame = KeyFrame + 10;
                NewParticleEmitorTimeline.IsUsed     = true;//Disable the spawner as we spawn the AnimatedBitmap manually.
                NewParticleEmitorTimeline.Add(
                    KeyFrame, new VisibleAnimationObjectKeyFrame(new Vector2(NewParticleEmitorTimeline.Position.X, NewParticleEmitorTimeline.Position.Y),
                                                                 true, -1));

                ReturnValue.Add(NewParticleEmitorTimeline);
            }
            return(ReturnValue);
        }