using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class GridManager : MonoBehaviour
{
    [SerializeField] private int gridWidth, gridHeight;
    [SerializeField] private T tile;
    [SerializeField] private Transform camera;
        
    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < gridWidth; i++)
        {
            for (int j = 0; j < gridHeight; j++)
            {
                var newTile = Instantiate(tile, new Vector3(i, j), Quaternion.identity);
                newTile.name = $"Tile {i} {j}";

                bool offset = (i % 2 == 0 && j % 2 != 0) | (i % 2 != 0 && j % 2 == 0);
                newTile.Init(offset);
            }
        }

        camera.transform.position = new Vector3((float)gridWidth / 2 - 0.5f, (float)gridHeight / 2 - 0.5f, -10f);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}