Пример #1
0
        //Apoplexy.tile[] myTiles;
        public Room(Maze Maze, Level Level, Apoplexy.level ApoplexyLevel, Apoplexy.tile[] ApoplexyTiles, string roomNumber, Apoplexy.links ApoplexyLink, Apoplexy.guard[] ApoplexyGuards, Apoplexy.@event[] ApoplexyEvents, Apoplexy.prince ApoplexyPrince, string RoomName)
        {
            this.level      = Level;
            this.maze       = Maze;
            this.roomName   = RoomName;
            this.roomNumber = int.Parse(roomNumber);

            _RoomDown  = int.Parse(ApoplexyLink.down);
            _RoomUp    = int.Parse(ApoplexyLink.up);
            _RoomLeft  = int.Parse(ApoplexyLink.left);
            _RoomRight = int.Parse(ApoplexyLink.right);

            LoadTilesApoplexy(ApoplexyLevel, ApoplexyTiles, ApoplexyGuards, ApoplexyEvents);

            if (ApoplexyPrince.room == roomNumber)
            {
                if (ApoplexyPrince.direction == "1")
                {
                    roomStartDirection = SpriteEffects.FlipHorizontally;
                }
                else
                {
                    roomStartDirection = SpriteEffects.None;
                }

                int y = int.Parse(ApoplexyPrince.location) / 11;
                int x = (int.Parse(ApoplexyPrince.location) % 11) - 1;


                int xPlayer = (x - 1) * Tile.WIDTH + Player.SPRITE_SIZE_X;
                int yPlayer = ((y + 1) * (Tile.HEIGHT)) - Sprite.SPRITE_SIZE_Y + Room.TOP_BORDER;

                roomStart         = true;
                roomStartPosition = new Vector2(xPlayer, yPlayer);
            }
        }
Пример #2
0
        public void LoadTilesApoplexy(Apoplexy.level Apoplexylevel, Apoplexy.tile[] ApoplexyTiles, Apoplexy.guard[] Apoplexyguards, Apoplexy.@event[] Apoplexyevents)
        {
            int ix           = 0;
            int switchButton = 0;

            tiles = new Tile[10, 3]; //30 fix...sorry
            Enumeration.Items item = Enumeration.Items.none;
            for (int x = 0; x < 10; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    ix = 10 * y + x;

                    Enumeration.TileType  nextTileType = Enumeration.TileType.space;
                    Enumeration.TileType  myTileType   = Enumeration.TileType.space;
                    Enumeration.StateTile myStateTile  = Enumeration.StateTile.normal;
                    //convert TileType to
                    myTileType   = Utils.ParseTileType(ApoplexyTiles[ix].element);
                    myStateTile  = Utils.ParseStateType(ref myTileType, ApoplexyTiles[ix].modifier);
                    switchButton = Utils.ParseSwitchButton(myTileType, ApoplexyTiles[ix].modifier);


                    if (myTileType == Enumeration.TileType.flask)
                    {
                        myTileType  = Enumeration.TileType.floor;
                        myStateTile = Enumeration.StateTile.normal;
                        item        = Enumeration.Items.flask;
                    }
                    else if (myTileType == Enumeration.TileType.sword)
                    {
                        myTileType  = Enumeration.TileType.floor;
                        myStateTile = Enumeration.StateTile.normal;
                        item        = Enumeration.Items.sword;
                    }
                    else
                    {
                        item = Enumeration.Items.none;
                    }


                    tiles[x, y] = LoadTile(myTileType, myStateTile, switchButton, item, nextTileType);

                    Vector2 v = new Vector2(x * Tile.WIDTH, (y * Tile.HEIGHT) - Tile.HEIGHT_VISIBLE);

                    tiles[x, y].Position   = new Position(Vector2.Zero, new Vector2(Tile.WIDTH, Tile.REALHEIGHT));
                    tiles[x, y].Position.X = v.X;
                    tiles[x, y].Position.Y = v.Y;
                }
            }
            //LOAD GUARD
            foreach (Apoplexy.guard g in Apoplexyguards)
            {
                if (g.location != "0")
                {
                    int iLocation = int.Parse(g.location);
                    int xGuard    = iLocation % 10 - 1;
                    int yGuard    = iLocation / 10 + 1;

                    xGuard = xGuard * Tile.WIDTH + Player.SPRITE_SIZE_X;
                    yGuard = (yGuard * (Tile.HEIGHT)) - Sprite.SPRITE_SIZE_Y + Room.TOP_BORDER;
                    Guard guardSprite = new Guard(this, new Vector2(xGuard, yGuard), maze.graphicsDevice, SpriteEffects.None); //to be fixed direction
                    level.sprites.Add(guardSprite);
                }
            }
        }