Ejemplo n.º 1
0
        public Grid(int _Columns, int _Rows, bool showGridDebugLogs, GridContainer _Container)
        {
            Columns     = _Columns;
            Rows        = _Rows;
            TileGrid    = new Tile[Columns, Rows];
            GridCorners = new List <Tile>();
            AssignCoordinatesAndPositionsToTiles();
            Container = _Container;

            if (showGridDebugLogs)
            {
                Debug.Log($"<b>Grid Debug</b>Tiles Generated: {Columns * Rows}\nColumns: {Columns}\nRows: {Rows}");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generate the Grid based off of the Camera and Screen Size.
        /// </summary>
        /// <param name="OrthographicSize">The Camera's Orthographic Size.</param>
        /// <param name="ScreenWidth">The Current Screen's Width.</param>
        /// <param name="ScreenHeight">The Current Screen's Height.</param>
        public Grid(int OrthographicSize, float ScreenWidth, float ScreenHeight, bool showGridDebugLogs, GridContainer _Container)
        {
            Vertical    = OrthographicSize;
            Horizontal  = (int)Mathf.Round(Vertical * ScreenWidth / ScreenHeight);
            Columns     = Horizontal * 2;
            Rows        = (int)Vertical * 2;
            TileGrid    = new Tile[Columns, Rows];
            GridCorners = new List <Tile>();
            AssignCoordinatesAndPositionsToTiles();
            Container = _Container;

            if (showGridDebugLogs)
            {
                Debug.Log($"<b>Grid Debug</b>\nOrthoSize: {OrthographicSize} (ScreenWidth: {ScreenWidth}, ScreenHeight: {ScreenHeight})\nVertical: {Vertical}\nHorizontal: {Horizontal}\nColumns: {Columns}\nRows: {Rows}");
            }
        }