Beispiel #1
0
 public Heart(BOIC game, Vector2 position, Texture2D texture)
 {
     this.game     = game;
     this.position = position;
     this.texture  = texture;
     this.srcRect  = new Rectangle(0, 0, texture.Width, texture.Height);
 }
Beispiel #2
0
        public Door(BOIC game, RectangleF displayShape, Direction direction)
        {
            this.game      = game;
            this.direction = direction;
            Bounds         = new RectangleF(new Point2(displayShape.X - (displayShape.Width / 2), displayShape.Y - (displayShape.Height / 2)), new Size2(displayShape.Width, displayShape.Height));

            _particleTexture = new Texture2D(game.GraphicsDevice, 1, 1);
            _particleTexture.SetData(new[] { Color.White });

            TextureRegion2D textureRegion = new TextureRegion2D(_particleTexture);

            _particleEffect = new ParticleEffect(autoTrigger: false)
            {
                Position = displayShape.Position,
                Emitters = new List <ParticleEmitter>
                {
                    new ParticleEmitter(textureRegion, 500, TimeSpan.FromSeconds(2.5),
                                        Profile.BoxUniform(displayShape.Width, displayShape.Height))
                    {
                        Parameters = new ParticleReleaseParameters
                        {
                            Speed    = new Range <float>(0f, 75f),
                            Quantity = 3,
                            Rotation = new Range <float>(-1f, 1f),
                            Scale    = new Range <float>(3.0f, 4.0f)
                        },
                        Modifiers =
                        {
                            new RotationModifier           {
                                RotationRate = -2.1f
                            },
                            new RectangleContainerModifier {
                                Width = (int)displayShape.Width, Height = (int)displayShape.Height, RestitutionCoefficient = 0.1f
                            },
                            new LinearGravityModifier      {
                                Direction = -Vector2.UnitY, Strength = 30f
                            },
                        }
                    }
                }
            };
        }