コード例 #1
0
        public YnEmitter(Vector2 position, Vector2 direction, float angle, int maxParticles)
        {
            _maxParticles          = maxParticles;
            _rotation              = angle;
            _direction             = direction;
            _position              = position;
            _particles             = new List <YnParticle>(_maxParticles);
            _elapsedTime           = 0;
            _intensity             = 100;
            _activeParticleIndex   = 0;
            _nbParticlePerEmission = 3;
            _repeat     = true;
            _canRestart = false;
            Active      = false;

            _particleConfiguration = new ParticleConfiguration()
            {
                EnabledRotation   = false,
                Height            = 4,
                Width             = 4,
                LifeTime          = 400,
                Speed             = 8.5f,
                RotationIncrement = 0
            };
        }
コード例 #2
0
ファイル: YnParticle.cs プロジェクト: shaoleibo/YnaEngine
 /// <summary>
 /// Sets the configuration to use for the particle.
 /// </summary>
 /// <param name="configuration">Particle configuration.</param>
 public void SetConfiguration(ParticleConfiguration configuration)
 {
     _speed = configuration.Speed;
     _enableRotation = configuration.EnabledRotation;
     _rotationIncrement = configuration.RotationIncrement;
     _rectangle.Width = configuration.Width;
     _rectangle.Height = configuration.Height;
     _lifeTime = configuration.LifeTime;
 }
コード例 #3
0
 /// <summary>
 /// Sets the configuration to use for the particle.
 /// </summary>
 /// <param name="configuration">Particle configuration.</param>
 public void SetConfiguration(ParticleConfiguration configuration)
 {
     _speed             = configuration.Speed;
     _enableRotation    = configuration.EnabledRotation;
     _rotationIncrement = configuration.RotationIncrement;
     _rectangle.Width   = configuration.Width;
     _rectangle.Height  = configuration.Height;
     _lifeTime          = configuration.LifeTime;
 }
コード例 #4
0
        /// <summary>
        /// Sets the configuration used for particles.
        /// </summary>
        /// <param name="configuration">Particle configuration.</param>
        /// <returns>True if the particles are already initialized otherwise return false.</returns>
        public bool SetParticleConfiguration(ParticleConfiguration configuration)
        {
            _particleConfiguration = configuration;

            if (_particles.Count > 0)
            {
                foreach (YnParticle particle in _particles)
                {
                    particle.SetConfiguration(_particleConfiguration);
                }

                return(true);
            }

            return(false);
        }
コード例 #5
0
ファイル: YnEmitter.cs プロジェクト: shaoleibo/YnaEngine
        public YnEmitter(Vector2 position, Vector2 direction, float angle, int maxParticles)
        {
            _maxParticles = maxParticles;
            _rotation = angle;
            _direction = direction;
            _position = position;
            _particles = new List<YnParticle>(_maxParticles);
            _elapsedTime = 0;
            _intensity = 100;
            _activeParticleIndex = 0;
            _nbParticlePerEmission = 3;
            _repeat = true;
            _canRestart = false;
            Active = false;

            _particleConfiguration = new ParticleConfiguration()
            {
                EnabledRotation = false,
                Height = 4,
                Width = 4,
                LifeTime = 400,
                Speed = 8.5f,
                RotationIncrement = 0
            };
        }
コード例 #6
0
ファイル: YnEmitter.cs プロジェクト: shaoleibo/YnaEngine
        /// <summary>
        /// Sets the configuration used for particles.
        /// </summary>
        /// <param name="configuration">Particle configuration.</param>
        /// <returns>True if the particles are already initialized otherwise return false.</returns>
        public bool SetParticleConfiguration(ParticleConfiguration configuration)
        {
            _particleConfiguration = configuration;

            if (_particles.Count > 0)
            {
                foreach (YnParticle particle in _particles)
                    particle.SetConfiguration(_particleConfiguration);

                return true;
            }

            return false;
        }