Changeset 803


Ignore:
Timestamp:
2010-06-14 14:18:35 (9 years ago)
Author:
sijoseha
Message:

Building up.
Abstracted particlesystem

Location:
2010/23/sijoseha/alpha/Effects
Files:
2 edited

Legend:

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

    r802 r803  
    1717    { 
    1818 
    19         public Explosion(Game game, Vector2 position) 
    20             : base(game, position) 
     19        public Explosion(Game game, Vector2 position, String textureName) 
     20            : base(game, position, textureName) 
    2121        { 
    2222 
     
    2525        protected override void InitializeParticles() 
    2626        { 
     27             
    2728        } 
    2829    } 
  • 2010/23/sijoseha/alpha/Effects/ParticleSystem.cs

    r802 r803  
    2323        protected Vector2 position; 
    2424 
    25         protected Texture2D texture; 
     25        protected String textureName; 
    2626 
    27         protected Texture2D innerTexture; 
    28         protected Texture2D outTexture; 
     27        protected String innerTextureName; 
     28        protected String outerTextureName; 
    2929 
    3030        protected float minScale; 
     
    4343        #endregion 
    4444 
     45        private enum TextureType 
     46        { 
     47            Single, 
     48            Dual 
     49        }; 
     50 
     51        private TextureType textureType; 
     52 
     53        private Texture2D texture, innerTexture, outerTexture; 
     54 
    4555        private int maxAmountOfParticles; 
    4656        public int MaxAmountOfParticles 
     
    5060        } 
    5161 
    52         public ParticleSystem(Game game, Vector2 position) 
     62        public ParticleSystem(Game game, Vector2 position, String textureName) 
    5363            : base(game) 
    5464        { 
     65            textureType = TextureType.Single; 
     66            this.game = game; 
     67        } 
     68 
     69        public ParticleSystem(Game game, Vector2 position, String innerTextureName, String outerTextureName) 
     70            : base(game) 
     71        { 
     72            textureType = TextureType.Dual; 
    5573            this.game = game; 
    5674        } 
     
    6078        protected override void LoadContent() 
    6179        { 
     80            if (textureType == TextureType.Single) 
     81            { 
     82                texture = game.Content.Load<Texture2D>(textureName.ToString()); 
     83            } 
     84            if (textureType == TextureType.Dual) 
     85            { 
     86                innerTexture = game.Content.Load<Texture2D>(innerTextureName.ToString()); 
     87                outerTexture = game.Content.Load<Texture2D>(outerTextureName.ToString()); 
     88            } 
    6289            base.LoadContent(); 
    6390        } 
Note: See TracChangeset for help on using the changeset viewer.