コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParticleSystem" /> class.
        /// </summary>
        public ParticleSystem()
        {
            // Initialize collections
            Plugins = new TrackingCollection <IParticlePlugin>();

            // Add default position field
            Position = new ParticleFieldAccessor <Vector3>(AddField(ParticleFields.Position));
            Angle    = new ParticleFieldAccessor <float>(AddField(ParticleFields.Angle));

            EnsureCapacity(particleDefaultCapacity);

            Plugins.CollectionChanged += Plugins_CollectionChanged;
        }
コード例 #2
0
 /// <summary>
 /// Gets the pointer to the specifield field.
 /// </summary>
 /// <value>
 /// The field pointer, as an <see cref="IntPtr" />.
 /// </value>
 /// <param name="fieldAccessor">The field accessor.</param>
 /// <returns>The field pointer.</returns>
 public                 IntPtr this[ParticleFieldAccessor fieldAccessor]
 {
     get { return(Pointer + fieldAccessor); }
 }
コード例 #3
0
 /// <summary>
 /// Sets the specified field value.
 /// </summary>
 /// <typeparam name="T">The field type.</typeparam>
 /// <param name="fieldAccessor">The field accessor.</param>
 /// <param name="value">The field value.</param>
 public void Set <T>(ParticleFieldAccessor <T> fieldAccessor, T value) where T : struct
 {
     Utilities.Write <T>(Pointer + fieldAccessor, ref value);
 }
コード例 #4
0
 /// <summary>
 /// Gets the specified field value.
 /// </summary>
 /// <typeparam name="T">The field type.</typeparam>
 /// <param name="fieldAccessor">The field accessor.</param>
 /// <returns>The field value.</returns>
 public T Get <T>(ParticleFieldAccessor <T> fieldAccessor) where T : struct
 {
     return(Utilities.Read <T>(Pointer + fieldAccessor));
 }