private void ReuseCollider(ref Hex pos) { GameObject go = collidersPool.Dequeue(); go.SetActive(true); Vector2 center = Hex.HexToPixel(pos, datas.tVars.WorldSize); go.transform.position = new Vector3(center.x, 0, center.y); ChunkColGenerator map = go.GetComponent <ChunkColGenerator>(); map.Generate(center.x, center.y); collidersDictionary.Add(pos, go); }
private void NewCollider(ref Hex pos) { GameObject go = new GameObject("Col: " + pos.ToString(), typeof(ChunkColGenerator)); Vector2 center = Hex.HexToPixel(pos, datas.tVars.WorldSize); go.transform.position = new Vector3(center.x, 0, center.y); go.transform.SetParent(transform, false); ChunkColGenerator map = go.GetComponent <ChunkColGenerator>(); map.datas = datas; map.Generate(center.x, center.y); collidersDictionary.Add(pos, go); }