Ignore:
Timestamp:
2010-06-14 14:56:07 (10 years ago)
Author:
sijoseha
Message:

Building

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2010/23/sijoseha/alpha/Effects/Particle.cs

    r802 r819  
    1616    class Particle 
    1717    { 
    18         private ParticleGame game; 
    19         Random random = new Random(); 
     18 
     19        #region Variables, getters and setters 
     20 
    2021        private Vector2 position; 
    2122        public Vector2 Position 
     
    3031            get { return texture; } 
    3132            set { texture = value; } 
    32         } 
    33  
    34         private Texture2D innerTexture; 
    35         public Texture2D InnerTexture 
    36         { 
    37             get { return innerTexture; } 
    38             set { innerTexture = value; } 
    3933        } 
    4034 
     
    8882        } 
    8983 
    90         public Particle(ParticleGame game, Texture2D texture, Texture2D innerTexture, Vector2 position, float lifetime) 
     84        #endregion 
     85 
     86        public void Initialize(Texture2D texture, Vector2 position, float scale, float rotation, Vector2 velocity, float lifetime) 
    9187        { 
    9288            this.alive = true; 
    93             this.game = game; 
    9489            this.texture = texture; 
    95             this.innerTexture = innerTexture; 
    9690            this.position = position; 
    97             this.Scale = 1.0f; 
    98             this.Rotation = 1.0f; 
     91            this.scale = scale; 
    9992            this.lifetime = lifetime; 
    100             this.Origin = new Vector2(texture.Width / 2, texture.Height / 2); 
     93            this.rotation = rotation; 
     94            this.origin = new Vector2(texture.Width / 2, texture.Height / 2); 
     95 
     96            this.currentTime = 0.0f; 
     97        } 
     98 
     99        /// <summary> 
     100        /// Updates particles position 
     101        /// TODO: 
     102        /// - Update for rotation, velocity etc. 
     103        /// </summary> 
     104        /// <param name="time"></param> 
     105        public void Update(float time) 
     106        { 
     107            this.position = velocity * time; 
     108            this.currentTime += time; 
    101109        } 
    102110    } 
Note: See TracChangeset for help on using the changeset viewer.