コード例 #1
0
 //move camera to another room
 public static void SwitchCamera(RoomsManager.Rooms room, float _playerPositionWeight = 1)
 {
     playerPositionWeight          = _playerPositionWeight;
     transientPlayerPositionWeight = playerPositionWeight;
     cameraTransitionProgression   = 1;
     Camera.Inizialize(backgrounds[(int)room], room);
 }
コード例 #2
0
ファイル: Camera.cs プロジェクト: aaaivan/999AD
 public static void Inizialize(Texture2D _background, RoomsManager.Rooms _room)
 {
     background      = _background;
     roomWidth       = MapsManager.maps[(int)_room].RoomWidthtPx;
     roomHeight      = MapsManager.maps[(int)_room].RoomHeightPx;
     position        = new Vector2(0, CameraManager.maxOffsetY);
     screenRectangle = new Rectangle(0, 0, Game1.gameWidth, Game1.gameHeight);
 }
コード例 #3
0
ファイル: Door.cs プロジェクト: aaaivan/999AD
        public void LockDoor(RoomsManager.Rooms room)
        {
            //make all the tiles on top of the door to type "solidEmpty" (invisible and NOT traversable)
            int topRow   = (int)position.Y / Tile.tileSize;
            int btmRow   = ((int)position.Y + sourceRectangles[(int)textureType].Height - 1) / Tile.tileSize;
            int leftCol  = (int)position.X / Tile.tileSize;
            int rightCol = ((int)position.X + sourceRectangles[(int)textureType].Width - 1) / Tile.tileSize;

            for (int row = topRow; row <= btmRow; row++)
            {
                for (int col = leftCol; col <= rightCol; col++)
                {
                    MapsManager.maps[(int)room].array[row, col].tileType = Tile.TileType.solidEmpty;
                }
            }
        }
コード例 #4
0
        //fill the list "maps" with the maps read from the corresponding text files
        public static void resetMap(RoomsManager.Rooms roomName)
        {
            string             line    = "";
            List <List <int> > tileMap = new List <List <int> >();

            string[] row;
            try
            {
                StreamReader inputStream = new StreamReader("mapFiles\\mapRoom_" + roomName + ".txt");
                using (inputStream)
                {
                    line = inputStream.ReadLine();
                    int count = 0;
                    while (line != null)
                    {
                        tileMap.Add(new List <int>());
                        row = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (string tile in row)
                        {
                            tileMap[count].Add(int.Parse(tile));
                        }
                        line = inputStream.ReadLine();
                        count++;
                    }
                    maps[(int)roomName] = new RoomMap(tileMap.Count, tileMap[0].Count);
                    for (int i = 0; i < tileMap.Count; i++)
                    {
                        for (int j = 0; j < tileMap[0].Count; j++)
                        {
                            if (tileMap[i][j] != 0)
                            {
                                maps[(int)roomName].array[i, j].tileType = (Tile.TileType)tileMap[i][j];
                            }
                        }
                    }
                }
            }
            catch (IOException)
            {
                return;
            }
            catch (System.ArgumentOutOfRangeException)
            {
                return;
            }
        }