public void BgAsTextureCollection(GameObject backgroundContainer, Dictionary <int, List <Vector2> > data) { int wCount; int hCount; int counter; foreach (KeyValuePair <int, List <Vector2> > set in data) { for (int i = 0; i < set.Value.Count; i++) { Vector2 pos = ChimeraWorld.ChimeraToGlobal(set.Value[i]); if (pos != null) { GameObject node = new GameObject(); node.name = "grassElement"; node.transform.parent = backgroundContainer.transform; node.AddComponent <SpriteRenderer>().sprite = textureStorage[set.Key]; pos = ChimeraWorld.camera.ScreenToWorldPoint(pos) * ChimeraWorld.rescaler; node.transform.position = new Vector3(pos.x, pos.y, 0f); nodes.Add(node); } } } }
// Use this for initialization void Start() { ChimeraWorld chimera = ChimeraWorld.Instance; chimera.SetWorldSize(1000, 1000); chimera.SetBGList(GetBGDataFromServer); chimera.CreateGrid(true, 32, 16, new Vector2() { x = 0, y = 0 }, new Bounds() { size = new Vector2() { x = 1000, y = 1000 } }); }