public ParticleEffect(Texture2D texture, ParticleType pType, BlendState blend, Camera camera)
 {
     mCamera = camera;
     mParticles = new List<Particle>();
     particleTexture = texture;
     m_pType = pType;
     mBlendType = blend;
 }
Example #2
0
        public override void init()
        {
            //Shader stuff
            mDevice = mManager.mGraphicsDevice;
            tempBinding = mDevice.GetRenderTargets();
            tempRenderTarget = new RenderTarget2D(mDevice, 1280, 720);

            blurShader = new BlurFocusShader(mDevice, tempRenderTarget, mManager.blur);
            //rippleShader = new RippleShader(mDevice, tempRenderTarget, mManager.ripple);
            //Shader stuff ends

            //Map stuff
            map = mManager.mGame.Content.Load<Map>("maps\\" + mManager.mLevelName);
            mapDisplayDevice = new XnaDisplayDevice(mManager.mGame.Content, mDevice);
            map.LoadTileSheets(mapDisplayDevice);
            viewport = new xTile.Dimensions.Rectangle(new Size(1280, 720));
            //Map stuff done

            scoreCounter = new ScoreCounter();
            camera = new Camera();
            runEffect = new ParticleEffect(mManager.particleEffect, ParticleEffect.ParticleType.Dust, BlendState.AlphaBlend, camera);
            explosion = new ParticleEffect(mManager.particleEffect, ParticleEffect.ParticleType.Explosion, BlendState.Additive, camera);
            input = new GetInput(PlayerIndex.One);
            player = new Hero(mManager.heroSprites);
            shotList = new List<Shot>();
            puncheeList = new List<Punchee>();
            scoreAreaList = new List<ScoreArea>();
            chargingSoundEffect = mManager.chargingSound.CreateInstance();
            chargingSoundEffect.Pitch = 0.2f;

            attachEventListener();

            for (int i = 0; i < map.Layers[0].LayerWidth; i++)
            {
                for (int j = 0; j < map.Layers[0].LayerHeight; j++)
                {
                    Layer collision = map.Layers[0];
                    Location tileLocation = new Location(i, j);
                    Tile tile = collision.Tiles[tileLocation];

                    if (tile.TileIndex == 90)
                    {
                        ParticleEffect trail = new ParticleEffect(mManager.particleEffect, ParticleEffect.ParticleType.Knockback, BlendState.AlphaBlend, camera);
                        Punchee punched = new Punchee(mManager.startScreen, trail);
                        FollowAI followAI = new FollowAI(punched, player);
                        punched.addAI(followAI);
                        punched.mPosition.X = 32 * i;
                        punched.mPosition.Y = 32 * j;
                        puncheeList.Add(punched);
                    }

                    if (tile.TileIndex == 77)
                    {
                        int posX = i * 32;
                        int posY = j * 32;

                        ScoreArea scoreArea = new ScoreArea(posX, posY);
                        scoreAreaList.Add(scoreArea);
                    }
                }
            }
        }