Ejemplo n.º 1
0
        private void InitializeLayer(Options pOptions, GraphicsDevice graphicsDevice)
        {
            if (cloudlayer != null)
                cloudlayer.Dispose();
            cloudlayer = new CloudLayer();
            cloudlayer.Initialize(pOptions, level.LevelVariables);
            cloudlayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.CloudsFX]);
            LevelLoadEnhanced(53, "Clouds Loaded...");
            if (frontparallaxLayer != null)
                frontparallaxLayer.Dispose();
            frontparallaxLayer = new ParallaxLayer();
            frontparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.FrontParallaxLayerImage];

            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 2);
            frontparallaxLayer.Initialize(pOptions, level.LevelVariables);
            frontparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.FrontParallaxLayerSpeedDivider]);
            frontparallaxLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.FrontParallaxFX]);
            LevelLoadEnhanced(56, "Front Parallax Layer loaded...");
            if (rearparallaxLayer != null)
                rearparallaxLayer.Dispose();
            rearparallaxLayer = new ParallaxLayer();
            rearparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.RearParallaxLayerImage];
            rearparallaxLayer.Initialize(pOptions, level.LevelVariables);
            rearparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.RearParallaxLayerSpeedDivider]);
            rearparallaxLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.RearParallaxFX]);
            LevelLoadEnhanced(59, "Rear Parallax Layer loaded...");
            if (rearDecoLayer != null)
                rearDecoLayer.Dispose();
            rearDecoLayer = new DecoLayer();
            rearDecoLayer.LayerName = DecorationsLayer.Rear.ToString();

            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 1);
            rearDecoLayer.Initialize(pOptions, level.LevelVariables);
            rearDecoLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.LevelFX]);
            if (frontDecoLayer != null)
                frontDecoLayer.Dispose();
            frontDecoLayer = new DecoLayer();
            frontDecoLayer.LayerName = DecorationsLayer.Front.ToString();
            frontDecoLayer.Initialize(pOptions, level.LevelVariables);
            frontDecoLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.LevelFX]);
            Texture2D tex = content.Load<Texture2D>("Img\\Game\\Exit");
            Rectangle exitRect = level.LevelVariables.ExitRectangle;
            exitRect.Width *= 2;
            exitRect.Height *= 2;
            exitRect.Y -= exitRect.Height / 2;
            ExtendedRectangle extRect = ExtendedRectangle.Transform(exitRect, new Vector2(tex.Width, tex.Height), null, Vector2.Zero, 0);
            LayerObject layerObject = new LayerObject(tex, extRect);
            rearDecoLayer.AddItem(layerObject);
        }
Ejemplo n.º 2
0
        private void InitializeLayer(Options pOptions)
        {
            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 4);
            cloudlayer = new CloudLayer();
            cloudlayer.Initialize(pOptions, level.LevelVariables);
            frontparallaxLayer = new ParallaxLayer();
            frontparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.FrontParallaxLayerImage];
            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 2);
            frontparallaxLayer.Initialize(pOptions,level.LevelVariables);
            frontparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.FrontParallaxLayerSpeedDivider]);
            rearparallaxLayer = new ParallaxLayer();
            rearparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.RearParallaxLayerImage];
            rearparallaxLayer.Initialize(pOptions,level.LevelVariables);
            rearparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.RearParallaxLayerSpeedDivider]);
            reardecoLayer = new DecoLayer();
            reardecoLayer.LayerName = DecorationsLayer.Rear.ToString();

            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 1);
            reardecoLayer.Initialize(pOptions,level.LevelVariables);
            frontDecoLayer = new DecoLayer();
            frontDecoLayer.LayerName = DecorationsLayer.Front.ToString();
            frontDecoLayer.Initialize(pOptions,level.LevelVariables);
        }