
// const FIRST_CHUNKS_SIZE = 3;

import { addGameObjectToGameState } from "../GameState/GameState";
import { BC_CAMERA, BC_CHUNKS_SETTINGS, BC_TERRAIN_MANAGER, BC_TERRAIN_SETTINGS } from "../GlobalVariables/GlobalVariables";
import { PointInt2D } from "../Utils/Math.utils";
import { Chunk } from "./Chunk/Chunk";

export function generateFirstChunks() {
    let w = BC_CHUNKS_SETTINGS.width * BC_TERRAIN_SETTINGS.totalSize;
    let h = BC_CHUNKS_SETTINGS.height * BC_TERRAIN_SETTINGS.totalSize;
    for (let i = -1; i < 2; i++) {
        for (let j = -1; j < 2; j++) {
            let chunkPivot = new PointInt2D(Math.floor((BC_CAMERA.position.x + w * i) / w), Math.floor((BC_CAMERA.position.y + h * j) / h));
            let chunk = BC_TERRAIN_MANAGER.createNewChunk(chunkPivot);
            BC_TERRAIN_MANAGER.addChunk(chunk);
        }
    }
}