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)); }
public void TestInitialize() { _iLogger = new StubILogger(); _postDAL = new StubIPostDAL(); _iMainViewModel = new MainViewModel(_postDAL, _iLogger); _iLayoutCreator = new LayoutCreator(); _iPostViewModel = new PostViewModel(_iLogger, _iLayoutCreator); }
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); }
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); }
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; } }
private static int GetMaxXCoordinate(this ILayoutCreator layoutCreator) { return(layoutCreator.GetAllRectangles().Max(r => r.X + r.Width)); }
private static int GetMinYCoordinate(this ILayoutCreator layoutCreator) { return(layoutCreator.GetAllRectangles().Min(r => r.Y)); }
/// <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; }