Ejemplo n.º 1
0
        public EditorMapManager(ContentManager Content, SpriteBatch spriteBatch)
        {
            this.Content = Content;
            Spritebatch = spriteBatch;

            Initialized = false;
            PlayerPlaced = false;
            GoalPlaced = false;

            TileSize = 40;

            xTiles = 80;
            yTiles = 50;

            collisionLayer = new byte[xTiles, yTiles];
            backgroundLayer = new byte[xTiles, yTiles];
            platformLayer = new byte[xTiles, yTiles];
            specialsLayer = new byte[xTiles, yTiles];
            selectedLayer = backgroundLayer;
            selectedLayerNum = 0;

            SelectedTileValue = 0;

            selectionTopLeft = new Point(0, 0);
            selectionBottomRight = new Point(0, 0);

            //myTileSetTexture = Content.Load<Texture2D>("Tiles/TileSet");
            //myTileSetTexture = Content.Load<Texture2D>("Tiles/LabTileSet");
            myTileSetTexture = Content.Load<Texture2D>("Tiles/LabTileSet40x40");

            myLightRenderer = new LightRenderer(Game1.graphics);
            myLightRenderer.Initialize((int)Offset.X, (int)Offset.Y, xTiles * 20, yTiles * 20);
            myLightRenderer.LoadContent(Content);

            myLightRenderer.minLight = 0.20f;
            myLightRenderer.lightBias = 10f;
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            LightRenderer = new LightRenderer(Game1.graphics);
            EnemyManager.Reset();
            Camera.ClearFocusList();

            if (mapManager == null)
                mapManager = new MapManager();

            mapManager.Initialize(LightRenderer);
            finalRenderTarget = new RenderTarget2D(ScreenManager.Game.GraphicsDevice, MapManager.MapWidth, MapManager.MapHeight);

            if (Player == null)
                Player = new Player();

            Player.SetStartPos(mapManager.PlayerStartPos);
            lightPos = mapManager.PlayerStartPos;

            Camera.ResetValues(mapManager.PlayerStartPos);
            Camera.DefaultFocus = Player;
            Camera.Position = mapManager.PlayerStartPos;
            Camera.Limits = new Rectangle(0, 0, MapManager.MapWidth, MapManager.MapHeight);

            pointLightHandles = new List<PointLight>();
            spotLightHandles = new List<SpotLight>();

            LightRenderer.Initialize(0, 0, MapManager.MapWidth, MapManager.MapHeight);

            LightRenderer.minLight = 0.15f;
            LightRenderer.lightBias = 10f;
            spotLightDir = Vector2.UnitX * -1.00001f;

            //pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 300f, Color.White));

            pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 200f, Color.Red));
            pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 250f, Color.LightGreen));
            pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 250f, Color.LightGreen));

            spotLightHandles.Add(new SpotLight(new Vector2(200, 200), spotLightDir, 1f, 2f, 0.5f, 500f, Color.LightBlue));
            spotLightHandles.Add(new SpotLight(new Vector2(200, 200), spotLightDir, 1f, 2f, 0.5f, 500f, Color.Red));

            //LightRenderer.pointLights.Add(pointLightHandles[0]);
            //LightRenderer.pointLights.Add(pointLightHandles[1]);
            //LightRenderer.pointLights.Add(pointLightHandles[2]);
            //LightRenderer.spotLights.Add(spotLightHandles[0]);
            //LightRenderer.spotLights.Add(spotLightHandles[1]);

            LightRenderer.LoadContent(ScreenManager.Game.Content);
            Console.WriteLine("PointLights.Count: " + LightRenderer.pointLights.Count);
            myAffectLightDir = false;
            myCurrLight = 0;
        }