コード例 #1
0
ファイル: TileGenerator.cs プロジェクト: hsinpa/Danmaku
        private void RenderRoom(MapGenerator.RoomInfo p_roomInfo, RoomDecoration p_roomDecoration)
        {
            int xOffset = roomRadius.x * p_roomInfo.x, yOffset = roomRadius.y * p_roomInfo.y;

            string renderString = "";

            for (int y = p_roomDecoration.height - 1; y >= 0; y--)
            {
                for (int x = 0; x < p_roomDecoration.width; x++)
                {
                    renderString += p_roomDecoration.decorationCode[x, y];

                    //if (p_roomDecoration.decorationCode[x, y] == "0") {
                    //    var pObject = Instantiate(EmptyPrefab);
                    //    pObject.transform.position = new Vector2(x, y);
                    //}


                    if (p_roomDecoration.decorationCode[x, y] == "1")
                    {
                        var pObject = Instantiate(BrickPrefab);
                        pObject.transform.position = new Vector2(xOffset + x, yOffset + y);
                    }

                    if (x == p_roomDecoration.width - 1)
                    {
                        renderString += "\n";
                    }
                }
            }

            //Debug.Log(renderString);
        }
コード例 #2
0
ファイル: TileGenerator.cs プロジェクト: hsinpa/Danmaku
        private void GenerateUpRoom(MapGenerator.RoomInfo roomInfo)
        {
            var roomDecoration = new RoomDecoration(roomRadius.x, roomRadius.y, new Vector2Int(roomInfo.x, roomInfo.y));

            roomDecoration = CreateWall(new Vector2Int(0, roomDecoration.height - 1), roomDecoration, Vector2Int.right, roomDecoration.width, true);
            roomDecoration = CreateWall(new Vector2Int(0, 0), roomDecoration, Vector2Int.right, roomDecoration.width, false);
            roomDecoration = CreateWall(new Vector2Int(0, roomDecoration.height - 1), roomDecoration, Vector2Int.down, roomDecoration.height, true);
            roomDecoration = CreateWall(new Vector2Int(roomDecoration.width - 1, roomDecoration.height - 1), roomDecoration, Vector2Int.down, roomDecoration.height, true);

            RenderRoom(roomInfo, roomDecoration);
        }