Ejemplo n.º 1
0
        public Bounds RenderBaseLevel(ILayoutCreator layoutCreator)
        {
            layoutGenerator = layoutCreator;

            var roomTypeLayout = layoutGenerator.GenerateRoomLayout();

            var x = transform.position.x;
            var y = transform.position.y;

            var levelSize = roomTypeLayout.LevelSize;

            for (int i = 0; i < levelSize.Height; i++)
            {
                for (int j = 0; j < levelSize.Width; j++)
                {
                    GameObject marker = null;
                    var        room   = RenderRoom(roomTypeLayout.TypeLayout[i, j], i, j);

                    if (roomTypeLayout.StartingPostion.Height == i && roomTypeLayout.StartingPostion.Width == j)
                    {
                        marker = Instantiate(startingRoomMarker, room.transform.position, Quaternion.identity);
                        marker.transform.localScale = new Vector3(room.roomSize.Width, room.roomSize.Height, 1);
                        marker.transform.parent     = room.transform;
                    }
                    else if (roomTypeLayout.MainPath.Any(p => p.Height == i && p.Width == j))
                    {
                        marker = Instantiate(mainPathMarker, room.transform.position, Quaternion.identity);
                        marker.transform.localScale = new Vector3(room.roomSize.Width, room.roomSize.Height, 1);
                        marker.transform.parent     = room.transform;
                    }
                }
            }

            return(GenerateWalls(roomTypeLayout));
        }
Ejemplo n.º 2
0
 public void TestInitialize()
 {
     _iLogger        = new StubILogger();
     _postDAL        = new StubIPostDAL();
     _iMainViewModel = new MainViewModel(_postDAL, _iLogger);
     _iLayoutCreator = new LayoutCreator();
     _iPostViewModel = new PostViewModel(_iLogger, _iLayoutCreator);
 }
Ejemplo n.º 3
0
        public WordCloudDrawer(WordPreprocessor wordPreprocessor, ILayoutCreator layoutCreator,
                               BitmapSettings bitmapSettings, Func <WeightedWord, WordDescription> weightedWord2WordDescriptionMapper)
        {
            this.wordPreprocessor = wordPreprocessor;
            this.layoutCreator    = layoutCreator;
            this.weightedWord2WordDescriptionMapper = weightedWord2WordDescriptionMapper;

            bitmap = new Bitmap(bitmapSettings.Size.Width, bitmapSettings.Size.Height);
            Graphics.FromImage(bitmap).Clear(bitmapSettings.BackgroundColor);
        }
Ejemplo n.º 4
0
    private void Start()
    {
        if (levelSize == null)
        {
            return;
        }

        var startingPoint = new LevelCoordinate
        {
            Height = 0,
            Width  = Random.Range(0, levelSize.Width)
        };

        levelRenderer  = GetComponent <LevelRenderer>();
        roomCollection = GetComponent <RoomCollection>();

        layoutCreator = new FourByFourLayout(roomCollection.GetRoomTypes(), startingPoint);

        bounds = levelRenderer.RenderBaseLevel(layoutCreator);
    }
Ejemplo n.º 5
0
 public void TestTearDown()
 {
     if (_iMainViewModel != null)
     {
         _iMainViewModel = null;
     }
     if (_postDAL != null)
     {
         _postDAL = null;
     }
     if (_iLogger != null)
     {
         _iLogger = null;
     }
     if (_iPostViewModel != null)
     {
         _iPostViewModel = null;
     }
     if (_iLayoutCreator != null)
     {
         _iLayoutCreator = null;
     }
 }
Ejemplo n.º 6
0
 private static int GetMaxXCoordinate(this ILayoutCreator layoutCreator)
 {
     return(layoutCreator.GetAllRectangles().Max(r => r.X + r.Width));
 }
Ejemplo n.º 7
0
 private static int GetMinYCoordinate(this ILayoutCreator layoutCreator)
 {
     return(layoutCreator.GetAllRectangles().Min(r => r.Y));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PostViewModel" /> class.
 /// </summary>
 /// <param name="iLogger">The i logger.</param>
 /// <param name="iLayoutCreator">The i layout creator.</param>
 public PostViewModel(ILogger iLogger, ILayoutCreator iLayoutCreator)
 {
     _iLogger        = iLogger;
     _iLayoutCreator = iLayoutCreator;
 }