コード例 #1
0
        public void Initialize(GraphicsDevice GraphicsDevice, ContentManager Content)
        {
            cameraMatrix = Matrix.CreateTranslation(400 - Tile.Size * 11, Tile.Size, 0);

            Tile.InitTextures(GraphicsDevice, BiomeData.GetBiome(1));

            // load maze
            int MapId = 0;

            maze = Cell.ParseData(MapData.GetMap(MapId));

            // load graphic stuff
            pixel = Content.Load <Texture2D>("pixel");
            Pj.ColliderTexture = Content.Load <Texture2D>("pj");
            Pj.IdleTexture     = Content.Load <Texture2D>("pj_idle");
            Pj.RunningTexture  = Content.Load <Texture2D>("pj_running");
            Pj.PaletteTexture  = Content.Load <Texture2D>("pj_palette");
            Pj.effect          = Content.Load <Effect>("pj_shader");
            Pj.effect.Parameters["u_lut"].SetValue(Pj.PaletteTexture);


            this.Pjs   = new Dictionary <string, Pj>();
            this.aiPjs = new List <AiPj>();

            //Pjs.Add("Player", new TestPj("Player", PlayerControllerIndex.Keyboard, 18.5f * Tile.Size, 2.5f * Tile.Size, 1));
            AiPj aipj = new AiPj("AI", Tile.Size * 2.5f, Tile.Size * 2.5f, 2);

            Pjs.Add("AI", aipj);
            aiPjs.Add(aipj);
        }
コード例 #2
0
        public void Initialize(GraphicsDevice GraphicsDevice, ContentManager Content)
        {
            BiomeData.Biome biome = BiomeData.GetBiome(3);
            int mapId = 0;

            pixel = Content.Load<Texture2D>("pixel");
            Tile.InitTextures(GraphicsDevice, biome);
            world = new GameWorld();
            world.maze = Cell.ParseData(MapData.GetMap(mapId));

            renderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            renderTargetRectangle = new Rectangle(0, 0, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            cameraMatrix = Matrix.CreateTranslation(GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - Tile.Size * 11, Tile.Size, 0);
            floorRectangle = new Rectangle(0, 0, world.maze.GetLength(1) * Tile.Size, world.maze.GetLength(0) * Tile.Size);


            this.biome = new Biome
            {
                BackgroundColor = biome.BackgroundColor,
                FloorColor = biome.GroundColor,
                WallColor = biome.WallColor,
                WallTopColor = biome.WallTopColor,

                BackgroundOverlayTexture = null,
                FloorOverlayTexture = Content.Load<Texture2D>("gravelOverlay"),
                WallOverlayTexture = Content.Load<Texture2D>("gravelOverlay"),
                WallTopOverlayTexture = Content.Load<Texture2D>("iceOverlay"),

                BackgroundBlendingMode = Biome.BlendingMode.Normal,
                FloorBlendingMode = Biome.BlendingMode.Reflect,
                WallBlendingMode = Biome.BlendingMode.Reflect,
                WallTopBlendingMode = Biome.BlendingMode.Reflect,
            };

            biomeBackgroundEffect = Content.Load<Effect>("floor_shader");
            biomeEffect = Content.Load<Effect>("walls_shader");
            biomeEffect.Parameters["u_wallBlendingMode"]?.SetValue((int)this.biome.WallBlendingMode);
            biomeEffect.Parameters["u_wallColor"]?.SetValue(this.biome.WallColor.ToVector3());
            biomeEffect.Parameters["u_wallOverlayTexture"]?.SetValue(this.biome.WallOverlayTexture);
            biomeEffect.Parameters["u_wallOverlayTextureSize"]?.SetValue(new Vector2(this.biome.WallOverlayTexture.Width, this.biome.WallOverlayTexture.Height));
            biomeEffect.Parameters["u_wallTopBlendingMode"]?.SetValue((int)this.biome.WallTopBlendingMode);
            biomeEffect.Parameters["u_wallTopColor"]?.SetValue(this.biome.WallTopColor.ToVector3());
            biomeEffect.Parameters["u_wallTopOverlayTexture"]?.SetValue(this.biome.WallTopOverlayTexture);
            biomeEffect.Parameters["u_wallTopOverlayTextureSize"]?.SetValue(new Vector2(this.biome.WallTopOverlayTexture.Width, this.biome.WallTopOverlayTexture.Height));
            biomeEffect.Parameters["u_screenSize"]?.SetValue(new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight));
        }
コード例 #3
0
 private LoadGameScreen(int PlayersCount, int MapId, int BiomeId)
 {
     ExpectedPlayers = PlayersCount;
     this.MapId      = MapId;
     this.biome      = BiomeData.GetBiome(BiomeId);
 }